1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-09-13 07:13:00 +03:00

Include headers properly

This commit is contained in:
Davide Beatrici 2021-04-05 04:48:25 +02:00
parent 46b54f00be
commit a6ba9b8788
190 changed files with 1885 additions and 1850 deletions

View File

@ -59,7 +59,7 @@ add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_S
include_directories(.) include_directories(.)
if(WIN32) if(WIN32)
add_definitions(-DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS) add_definitions(-DWIN32 -D_WINDOWS -DOS_WIN32 -D_CRT_SECURE_NO_WARNINGS)
endif() endif()
if(UNIX) if(UNIX)
@ -67,7 +67,7 @@ if(UNIX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
add_definitions(-DUNIX) add_definitions(-DUNIX -DOS_UNIX)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions(-DUNIX_LINUX) add_definitions(-DUNIX_LINUX)

View File

@ -5,7 +5,18 @@
// Account.c // Account.c
// Account Manager // Account Manager
#include "CedarPch.h" #include "Account.h"
#include "Hub.h"
#include "Layer3.h"
#include "Proto_PPP.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
// Policy items // Policy items
POLICY_ITEM policy_item[] = POLICY_ITEM policy_item[] =

View File

@ -8,6 +8,10 @@
#ifndef ACCOUNT_H #ifndef ACCOUNT_H
#define ACCOUNT_H #define ACCOUNT_H
#include "CedarType.h"
#include "Mayaqua/Encrypt.h"
#define USER_MAC_STR_PREFIX L"MAC:" #define USER_MAC_STR_PREFIX L"MAC:"
#define USER_IPV4_STR_PREFIX L"IPv4:" #define USER_IPV4_STR_PREFIX L"IPv4:"

View File

@ -5,7 +5,42 @@
// Admin.c // Admin.c
// RPC Module for Management // RPC Module for Management
#include "CedarPch.h" #include "Admin.h"
#include "Account.h"
#include "AzureClient.h"
#include "BridgeUnix.h"
#include "BridgeWin32.h"
#include "Connection.h"
#include "DDNS.h"
#include "Layer3.h"
#include "Link.h"
#include "Listener.h"
#include "Nat.h"
#include "Remote.h"
#include "Proto.h"
#include "Proto_IPsec.h"
#include "Proto_OpenVPN.h"
#include "Proto_PPP.h"
#include "Protocol.h"
#include "Sam.h"
#include "SecureNAT.h"
#include "Server.h"
#include "Session.h"
#include "Virtual.h"
#include "Wpc.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/HTTP.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
// Macro for RPC function declaration // Macro for RPC function declaration
#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ #define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \

View File

@ -8,6 +8,14 @@
#ifndef ADMIN_H #ifndef ADMIN_H
#define ADMIN_H #define ADMIN_H
#include "Account.h"
#include "Cedar.h"
#include "Client.h"
#include "Hub.h"
#include "Logging.h"
#include "Mayaqua/Kernel.h"
// Windows version // Windows version
struct RPC_WINVER struct RPC_WINVER
{ {

View File

@ -5,7 +5,23 @@
// AzureClient.c // AzureClient.c
// VPN Azure Client // VPN Azure Client
#include "CedarPch.h" #include "AzureClient.h"
#include "Cedar.h"
#include "Command.h"
#include "Wpc.h"
#include "Mayaqua/Encrypt.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/MayaType.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Network.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
#include <stdlib.h>
// Wait for connection request // Wait for connection request
void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param) void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)

View File

@ -8,6 +8,11 @@
#ifndef AZURE_CLIENT_H #ifndef AZURE_CLIENT_H
#define AZURE_CLIENT_H #define AZURE_CLIENT_H
#include "Cedar.h"
#include "DDNS.h"
#include "Mayaqua/MayaType.h"
// Constants // Constants
#define AZURE_SERVER_PORT 443 #define AZURE_SERVER_PORT 443
#define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL" #define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL"

View File

@ -1,10 +0,0 @@
// SoftEther VPN Source Code - Developer Edition Master Branch
// Cedar Communication Module
// AzureServer.c
// VPN Azure Server
#include "CedarPch.h"

View File

@ -1,14 +0,0 @@
// 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

View File

@ -5,25 +5,19 @@
// Bridge.c // Bridge.c
// Ethernet Bridge Program (Local Bridge) // Ethernet Bridge Program (Local Bridge)
#include <GlobalConst.h> #include "Bridge.h"
#include "BridgeUnix.h"
#include "BridgeWin32.h"
#define BRIDGE_C #include "Connection.h"
#include "Hub.h"
#include "Session.h"
#include "Virtual.h"
#ifdef WIN32 #include "Mayaqua/Memory.h"
#define OS_WIN32 #include "Mayaqua/Microsoft.h"
#endif #include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#ifdef OS_WIN32
// Win32
#include "BridgeWin32.c"
#else
// Unix
#include "BridgeUnix.c"
#endif // OS_WIN32
// Hash the list of current Ethernet devices // Hash the list of current Ethernet devices
UINT GetEthDeviceHash() UINT GetEthDeviceHash()

View File

@ -8,20 +8,10 @@
#ifndef BRIDGE_H #ifndef BRIDGE_H
#define BRIDGE_H #define BRIDGE_H
#ifdef OS_WIN32 #include "Cedar.h"
// For Win32
#include <Cedar/BridgeWin32.h>
#else
// For Unix
#include <Cedar/BridgeUnix.h>
#endif // OS_WIN32
// Constants // Constants
#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router" #define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router"
// Bridge // Bridge
struct BRIDGE struct BRIDGE

View File

@ -4,22 +4,31 @@
// BridgeUnix.c // BridgeUnix.c
// Ethernet Bridge Program (for UNIX) // Ethernet Bridge Program (for UNIX)
//#define BRIDGE_C
//#define UNIX_LINUX
#include <GlobalConst.h> #ifdef OS_UNIX
#ifdef BRIDGE_C #include "BridgeUnix.h"
#include "Server.h"
#include "VLanUnix.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/TcpIp.h"
#include "Mayaqua/Unix.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h> #include <errno.h>
#include <Mayaqua/Mayaqua.h> #include <fcntl.h>
#include <Cedar/Cedar.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#ifdef UNIX_SOLARIS #ifdef UNIX_SOLARIS
#include <sys/sockio.h> #include <sys/sockio.h>
@ -27,17 +36,18 @@
#ifdef BRIDGE_PCAP #ifdef BRIDGE_PCAP
#include <pcap.h> #include <pcap.h>
#endif // BRIDGE_PCAP #endif
#ifdef BRIDGE_BPF #ifdef BRIDGE_BPF
#include <sys/ioctl.h> #include <ifaddrs.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <net/if_types.h> #include <net/if_types.h>
#include <net/if_dl.h> #include <net/if_dl.h>
#include <ifaddrs.h> #endif
#endif // BRIDGE_BPF
#ifdef UNIX_LINUX
#include <linux/if_packet.h>
#ifdef UNIX_LINUX
struct my_tpacket_auxdata struct my_tpacket_auxdata
{ {
UINT tp_status; UINT tp_status;
@ -2688,5 +2698,4 @@ void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size)
Free(data); Free(data);
} }
#endif
#endif // BRIDGE_C

View File

@ -5,9 +5,15 @@
// BridgeUnix.h // BridgeUnix.h
// Header of BridgeUnix.c // Header of BridgeUnix.c
#ifdef OS_UNIX
#ifndef BRIDGEUNIX_H #ifndef BRIDGEUNIX_H
#define BRIDGEUNIX_H #define BRIDGEUNIX_H
#include "Bridge.h"
#include "Mayaqua/Network.h"
// Macro // Macro
#ifndef SOL_PACKET #ifndef SOL_PACKET
#define SOL_PACKET 263 #define SOL_PACKET 263
@ -128,6 +134,6 @@ bool DlipBindRequest(int fd);
int UnixEthOpenRawSocket(); int UnixEthOpenRawSocket();
#endif // BRIDGEUNIX_H #endif // BRIDGEUNIX_H
#endif // OS_UNIX

View File

@ -5,24 +5,27 @@
// BridgeWin32.c // BridgeWin32.c
// Ethernet Bridge Program (Win32) // Ethernet Bridge Program (Win32)
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef BRIDGE_C #define BRIDGE_C
#include "BridgeWin32.h"
#include "Admin.h"
#include "Connection.h"
#include "SeLowUser.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Str.h"
#include <winsock2.h>
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Packet32.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
static WP *wp = NULL; static WP *wp = NULL;
static LIST *eth_list = NULL; static LIST *eth_list = NULL;
@ -2091,6 +2094,4 @@ void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name)
Free(ncname); Free(ncname);
} }
#endif // BRIDGE_C #endif

View File

@ -5,9 +5,15 @@
// BridgeWin32.h // BridgeWin32.h
// Header of BridgeWin32.c // Header of BridgeWin32.c
#ifdef OS_WIN32
#ifndef BRIDGEWIN32_H #ifndef BRIDGEWIN32_H
#define BRIDGEWIN32_H #define BRIDGEWIN32_H
#include "Bridge.h"
#include <Packet32.h>
#define BRIDGE_WIN32_PACKET_DLL "Packet.dll" #define BRIDGE_WIN32_PACKET_DLL "Packet.dll"
#define BRIDGE_WIN32_PCD_DLL "|see.dll" #define BRIDGE_WIN32_PCD_DLL "|see.dll"
#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys" #define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys"
@ -18,10 +24,7 @@
#define BRIDGE_WIN32_ETH_BUFFER (1048576) #define BRIDGE_WIN32_ETH_BUFFER (1048576)
#ifdef BRIDGE_C
typedef void *HANDLE;
#ifdef BRIDGE_C
// Header for Internal function (for BridgeWin32.c) // Header for Internal function (for BridgeWin32.c)
typedef struct WP typedef struct WP
@ -157,6 +160,6 @@ bool Win32IsUsingSeLow();
void Win32SetEnableSeLow(bool b); void Win32SetEnableSeLow(bool b);
bool Win32GetEnableSeLow(); bool Win32GetEnableSeLow();
#endif // BRIDGEWIN32_H #endif // BRIDGEWIN32_H
#endif // OS_WIN32

View File

@ -5,46 +5,33 @@
// CM.c // CM.c
// VPN Client Connection Manager for Win32 // VPN Client Connection Manager for Win32
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #define WINUI_C
#define MICROSOFT_C
#define CM_C
#define SM_C
#define MICROSOFT_C
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#define SECURITY_WIN32
#include <winsock2.h>
#include <windows.h>
#include <Iphlpapi.h>
#include <tlhelp32.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <setupapi.h>
#include <regstr.h>
#include <process.h>
#include <psapi.h>
#include <wtsapi32.h>
#include <Ntsecapi.h>
#include <security.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "CMInner.h" #include "CMInner.h"
#include "Nat.h"
#include "Protocol.h"
#include "Remote.h"
#include "SMInner.h" #include "SMInner.h"
#include "NMInner.h" #include "UT.h"
#include "EMInner.h" #include "Win32Com.h"
#include "WinUi.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Secure.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Win32.h"
#include "../PenCore/resource.h" #include "../PenCore/resource.h"
#include <shellapi.h>
// Get the proxy server settings from the registry string of IE // 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) bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type)

View File

@ -5,8 +5,14 @@
// CM.h // CM.h
// Header of CM.c // Header of CM.c
#ifndef CM_H #ifdef OS_WIN32
#define CM_H
#ifndef CM_H
#define CM_H
#include "GlobalConst.h"
#include "Mayaqua/MayaType.h"
// Constants // Constants
#define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager" #define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager"
@ -47,6 +53,6 @@ void CmStopUacHelper(void *p);
void *CmExecUiHelperMain(); void *CmExecUiHelperMain();
UINT CmGetSecureBitmapId(char *dest_hostname); UINT CmGetSecureBitmapId(char *dest_hostname);
#endif // CM_H #endif // CM_H
#endif // OS_WIN32

View File

@ -5,10 +5,21 @@
// CMInner.h // CMInner.h
// Internal header for the CM.c // Internal header for the CM.c
#include "Client.h"
#include "CM.h"
#include "Command.h"
#include "WinUi.h"
#include "Mayaqua/Table.h"
#include <stdlib.h>
#define STARTUP_MUTEX_NAME GC_SW_SOFTETHER_PREFIX "vpncmgr_startup_mutex" #define STARTUP_MUTEX_NAME GC_SW_SOFTETHER_PREFIX "vpncmgr_startup_mutex"
#define NAME_OF_VPN_CLIENT_MANAGER "vpncmgr" #define NAME_OF_VPN_CLIENT_MANAGER "vpncmgr"
typedef struct LVB LVB;
void CmVoice(char *name); void CmVoice(char *name);
typedef struct CM_UAC_HELPER typedef struct CM_UAC_HELPER

View File

@ -5,8 +5,35 @@
// Cedar.c // Cedar.c
// Cedar Communication Module // Cedar Communication Module
#include "Cedar.h"
#include "CedarPch.h" #include "Admin.h"
#include "Bridge.h"
#include "Connection.h"
#include "Layer3.h"
#include "Link.h"
#include "Listener.h"
#include "Protocol.h"
#include "Sam.h"
#include "Server.h"
#include "Session.h"
#include "VLanWin32.h"
#include "WebUI.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/Encrypt.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/HTTP.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Win32.h"
#include <sodium.h>
static UINT init_cedar_counter = 0; static UINT init_cedar_counter = 0;
static REF *cedar_log_ref = NULL; static REF *cedar_log_ref = NULL;

View File

@ -8,6 +8,10 @@
#ifndef CEDAR_H #ifndef CEDAR_H
#define CEDAR_H #define CEDAR_H
#include "CedarType.h"
#include "GlobalConst.h"
#include "Mayaqua/Network.h"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
@ -888,11 +892,11 @@ typedef struct TRAFFIC_ENTRY
} TRAFFIC_ENTRY; } TRAFFIC_ENTRY;
// Traffic data // Traffic data
typedef struct TRAFFIC struct TRAFFIC
{ {
TRAFFIC_ENTRY Send; // Transmitted data TRAFFIC_ENTRY Send; // Transmitted data
TRAFFIC_ENTRY Recv; // Received data TRAFFIC_ENTRY Recv; // Received data
} TRAFFIC; };
// Non-SSL connection source // Non-SSL connection source
typedef struct NON_SSL typedef struct NON_SSL
@ -911,7 +915,7 @@ typedef struct TINY_LOG
} TINY_LOG; } TINY_LOG;
// CEDAR structure // CEDAR structure
typedef struct CEDAR struct CEDAR
{ {
LOCK *lock; // Lock LOCK *lock; // Lock
REF *ref; // Reference counter REF *ref; // Reference counter
@ -979,7 +983,7 @@ typedef struct CEDAR
UINT FifoBudget; // Fifo budget UINT FifoBudget; // Fifo budget
SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings
UINT DhParamBits; // Bits of Diffie-Hellman parameters UINT DhParamBits; // Bits of Diffie-Hellman parameters
} CEDAR; };
// Type of CEDAR // Type of CEDAR
#define CEDAR_CLIENT 0 // Client #define CEDAR_CLIENT 0 // Client
@ -987,132 +991,6 @@ typedef struct CEDAR
#define CEDAR_FARM_CONTROLLER 2 // Server farm controller #define CEDAR_FARM_CONTROLLER 2 // Server farm controller
#define CEDAR_FARM_MEMBER 3 // Server farm member #define CEDAR_FARM_MEMBER 3 // Server farm member
////////////////////////////
// Read the header file
// Type
#include <Cedar/CedarType.h>
// Account Manager
#include <Cedar/Account.h>
// Listener module
#include <Cedar/Listener.h>
// Log storage module
#include <Cedar/Logging.h>
// Connection management
#include <Cedar/Connection.h>
// Session Management
#include <Cedar/Session.h>
// RPC
#include <Cedar/Remote.h>
// HUB management
#include <Cedar/Hub.h>
// Security Accounts Manager
#include <Cedar/Sam.h>
// Radius authentication module
#include <Cedar/Radius.h>
// Native protocol
#include <Cedar/Protocol.h>
// Inter-HUB link
#include <Cedar/Link.h>
// User-mode virtual host
#include <Cedar/Virtual.h>
// SecureNAT
#include <Cedar/SecureNAT.h>
// Digital watermark
#include <Cedar/WaterMark.h>
// Secure data
#include <Cedar/SecureInfo.h>
// Console service
#include <Cedar/Console.h>
// Vpncmd utility
#include <Cedar/Command.h>
// RPC over HTTP
#include <Cedar/Wpc.h>
// Third party protocols
#include <Cedar/Proto.h>
#include <Cedar/Proto_IPsec.h>
#include <Cedar/Proto_EtherIP.h>
#include <Cedar/Proto_IkePacket.h>
#include <Cedar/Proto_IKE.h>
#include <Cedar/Proto_L2TP.h>
#include <Cedar/Proto_OpenVPN.h>
#include <Cedar/Proto_PPP.h>
#include <Cedar/Proto_SSTP.h>
#include <Cedar/Proto_Win7.h>
#include <Cedar/Proto_WireGuard.h>
// Layer-2/Layer-3 converter
#include <Cedar/IPC.h>
// UDP Acceleration
#include <Cedar/UdpAccel.h>
// DDNS Client
#include <Cedar/DDNS.h>
// VPN Azure Client
#include <Cedar/AzureClient.h>
// VPN Azure Server
#include <Cedar/AzureServer.h>
// Native IP Stack
#include <Cedar/NativeStack.h>
#ifdef OS_WIN32
// Neo device driver
#include <Neo/Neo.h>
// SeLow User-mode
#include <Cedar/SeLowUser.h>
#endif // OS_WIN32
// Neo device driver manipulation library
#include <Cedar/VLan.h>
// Bridge
#include <Cedar/Bridge.h>
// Layer-3 switch
#include <Cedar/Layer3.h>
// Virtual LAN card for test
#include <Cedar/NullLan.h>
// Client
#include <Cedar/Client.h>
// Server
#include <Cedar/Server.h>
// License database
#include <Cedar/Database.h>
// EtherLogger
#include <Cedar/EtherLog.h>
// Management RPC
#include <Cedar/Admin.h>
// User-mode Router
#include <Cedar/Nat.h>
// Web UI
#include <Cedar/WebUI.h>
// VPN Gate Main Implementation
#include <Cedar/VG.h>
#ifdef OS_WIN32
// Win32 user interface
#include <Cedar/WinUi.h>
// Win32 Client Connection Manager
#include <Cedar/CM.h>
// Win32 Server Manager
#include <Cedar/SM.h>
// Win32 User-mode Router Manager
#include <Cedar/NM.h>
// Win32 EtherLogger Manager
#include <Cedar/EM.h>
// Win32 Network Utility
#include <Cedar/UT.h>
// Win32 Setup Wizard
#include <Cedar/SW.h>
// Win32 COM calling module
#include <Cedar/Win32Com.h>
#endif
//////////////////////////// ////////////////////////////
// Function prototype // Function prototype

View File

@ -1,9 +0,0 @@
// SoftEther VPN Source Code - Developer Edition Master Branch
// Cedar Communication Module
// CedarPch.c
// Cedar Pre-compile Header Generating Code
#include "CedarPch.h"

View File

@ -1,20 +0,0 @@
// SoftEther VPN Source Code - Developer Edition Master Branch
// Cedar Communication Module
// CedarPch.h
// Header file for grecompile header generation for Cedar
#include <GlobalConst.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>

View File

@ -8,6 +8,9 @@
#ifndef CEDARTYPE_H #ifndef CEDARTYPE_H
#define CEDARTYPE_H #define CEDARTYPE_H
typedef struct CEDAR CEDAR;
typedef struct TRAFFIC TRAFFIC;
// ============================================================== // ==============================================================
// Remote Procedure Call // Remote Procedure Call
@ -471,6 +474,13 @@ typedef struct WIDE_MACHINE_ID WIDE_MACHINE_ID;
typedef struct TRIAL_INFO TRIAL_INFO; typedef struct TRIAL_INFO TRIAL_INFO;
// ==============================================================
// Proto
// ==============================================================
typedef struct PROTO_OPTION PROTO_OPTION;
// ============================================================== // ==============================================================
// IPsec // IPsec
// ============================================================== // ==============================================================

View File

@ -5,7 +5,43 @@
// Client.c // Client.c
// Client Manager // Client Manager
#include "CedarPch.h" #include "Client.h"
#include "Account.h"
#include "Admin.h"
#include "Cedar.h"
#include "CM.h"
#include "Connection.h"
#include "IPC.h"
#include "Listener.h"
#include "Logging.h"
#include "Protocol.h"
#include "Remote.h"
#include "Virtual.h"
#include "VLanUnix.h"
#include "VLanWin32.h"
#include "Win32Com.h"
#include "WinUi.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/Encrypt.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/MayaType.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Network.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/OS.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Secure.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Win32.h"
#include <stdlib.h>
static CLIENT *client = NULL; static CLIENT *client = NULL;
static LISTENER *cn_listener = NULL; static LISTENER *cn_listener = NULL;

View File

@ -8,6 +8,10 @@
#ifndef CLIENT_H #ifndef CLIENT_H
#define CLIENT_H #define CLIENT_H
#include "Account.h"
#include "Session.h"
#include "Wpc.h"
#define CLIENT_CONFIG_PORT GC_CLIENT_CONFIG_PORT // Client port number #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_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 #define CLIENT_WAIT_CN_READY_TIMEOUT (10 * 1000) // Standby time to start the client notification service
@ -742,11 +746,9 @@ void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num);
void OutRpcCmSetting(PACK *p, CM_SETTING *c); void OutRpcCmSetting(PACK *p, CM_SETTING *c);
void InRpcCmSetting(CM_SETTING *c, PACK *p); void InRpcCmSetting(CM_SETTING *c, PACK *p);
#ifdef OS_WIN32
#ifdef OS_WIN32 typedef struct MS_DRIVER_VER MS_DRIVER_VER;
void CiInitDriverVerStruct(MS_DRIVER_VER *ver); void CiInitDriverVerStruct(MS_DRIVER_VER *ver);
#endif // OS_EIN32 #endif // OS_EIN32
#endif // CLIENT_H #endif // CLIENT_H

View File

@ -5,7 +5,45 @@
// Command.c // Command.c
// vpncmd Command Line Management Utility // vpncmd Command Line Management Utility
#include "CedarPch.h" #include "Command.h"
#include "Admin.h"
#include "AzureClient.h"
#include "Connection.h"
#include "Console.h"
#include "Database.h"
#include "DDNS.h"
#include "Layer3.h"
#include "Nat.h"
#include "Proto_IPsec.h"
#include "Proto_WireGuard.h"
#include "Radius.h"
#include "Server.h"
#include "Virtual.h"
#include "WinUi.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Network.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/OS.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Secure.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Unix.h"
#include <stdlib.h>
#ifdef OS_UNIX
#include <signal.h>
#include <sys/wait.h>
#endif
// System checker definition // System checker definition
typedef bool (CHECKER_PROC_DEF)(); typedef bool (CHECKER_PROC_DEF)();

View File

@ -8,6 +8,12 @@
#ifndef COMMAND_H #ifndef COMMAND_H
#define COMMAND_H #define COMMAND_H
#include "CedarType.h"
#include "Mayaqua/Network.h"
#include <stddef.h>
// Constants // Constants
#define TRAFFIC_DEFAULT_PORT 9821 #define TRAFFIC_DEFAULT_PORT 9821
#define TRAFFIC_NUMTCP_MAX 32 #define TRAFFIC_NUMTCP_MAX 32

View File

@ -5,7 +5,31 @@
// Connection.c // Connection.c
// Connection Manager // Connection Manager
#include "CedarPch.h" #include "Connection.h"
#include "BridgeUnix.h"
#include "BridgeWin32.h"
#include "Hub.h"
#include "Layer3.h"
#include "Link.h"
#include "Listener.h"
#include "Nat.h"
#include "Protocol.h"
#include "Server.h"
#include "SecureNAT.h"
#include "Session.h"
#include "UdpAccel.h"
#include "Virtual.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
#include <stdlib.h>
// Determine whether the socket is to use to send // Determine whether the socket is to use to send
#define IS_SEND_TCP_SOCK(ts) \ #define IS_SEND_TCP_SOCK(ts) \

View File

@ -8,6 +8,11 @@
#ifndef CONNECTION_H #ifndef CONNECTION_H
#define CONNECTION_H #define CONNECTION_H
#include "Cedar.h"
#include "Mayaqua/Encrypt.h"
#include "Mayaqua/Proxy.h"
// Magic number indicating that the packet is compressed // Magic number indicating that the packet is compressed
#define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL #define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL

View File

@ -5,8 +5,32 @@
// Console.c // Console.c
// Console Service // Console Service
#include "CedarPch.h" #include "Console.h"
#include "Cedar.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef OS_WIN32
#include <conio.h>
#else
#include <termios.h>
#include <sys/ioctl.h>
#include <readline/readline.h>
#include <readline/history.h>
#endif
// Display the help for the command // Display the help for the command
void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list) void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list)
@ -1911,7 +1935,7 @@ bool PasswordPrompt(char *password, UINT size)
int c; int c;
#ifdef OS_WIN32 #ifdef OS_WIN32
c = getch(); c = _getch();
#else // OS_WIN32 #else // OS_WIN32
c = getc(stdin); c = getc(stdin);
#endif // OS_WIN32 #endif // OS_WIN32
@ -1943,7 +1967,7 @@ bool PasswordPrompt(char *password, UINT size)
{ {
// Read one more character // Read one more character
#ifdef OS_WIN32 #ifdef OS_WIN32
c = getch(); c = _getch();
#else // OS_WIN32 #else // OS_WIN32
c = getc(stdin); c = getc(stdin);
#endif // OS_WIN32 #endif // OS_WIN32

View File

@ -8,6 +8,10 @@
#ifndef CONSOLE_H #ifndef CONSOLE_H
#define CONSOLE_H #define CONSOLE_H
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
// Constant // Constant
#define MAX_PROMPT_STRSIZE 65536 #define MAX_PROMPT_STRSIZE 65536
#define WIN32_DEFAULT_CONSOLE_WIDTH 100 #define WIN32_DEFAULT_CONSOLE_WIDTH 100

View File

@ -5,7 +5,21 @@
// DDNS.c // DDNS.c
// Dynamic DNS Client // Dynamic DNS Client
#include "CedarPch.h" #include "DDNS.h"
#include "AzureClient.h"
#include "Server.h"
#include "Virtual.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
// Get the current status of the DDNS client // Get the current status of the DDNS client
void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st) void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st)

View File

@ -8,6 +8,11 @@
#ifndef DDNS_H #ifndef DDNS_H
#define DDNS_H #define DDNS_H
#include "CedarType.h"
#include "Wpc.h"
#include <stddef.h>
// Certificate hash // Certificate hash
#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \ #define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \
"439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \ "439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \

View File

@ -5,7 +5,13 @@
// Database.c // Database.c
// License database // License database
#include "CedarPch.h" #include "Database.h"
#include "Cedar.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Str.h"
// Get the License status string // Get the License status string
wchar_t *LiGetLicenseStatusStr(UINT i) wchar_t *LiGetLicenseStatusStr(UINT i)

View File

@ -8,6 +8,8 @@
#ifndef DATABASE_H #ifndef DATABASE_H
#define DATABASE_H #define DATABASE_H
#include "Mayaqua/MayaType.h"
wchar_t *LiGetLicenseStatusStr(UINT i); wchar_t *LiGetLicenseStatusStr(UINT i);
bool LiIsLicenseKey(char *str); bool LiIsLicenseKey(char *str);
bool LiStrToKeyBit(UCHAR *keybit, char *keystr); bool LiStrToKeyBit(UCHAR *keybit, char *keystr);

View File

@ -5,39 +5,31 @@
// EM.c // EM.c
// EtherLogger Manager for Win32 // EtherLogger Manager for Win32
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #define WINUI_C
#define SM_C #include "EM.h"
#define CM_C
#define NM_C
#define EM_C
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#include <winsock2.h>
#include <windows.h>
#include <wincrypt.h>
#include <wininet.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "CMInner.h"
#include "SMInner.h"
#include "NMInner.h"
#include "EMInner.h" #include "EMInner.h"
#include "CMInner.h"
#include "Database.h"
#include "EtherLog.h"
#include "Remote.h"
#include "SMInner.h"
#include "WinUi.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "../PenCore/resource.h" #include "../PenCore/resource.h"
#include <shellapi.h>
#include <ShlObj.h>
// License registration process // License registration process
void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s) void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s)

View File

@ -5,6 +5,10 @@
// EMInner.h // EMInner.h
// Inner header of EM.c // Inner header of EM.c
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
// Constants // Constants
#define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager" #define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager"

View File

@ -5,7 +5,24 @@
// EtherLog.c // EtherLog.c
// EtherLogger program // EtherLogger program
#include "CedarPch.h" #include "EtherLog.h"
#include "Admin.h"
#include "BridgeUnix.h"
#include "BridgeWin32.h"
#include "Listener.h"
#include "Remote.h"
#include "Sam.h"
#include "Server.h"
#include "WinUi.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/Encrypt.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/OS.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
static LOCK *el_lock = NULL; static LOCK *el_lock = NULL;
static EL *el = NULL; static EL *el = NULL;

View File

@ -8,6 +8,8 @@
#ifndef ETHERLOG_H #ifndef ETHERLOG_H
#define ETHERLOG_H #define ETHERLOG_H
#include "Hub.h"
// Whether this is a beta version // Whether this is a beta version
#define ELOG_IS_BETA true #define ELOG_IS_BETA true

View File

@ -5,7 +5,28 @@
// Hub.c // Hub.c
// Virtual HUB module // Virtual HUB module
#include "CedarPch.h" #include "Hub.h"
#include "Admin.h"
#include "Bridge.h"
#include "Connection.h"
#include "Link.h"
#include "Nat.h"
#include "NativeStack.h"
#include "Protocol.h"
#include "Radius.h"
#include "SecureNAT.h"
#include "Server.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/TcpIp.h"
#include "Mayaqua/Tick64.h"
#define GetHubAdminOptionDataAndSet(ao, name, dest) \ #define GetHubAdminOptionDataAndSet(ao, name, dest) \
value = GetHubAdminOptionData(ao, name); \ value = GetHubAdminOptionData(ao, name); \
@ -4000,7 +4021,7 @@ DISCARD_PACKET:
if (forward_now) if (forward_now)
{ {
if (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0) if (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0)
{ {
if (s != NULL) if (s != NULL)
{ {
@ -4008,7 +4029,7 @@ DISCARD_PACKET:
goto DISCARD_PACKET; goto DISCARD_PACKET;
} }
} }
if (s != NULL && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0)) if (s != NULL && (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0))
{ {
// Check whether the source MAC address is registered in the table // Check whether the source MAC address is registered in the table
Copy(t.MacAddress, packet->MacAddressSrc, 6); Copy(t.MacAddress, packet->MacAddressSrc, 6);
@ -4167,7 +4188,7 @@ DISCARD_PACKET:
} }
// It's already registered and it's in another session // It's already registered and it's in another session
if (check_mac && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) && if (check_mac && (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) &&
((entry->UpdatedTime + MAC_TABLE_EXCLUSIVE_TIME) >= now)) ((entry->UpdatedTime + MAC_TABLE_EXCLUSIVE_TIME) >= now))
{ {
UCHAR *mac = packet->MacAddressSrc; UCHAR *mac = packet->MacAddressSrc;
@ -4184,7 +4205,7 @@ DISCARD_PACKET:
if ((s->LastDLinkSTPPacketSendTick != 0) && if ((s->LastDLinkSTPPacketSendTick != 0) &&
(tick_diff < 750ULL) && (tick_diff < 750ULL) &&
(memcmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0)) (Cmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0))
{ {
// Discard if the same packet sent before 750ms ago // Discard if the same packet sent before 750ms ago
Debug("D-Link Discard %u\n", (UINT)tick_diff); Debug("D-Link Discard %u\n", (UINT)tick_diff);
@ -4824,8 +4845,8 @@ UPDATE_FDB:
if (s != NULL) if (s != NULL)
{ {
if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
{ {
goto DISCARD_UNICAST_PACKET; goto DISCARD_UNICAST_PACKET;
} }
@ -5041,8 +5062,8 @@ DISCARD_UNICAST_PACKET:
if (s != NULL) if (s != NULL)
{ {
if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
{ {
discard = true; discard = true;
} }
@ -6664,7 +6685,7 @@ int CompareMacTable(void *p1, void *p2)
{ {
return 0; return 0;
} }
r = memcmp(e1->MacAddress, e2->MacAddress, 6); r = Cmp(e1->MacAddress, e2->MacAddress, 6);
if (r != 0) if (r != 0)
{ {
return r; return r;

View File

@ -8,6 +8,8 @@
#ifndef HUB_H #ifndef HUB_H
#define HUB_H #define HUB_H
#include "Account.h"
#include "Logging.h"
// Prefix in the access list for investigating whether the user name which is contained in a particular file // 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_INCLUDED_PREFIX "include:" // Included

View File

@ -5,7 +5,22 @@
// IPC.c // IPC.c
// In-process VPN client module // In-process VPN client module
#include "CedarPch.h" #include "IPC.h"
#include "Admin.h"
#include "Cedar.h"
#include "Client.h"
#include "Connection.h"
#include "Hub.h"
#include "Protocol.h"
#include "Radius.h"
#include "Virtual.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
// Extract the MS-CHAP v2 authentication information by parsing the password string // Extract the MS-CHAP v2 authentication information by parsing the password string
bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password)

View File

@ -8,6 +8,11 @@
#ifndef IPC_H #ifndef IPC_H
#define IPC_H #define IPC_H
#include "Cedar.h"
#include "Proto_WireGuard.h"
#include "Mayaqua/TcpIp.h"
// Constants // Constants
#define IPC_ARP_LIFETIME (3 * 60 * 1000) #define IPC_ARP_LIFETIME (3 * 60 * 1000)
#define IPC_ARP_GIVEUPTIME (1 * 1000) #define IPC_ARP_GIVEUPTIME (1 * 1000)

View File

@ -5,7 +5,21 @@
// Layer3.c // Layer3.c
// Layer-3 switch module // Layer-3 switch module
#include "CedarPch.h" #include "Layer3.h"
#include "Connection.h"
#include "Hub.h"
#include "Server.h"
#include "Session.h"
#include "Virtual.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/TcpIp.h"
#include "Mayaqua/Tick64.h"
static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

View File

@ -8,6 +8,8 @@
#ifndef LAYER3_H #ifndef LAYER3_H
#define LAYER3_H #define LAYER3_H
#include "Cedar.h"
// Constants // Constants
#define L3_USERNAME "L3SW_" #define L3_USERNAME "L3SW_"

View File

@ -5,7 +5,21 @@
// Link.c // Link.c
// Inter-HUB Link // Inter-HUB Link
#include "CedarPch.h" #include "Link.h"
#include "Account.h"
#include "Client.h"
#include "Connection.h"
#include "Hub.h"
#include "Logging.h"
#include "Server.h"
#include "Session.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
// Link server thread // Link server thread
void LinkServerSessionThread(THREAD *t, void *param) void LinkServerSessionThread(THREAD *t, void *param)

View File

@ -8,6 +8,10 @@
#ifndef LINK_H #ifndef LINK_H
#define LINK_H #define LINK_H
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
struct LINK struct LINK
{ {
bool Started; // Running flag bool Started; // Running flag

View File

@ -5,7 +5,18 @@
// Listener.c // Listener.c
// Listener module // Listener module
#include "CedarPch.h" #include "Listener.h"
#include "Cedar.h"
#include "Connection.h"
#include "Logging.h"
#include "Server.h"
#include "Session.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
static bool disable_dos = false; static bool disable_dos = false;
static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP; static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP;

View File

@ -8,6 +8,9 @@
#ifndef LISTENER_H #ifndef LISTENER_H
#define LISTENER_H #define LISTENER_H
#include "CedarType.h"
#include "Mayaqua/Kernel.h"
// Function to call when receiving a new connection // Function to call when receiving a new connection
typedef void (NEW_CONNECTION_PROC)(CONNECTION *c); typedef void (NEW_CONNECTION_PROC)(CONNECTION *c);

View File

@ -5,7 +5,28 @@
// Logging.c // Logging.c
// Log storaging module // Log storaging module
#include "CedarPch.h" #include "Logging.h"
#include "Admin.h"
#include "Client.h"
#include "Nat.h"
#include "Proto_EtherIP.h"
#include "Proto_IKE.h"
#include "Proto_PPP.h"
#include "Remote.h"
#include "SecureNAT.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Unix.h"
#include "Mayaqua/Win32.h"
static char *delete_targets[] = static char *delete_targets[] =
{ {
@ -832,8 +853,8 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe
return true; return true;
} }
if (memcmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 || if (Cmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 ||
memcmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0) Cmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0)
{ {
return true; return true;
} }
@ -2272,7 +2293,7 @@ bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UIN
} }
} }
if (strcmp(old_datestr, tmp) != 0) if (StrCmp(old_datestr, tmp) != 0)
{ {
ret = true; ret = true;
StrCpy(old_datestr, MAX_SIZE, tmp); StrCpy(old_datestr, MAX_SIZE, tmp);

View File

@ -8,6 +8,9 @@
#ifndef LOGGING_H #ifndef LOGGING_H
#define LOGGING_H #define LOGGING_H
#include "Cedar.h"
#include "Mayaqua/Network.h"
// Port number for HTTP monitoring // Port number for HTTP monitoring
#define LOG_HTTP_PORT 80 #define LOG_HTTP_PORT 80

View File

@ -5,36 +5,20 @@
// NM.c // NM.c
// VPN User-mode Router Manager for Win32 // VPN User-mode Router Manager for Win32
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #include "NM.h"
#define SM_C
#define CM_C
#define NM_C
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#include <winsock2.h>
#include <windows.h>
#include <wincrypt.h>
#include <wininet.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "CMInner.h"
#include "SMInner.h"
#include "NMInner.h" #include "NMInner.h"
#include "EMInner.h"
#include "CMInner.h"
#include "Nat.h"
#include "Remote.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Str.h"
#include "../PenCore/resource.h" #include "../PenCore/resource.h"
// Global variable // Global variable

View File

@ -5,6 +5,9 @@
// NMInner.h // NMInner.h
// The internal header of NM.c // The internal header of NM.c
#include "SMInner.h"
#include "Mayaqua/Encrypt.h"
// Constants // Constants
#define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager" #define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager"

View File

@ -5,7 +5,18 @@
// Nat.c // Nat.c
// User-mode Router // User-mode Router
#include "CedarPch.h" #include "Nat.h"
#include "Admin.h"
#include "Remote.h"
#include "Sam.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
static LOCK *nat_lock = NULL; static LOCK *nat_lock = NULL;
static NAT *nat = NULL; static NAT *nat = NULL;

View File

@ -8,6 +8,11 @@
#ifndef NAT_H #ifndef NAT_H
#define NAT_H #define NAT_H
#include "Cedar.h"
#include "Virtual.h"
#include "Mayaqua/Kernel.h"
// Constants // Constants
#define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file #define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file
#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management #define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management

View File

@ -5,7 +5,21 @@
// NativeStack.c // NativeStack.c
// Native IP stack // Native IP stack
#include "CedarPch.h" #include "NativeStack.h"
#include "BridgeUnix.h"
#include "BridgeWin32.h"
#include "IPC.h"
#include "Virtual.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#ifdef OS_UNIX
#include "Mayaqua/Unix.h"
#endif
// Stack main thread // Stack main thread
void NsMainThread(THREAD *thread, void *param) void NsMainThread(THREAD *thread, void *param)

View File

@ -8,6 +8,10 @@
#ifndef NATIVESTACK_H #ifndef NATIVESTACK_H
#define NATIVESTACK_H #define NATIVESTACK_H
#include "CedarType.h"
#include "Mayaqua/TcpIp.h"
//// Constants //// Constants
#define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address #define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address

View File

@ -5,7 +5,17 @@
// NullLan.c // NullLan.c
// Virtual LAN card device driver for testing // Virtual LAN card device driver for testing
#include "CedarPch.h" #include "NullLan.h"
#include "Connection.h"
#include "Session.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
static UCHAR null_lan_broadcast_address[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static UCHAR null_lan_broadcast_address[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

View File

@ -8,6 +8,9 @@
#ifndef NULLLAN_H #ifndef NULLLAN_H
#define NULLLAN_H #define NULLLAN_H
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
#define NULL_PACKET_GENERATE_INTERVAL 100000000 // Packet generation interval #define NULL_PACKET_GENERATE_INTERVAL 100000000 // Packet generation interval

View File

@ -1,6 +1,18 @@
#include "CedarPch.h" #include "Proto.h"
#include "Cedar.h"
#include "Logging.h"
#include "Proto_OpenVPN.h" #include "Proto_OpenVPN.h"
#include "Proto_SSTP.h"
#include "Proto_WireGuard.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
void ProtoLog(const PROTO *proto, const PROTO_SESSION *session, const char *name, ...) void ProtoLog(const PROTO *proto, const PROTO_SESSION *session, const char *name, ...)
{ {

View File

@ -1,6 +1,11 @@
#ifndef PROTO_H #ifndef PROTO_H
#define PROTO_H #define PROTO_H
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
#include "Mayaqua/Network.h"
#define PROTO_OPTION_TOGGLE_NAME "Enabled" #define PROTO_OPTION_TOGGLE_NAME "Enabled"
// OpenVPN sends 2 bytes, thus this is the buffer size. // OpenVPN sends 2 bytes, thus this is the buffer size.
@ -31,7 +36,7 @@ typedef struct PROTO
UDPLISTENER *UdpListener; UDPLISTENER *UdpListener;
} PROTO; } PROTO;
typedef struct PROTO_OPTION struct PROTO_OPTION
{ {
char *Name; char *Name;
PROTO_OPTION_VALUE Type; PROTO_OPTION_VALUE Type;
@ -40,7 +45,7 @@ typedef struct PROTO_OPTION
bool Bool; bool Bool;
char *String; char *String;
}; };
} PROTO_OPTION; };
typedef struct PROTO_IMPL typedef struct PROTO_IMPL
{ {

View File

@ -5,7 +5,18 @@
// Proto_EtherIP.c // Proto_EtherIP.c
// EtherIP protocol stack // EtherIP protocol stack
#include "CedarPch.h" #include "Proto_EtherIP.h"
#include "Connection.h"
#include "IPC.h"
#include "Logging.h"
#include "Proto_IKE.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
// IPC connection processing thread // IPC connection processing thread
void EtherIPIpcConnectThread(THREAD *t, void *p) void EtherIPIpcConnectThread(THREAD *t, void *p)

View File

@ -8,8 +8,7 @@
#ifndef PROTO_ETHERIP_H #ifndef PROTO_ETHERIP_H
#define PROTO_ETHERIP_H #define PROTO_ETHERIP_H
//// Macro #include "Proto_IPsec.h"
//// Constants //// Constants
#define ETHERIP_VPN_CONNECT_RETRY_INTERVAL (15 * 1000) // VPN connection retry interval #define ETHERIP_VPN_CONNECT_RETRY_INTERVAL (15 * 1000) // VPN connection retry interval

View File

@ -5,7 +5,22 @@
// Proto_IKE.c // Proto_IKE.c
// IKE (ISAKMP) and ESP protocol stack // IKE (ISAKMP) and ESP protocol stack
#include "CedarPch.h" #include "Proto_IKE.h"
#include "Cedar.h"
#include "Connection.h"
#include "Logging.h"
#include "Proto_EtherIP.h"
#include "Proto_IPsec.h"
#include "Proto_L2TP.h"
#include "Server.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/TcpIp.h"
#include "Mayaqua/Tick64.h"
//#define RAW_DEBUG //#define RAW_DEBUG

View File

@ -8,7 +8,7 @@
#ifndef PROTO_IKE_H #ifndef PROTO_IKE_H
#define PROTO_IKE_H #define PROTO_IKE_H
//// Macro #include "Proto_IkePacket.h"
//// Constants //// Constants

View File

@ -5,8 +5,21 @@
// Proto_IPsec.c // Proto_IPsec.c
// IPsec module // IPsec module
#include "CedarPch.h" #include "Proto_IPsec.h"
#include "Hub.h"
#include "Proto_IKE.h"
#include "Proto_L2TP.h"
#include "Proto_Win7.h"
#include "Server.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Unix.h"
static bool ipsec_disable = false; static bool ipsec_disable = false;

View File

@ -8,6 +8,8 @@
#ifndef PROTO_IPSEC_H #ifndef PROTO_IPSEC_H
#define PROTO_IPSEC_H #define PROTO_IPSEC_H
#include "Cedar.h"
//// Constants //// Constants
// UDP port number // UDP port number

View File

@ -5,7 +5,11 @@
// Proto_IkePacket.c // Proto_IkePacket.c
// IKE (ISAKMP) packet processing // IKE (ISAKMP) packet processing
#include "CedarPch.h" #include "Proto_IkePacket.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/TcpIp.h"
// Convert the string to a password // Convert the string to a password
BUF *IkeStrToPassword(char *str) BUF *IkeStrToPassword(char *str)

View File

@ -8,6 +8,11 @@
#ifndef PROTO_IKEPACKET_H #ifndef PROTO_IKEPACKET_H
#define PROTO_IKEPACKET_H #define PROTO_IKEPACKET_H
#include "CedarType.h"
#include "Mayaqua/Mayaqua.h"
#include "Mayaqua/Network.h"
// Constants // Constants
#ifdef OS_WIN32 #ifdef OS_WIN32
#pragma pack(push, 1) #pragma pack(push, 1)

View File

@ -5,7 +5,20 @@
// Proto_L2TP.c // Proto_L2TP.c
// L2TP protocol stack // L2TP protocol stack
#include "CedarPch.h" #include "Proto_L2TP.h"
#include "Connection.h"
#include "Logging.h"
#include "Proto_EtherIP.h"
#include "Proto_IKE.h"
#include "Proto_IPsec.h"
#include "Proto_PPP.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Network.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/TcpIp.h"
// Release the L2TP AVP value // Release the L2TP AVP value
void FreeL2TPAVP(L2TP_AVP *a) void FreeL2TPAVP(L2TP_AVP *a)

View File

@ -8,7 +8,9 @@
#ifndef PROTO_L2TP_H #ifndef PROTO_L2TP_H
#define PROTO_L2TP_H #define PROTO_L2TP_H
//// Macro #include "CedarType.h"
#include "Mayaqua/Network.h"
// Check the sequence number // Check the sequence number
#define L2TP_SEQ_LT(a, b) (((USHORT)(((USHORT)(a)) - ((USHORT)(b)))) & 0x8000) #define L2TP_SEQ_LT(a, b) (((USHORT)(((USHORT)(a)) - ((USHORT)(b)))) & 0x8000)

View File

@ -5,7 +5,22 @@
// Proto_OpenVPN.c // Proto_OpenVPN.c
// OpenVPN protocol stack // OpenVPN protocol stack
#include "CedarPch.h" #include "Proto_OpenVPN.h"
#include "Cedar.h"
#include "Connection.h"
#include "IPC.h"
#include "Logging.h"
#include "Proto_EtherIP.h"
#include "Proto_PPP.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
// Ping signature of the OpenVPN protocol // Ping signature of the OpenVPN protocol
static UCHAR ping_signature[] = static UCHAR ping_signature[] =

View File

@ -8,6 +8,7 @@
#ifndef PROTO_OPENVPN_H #ifndef PROTO_OPENVPN_H
#define PROTO_OPENVPN_H #define PROTO_OPENVPN_H
#include "Proto.h"
//// Constants //// Constants
#define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number #define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number

View File

@ -5,7 +5,22 @@
// Proto_PPP.c // Proto_PPP.c
// PPP protocol stack // PPP protocol stack
#include "CedarPch.h" #include "Proto_PPP.h"
#include "Account.h"
#include "Cedar.h"
#include "Connection.h"
#include "Hub.h"
#include "IPC.h"
#include "Logging.h"
#include "Proto_IPsec.h"
#include "Radius.h"
#include "Server.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
// PPP main thread // PPP main thread
void PPPThread(THREAD *thread, void *param) void PPPThread(THREAD *thread, void *param)

View File

@ -8,6 +8,9 @@
#ifndef PROTO_PPP_H #ifndef PROTO_PPP_H
#define PROTO_PPP_H #define PROTO_PPP_H
#include "CedarType.h"
#include "Mayaqua/TcpIp.h"
//// Macro //// 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_NEGATIVE(c) ((c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT)

View File

@ -5,7 +5,17 @@
// Proto_SSTP.c // Proto_SSTP.c
// SSTP (Microsoft Secure Socket Tunneling Protocol) protocol stack // SSTP (Microsoft Secure Socket Tunneling Protocol) protocol stack
#include "CedarPch.h" #include "Proto_SSTP.h"
#include "Connection.h"
#include "Proto_PPP.h"
#include "Server.h"
#include "Mayaqua/HTTP.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
const PROTO_IMPL *SstpGetProtoImpl() const PROTO_IMPL *SstpGetProtoImpl()
{ {

View File

@ -8,6 +8,8 @@
#ifndef PROTO_SSTP_H #ifndef PROTO_SSTP_H
#define PROTO_SSTP_H #define PROTO_SSTP_H
#include "Proto.h"
//// Constants //// Constants
#define SSTP_URI "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/" // SSTP HTTPS URI #define SSTP_URI "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/" // SSTP HTTPS URI
#define SSTP_VERSION_1 0x10 // SSTP Version 1.0 #define SSTP_VERSION_1 0x10 // SSTP Version 1.0

View File

@ -5,39 +5,26 @@
// Proto_Win7.c // 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 // Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012 / Windows 10
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #include "Proto_Win7.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Str.h"
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#define INITGUID
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <windows.h>
#include <wincrypt.h>
#include <wininet.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <Fwpmu.h>
#include <Fwpmtypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "Proto_Win7Inner.h"
#include <Wfp/Wfp.h> #include <Wfp/Wfp.h>
#include <stdlib.h>
#include <fwpmu.h>
static IPSEC_WIN7_FUNCTIONS *api = NULL; static IPSEC_WIN7_FUNCTIONS *api = NULL;
static HINSTANCE hDll = NULL; static HINSTANCE hDll = NULL;
// Initialize the IPsec helper module for Windows 7 // Initialize the IPsec helper module for Windows 7
IPSEC_WIN7 *IPsecWin7Init() IPSEC_WIN7 *IPsecWin7Init()
{ {

View File

@ -8,6 +8,9 @@
#ifndef PROTO_WIN7_H #ifndef PROTO_WIN7_H
#define PROTO_WIN7_H #define PROTO_WIN7_H
#include "Proto_IPsec.h"
#include "Proto_Win7Inner.h"
// Constants // Constants
#define IPSEC_WIN7_SRC_SYS_X86 "|pxwfp_x86.sys" #define IPSEC_WIN7_SRC_SYS_X86 "|pxwfp_x86.sys"
#define IPSEC_WIN7_SRC_SYS_X64 "|pxwfp_x64.sys" #define IPSEC_WIN7_SRC_SYS_X64 "|pxwfp_x64.sys"

View File

@ -5,8 +5,15 @@
// Proto_Win7Inner.h // Proto_Win7Inner.h
// Internal header of Proto_Win7.c // Internal header of Proto_Win7.c
#ifndef PROTO_WIN7_INNER_H #ifdef OS_WIN32
#define PROTO_WIN7_INNER_H
#ifndef PROTO_WIN7_INNER_H
#define PROTO_WIN7_INNER_H
#include "Mayaqua/MayaType.h"
#include <rpc.h>
#include <fwpmtypes.h>
// API function // API function
typedef struct IPSEC_WIN7_FUNCTIONS typedef struct IPSEC_WIN7_FUNCTIONS
@ -74,4 +81,6 @@ struct IPSEC_WIN7
}; };
#endif // PROTO_WIN7_INNER_H #endif // PROTO_WIN7_INNER_H
#endif // OS_WIN32

View File

@ -1,4 +1,14 @@
#include "CedarPch.h" #include "Proto_WireGuard.h"
#include "Connection.h"
#include "IPC.h"
#include "Logging.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
#include <blake2.h> #include <blake2.h>

View File

@ -1,6 +1,8 @@
#ifndef PROTO_WIREGUARD_H #ifndef PROTO_WIREGUARD_H
#define PROTO_WIREGUARD_H #define PROTO_WIREGUARD_H
#include "Proto.h"
#include <sodium.h> #include <sodium.h>
#define WG_IPC_POSTFIX "WIREGUARD" #define WG_IPC_POSTFIX "WIREGUARD"

View File

@ -5,9 +5,42 @@
// Protocol.c // Protocol.c
// SoftEther protocol related routines // SoftEther protocol related routines
#include "CedarPch.h" #include "Protocol.h"
static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00}; #include "Admin.h"
#include "Client.h"
#include "CM.h"
#include "DDNS.h"
#include "Hub.h"
#include "IPC.h"
#include "Link.h"
#include "Logging.h"
#include "Proto_IPsec.h"
#include "Proto_OpenVPN.h"
#include "Proto_PPP.h"
#include "Proto_SSTP.h"
#include "Radius.h"
#include "Sam.h"
#include "Server.h"
#include "UdpAccel.h"
#include "VLanUnix.h"
#include "WaterMark.h"
#include "WebUI.h"
#include "WinUi.h"
#include "Wpc.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/OS.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Secure.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h"
// Download and save intermediate certificates if necessary // Download and save intermediate certificates if necessary
bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x) bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x)
@ -3156,7 +3189,7 @@ bool ServerAccept(CONNECTION *c)
if (IsURLMsg(msg, NULL, 0) == false) if (IsURLMsg(msg, NULL, 0) == false)
{ {
if (s != NULL && s->IsRUDPSession && c != NULL && StrCmpi(hub->Name, VG_HUBNAME) != 0) if (s != NULL && s->IsRUDPSession && c != NULL)
{ {
// Show the warning message if the connection is made by NAT-T // Show the warning message if the connection is made by NAT-T
wchar_t *tmp2; wchar_t *tmp2;

View File

@ -8,6 +8,8 @@
#ifndef PROTOCOL_H #ifndef PROTOCOL_H
#define PROTOCOL_H #define PROTOCOL_H
#include "Connection.h"
// The parameters that will be passed to the certificate confirmation thread // The parameters that will be passed to the certificate confirmation thread
struct CHECK_CERT_THREAD_PROC struct CHECK_CERT_THREAD_PROC
{ {

View File

@ -5,10 +5,17 @@
// Radius.c // Radius.c
// Radius authentication module // Radius authentication module
#include "CedarPch.h" #include "Radius.h"
////////// Modern implementation #include "Connection.h"
#include "IPC.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
// send PEAP-MSCHAPv2 auth client response // send PEAP-MSCHAPv2 auth client response
bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge)

View File

@ -8,6 +8,10 @@
#ifndef RADIUS_H #ifndef RADIUS_H
#define RADIUS_H #define RADIUS_H
#include "Cedar.h"
#include "Mayaqua/Mayaqua.h"
#define RADIUS_DEFAULT_PORT 1812 // The default port number #define RADIUS_DEFAULT_PORT 1812 // The default port number
#define RADIUS_RETRY_INTERVAL 1000 // Retransmission interval #define RADIUS_RETRY_INTERVAL 1000 // Retransmission interval
#define RADIUS_RETRY_TIMEOUT (15 * 1000) // Time-out period, keep it 2FA friendly #define RADIUS_RETRY_TIMEOUT (15 * 1000) // Time-out period, keep it 2FA friendly

View File

@ -5,7 +5,14 @@
// Remote.c // Remote.c
// Remote Procedure Call // Remote Procedure Call
#include "CedarPch.h" #include "Remote.h"
#include "Admin.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h"
// End of RPC // End of RPC
void EndRpc(RPC *rpc) void EndRpc(RPC *rpc)

View File

@ -8,6 +8,8 @@
#ifndef REMOTE_H #ifndef REMOTE_H
#define REMOTE_H #define REMOTE_H
#include "Connection.h"
// RPC execution function // RPC execution function
typedef PACK *(RPC_DISPATCHER)(RPC *r, char *function_name, PACK *p); typedef PACK *(RPC_DISPATCHER)(RPC *r, char *function_name, PACK *p);

View File

@ -5,38 +5,35 @@
// SM.c // SM.c
// VPN Server Manager for Win32 // VPN Server Manager for Win32
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #include "SM.h"
#define SM_C
#define CM_C
#define NM_C
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#include <winsock2.h>
#include <windows.h>
#include <wincrypt.h>
#include <wininet.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "CMInner.h"
#include "SMInner.h" #include "SMInner.h"
#include "AzureClient.h"
#include "CMInner.h"
#include "Console.h"
#include "Database.h"
#include "Layer3.h"
#include "NMInner.h" #include "NMInner.h"
#include "EMInner.h" #include "Proto_PPP.h"
#include "Radius.h"
#include "Remote.h"
#include "Server.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Secure.h"
#include "Mayaqua/Str.h"
#include "../PenCore/resource.h" #include "../PenCore/resource.h"
#include <shellapi.h>
#include <shlobj.h>
// Global variable // Global variable
static SM *sm = NULL; static SM *sm = NULL;
static bool link_create_now = false; static bool link_create_now = false;

View File

@ -5,6 +5,17 @@
// SMInner.h // SMInner.h
// The internal header of SM.c // The internal header of SM.c
#ifndef SMINNER_H
#define SMINNER_H
#include "Admin.h"
#include "Connection.h"
#include "DDNS.h"
#include "Proto_EtherIP.h"
#include "WinUi.h"
#include "Mayaqua/TcpIp.h"
// Constants // Constants
#define SM_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager" #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_CERT_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Cert Tool"
@ -720,4 +731,4 @@ UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t); void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t);
void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t); void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t);
#endif

View File

@ -5,40 +5,29 @@
// SW.c // SW.c
// Setup Wizard for Win32 // Setup Wizard for Win32
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #include "SW.h"
#define SM_C
#define CM_C
#define NM_C
#define SW_C
#define _WIN32_WINNT 0x0600
#define WINVER 0x0600
#include <winsock2.h>
#include <windows.h>
#include <wincrypt.h>
#include <wininet.h>
#include <shlobj.h>
#include <commctrl.h>
#include <Dbghelp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <Mayaqua/Mayaqua.h>
#include <Cedar/Cedar.h>
#include "CMInner.h"
#include "SMInner.h"
#include "NMInner.h"
#include "EMInner.h"
#include "SWInner.h" #include "SWInner.h"
#include "CMInner.h"
#include "Console.h"
#include "SeLowUser.h"
#include "Win32Com.h"
#include "Mayaqua/Cfg.h"
#include "Mayaqua/FileIO.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
#include "Mayaqua/Win32.h"
#include "../PenCore/resource.h" #include "../PenCore/resource.h"
#include <ShlObj.h>
//// Old MSI product information //// Old MSI product information
// VPN Server // VPN Server
static SW_OLD_MSI old_msi_vpnserver[] = static SW_OLD_MSI old_msi_vpnserver[] =

View File

@ -8,6 +8,8 @@
#ifndef SW_H #ifndef SW_H
#define SW_H #define SW_H
#include "Mayaqua/MayaType.h"
#define SW_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings" #define SW_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings"

View File

@ -8,6 +8,8 @@
#ifndef SW_INNER_H #ifndef SW_INNER_H
#define SW_INNER_H #define SW_INNER_H
#include "WinUi.h"
// Component string // Component string
#define SW_NAME_VPNSERVER "vpnserver" #define SW_NAME_VPNSERVER "vpnserver"
#define SW_LONG_VPNSERVER _UU("SW_LONG_VPNSERVER") #define SW_LONG_VPNSERVER _UU("SW_LONG_VPNSERVER")

View File

@ -5,8 +5,31 @@
// Sam.c // Sam.c
// Security Accounts Manager // Security Accounts Manager
#include "CedarPch.h" #include "Sam.h"
#include "Account.h"
#include "Cedar.h"
#include "Hub.h"
#include "IPC.h"
#include "Proto_PPP.h"
#include "Radius.h"
#include "Server.h"
#include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
#include <string.h>
#ifdef OS_UNIX
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#endif
int base64_enc_len(unsigned int plainLen) { int base64_enc_len(unsigned int plainLen) {
unsigned int n = plainLen; unsigned int n = plainLen;

View File

@ -8,6 +8,9 @@
#ifndef SAM_H #ifndef SAM_H
#define SAM_H #define SAM_H
#include "CedarType.h"
#include "Mayaqua/MayaType.h"
// Function prototype // Function prototype
bool SamIsUser(HUB *h, char *username); bool SamIsUser(HUB *h, char *username);

View File

@ -5,20 +5,22 @@
// SeLowUser.c // SeLowUser.c
// SoftEther Lightweight Network Protocol User-mode Library // SoftEther Lightweight Network Protocol User-mode Library
#include <GlobalConst.h> #ifdef OS_WIN32
#ifdef WIN32 #include "SeLowUser.h"
#include <windows.h> #include "BridgeWin32.h"
#include <stdio.h> #include "Win32Com.h"
#include <stdlib.h>
#include <string.h> #include "Mayaqua/Cfg.h"
#include <wchar.h> #include "Mayaqua/FileIO.h"
#include <stdarg.h> #include "Mayaqua/Internat.h"
#include <time.h> #include "Mayaqua/Microsoft.h"
#include <errno.h> #include "Mayaqua/Memory.h"
#include <Mayaqua/Mayaqua.h> #include "Mayaqua/Str.h"
#include <Cedar/Cedar.h> #include "Mayaqua/Tick64.h"
#include "See/Devioctl.h"
// Load the drivers hive // Load the drivers hive
bool SuLoadDriversHive() bool SuLoadDriversHive()

View File

@ -8,6 +8,10 @@
#ifndef SELOWUSER_H #ifndef SELOWUSER_H
#define SELOWUSER_H #define SELOWUSER_H
#include "CedarType.h"
#include "Mayaqua/Mayaqua.h"
#include <SeLow/SeLowCommon.h> #include <SeLow/SeLowCommon.h>
//// Macro //// Macro

View File

@ -1,10 +0,0 @@
// 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"

View File

@ -1,14 +0,0 @@
// 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

View File

@ -5,7 +5,18 @@
// SecureNAT.c // SecureNAT.c
// SecureNAT code // SecureNAT code
#include "CedarPch.h" #include "SecureNAT.h"
#include "Connection.h"
#include "Hub.h"
#include "Logging.h"
#include "Nat.h"
#include "Session.h"
#include "Mayaqua/Kernel.h"
#include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h"
#include "Mayaqua/Str.h"
// SecureNAT server-side thread // SecureNAT server-side thread
void SnSecureNATThread(THREAD *t, void *param) void SnSecureNATThread(THREAD *t, void *param)

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