1
0
Эх сурвалжийг харах

Merge pull request #1319 from davidebeatrici/include-headers-properly

Include headers properly
Ilya Shipitsin 4 жил өмнө
parent
commit
2bb6fb2845
100 өөрчлөгдсөн 1042 нэмэгдсэн , 551 устгасан
  1. 2 2
      src/CMakeLists.txt
  2. 12 1
      src/Cedar/Account.c
  3. 4 0
      src/Cedar/Account.h
  4. 36 1
      src/Cedar/Admin.c
  5. 8 0
      src/Cedar/Admin.h
  6. 17 1
      src/Cedar/AzureClient.c
  7. 5 0
      src/Cedar/AzureClient.h
  8. 0 10
      src/Cedar/AzureServer.c
  9. 0 14
      src/Cedar/AzureServer.h
  10. 13 19
      src/Cedar/Bridge.c
  11. 2 12
      src/Cedar/Bridge.h
  12. 27 18
      src/Cedar/BridgeUnix.c
  13. 8 2
      src/Cedar/BridgeUnix.h
  14. 19 18
      src/Cedar/BridgeWin32.c
  15. 9 6
      src/Cedar/BridgeWin32.h
  16. 23 36
      src/Cedar/CM.c
  17. 10 4
      src/Cedar/CM.h
  18. 11 0
      src/Cedar/CMInner.h
  19. 29 2
      src/Cedar/Cedar.c
  20. 8 130
      src/Cedar/Cedar.h
  21. 0 9
      src/Cedar/CedarPch.c
  22. 0 20
      src/Cedar/CedarPch.h
  23. 10 0
      src/Cedar/CedarType.h
  24. 37 1
      src/Cedar/Client.c
  25. 6 4
      src/Cedar/Client.h
  26. 39 1
      src/Cedar/Command.c
  27. 6 0
      src/Cedar/Command.h
  28. 25 1
      src/Cedar/Connection.c
  29. 5 0
      src/Cedar/Connection.h
  30. 27 3
      src/Cedar/Console.c
  31. 4 0
      src/Cedar/Console.h
  32. 15 1
      src/Cedar/DDNS.c
  33. 5 0
      src/Cedar/DDNS.h
  34. 7 1
      src/Cedar/Database.c
  35. 2 0
      src/Cedar/Database.h
  36. 21 29
      src/Cedar/EM.c
  37. 4 0
      src/Cedar/EMInner.h
  38. 18 1
      src/Cedar/EtherLog.c
  39. 2 0
      src/Cedar/EtherLog.h
  40. 31 10
      src/Cedar/Hub.c
  41. 2 0
      src/Cedar/Hub.h
  42. 16 1
      src/Cedar/IPC.c
  43. 5 0
      src/Cedar/IPC.h
  44. 15 1
      src/Cedar/Layer3.c
  45. 2 0
      src/Cedar/Layer3.h
  46. 15 1
      src/Cedar/Link.c
  47. 4 0
      src/Cedar/Link.h
  48. 12 1
      src/Cedar/Listener.c
  49. 3 0
      src/Cedar/Listener.h
  50. 25 4
      src/Cedar/Logging.c
  51. 3 0
      src/Cedar/Logging.h
  52. 13 29
      src/Cedar/NM.c
  53. 3 0
      src/Cedar/NMInner.h
  54. 12 1
      src/Cedar/Nat.c
  55. 5 0
      src/Cedar/Nat.h
  56. 15 1
      src/Cedar/NativeStack.c
  57. 4 0
      src/Cedar/NativeStack.h
  58. 11 1
      src/Cedar/NullLan.c
  59. 3 0
      src/Cedar/NullLan.h
  60. 13 1
      src/Cedar/Proto.c
  61. 7 2
      src/Cedar/Proto.h
  62. 12 1
      src/Cedar/Proto_EtherIP.c
  63. 1 2
      src/Cedar/Proto_EtherIP.h
  64. 16 1
      src/Cedar/Proto_IKE.c
  65. 1 1
      src/Cedar/Proto_IKE.h
  66. 15 2
      src/Cedar/Proto_IPsec.c
  67. 2 0
      src/Cedar/Proto_IPsec.h
  68. 5 1
      src/Cedar/Proto_IkePacket.c
  69. 5 0
      src/Cedar/Proto_IkePacket.h
  70. 14 1
      src/Cedar/Proto_L2TP.c
  71. 3 1
      src/Cedar/Proto_L2TP.h
  72. 16 1
      src/Cedar/Proto_OpenVPN.c
  73. 1 0
      src/Cedar/Proto_OpenVPN.h
  74. 16 1
      src/Cedar/Proto_PPP.c
  75. 3 0
      src/Cedar/Proto_PPP.h
  76. 11 1
      src/Cedar/Proto_SSTP.c
  77. 2 0
      src/Cedar/Proto_SSTP.h
  78. 15 28
      src/Cedar/Proto_Win7.c
  79. 3 0
      src/Cedar/Proto_Win7.h
  80. 12 3
      src/Cedar/Proto_Win7Inner.h
  81. 11 1
      src/Cedar/Proto_WireGuard.c
  82. 2 0
      src/Cedar/Proto_WireGuard.h
  83. 37 4
      src/Cedar/Protocol.c
  84. 2 0
      src/Cedar/Protocol.h
  85. 9 2
      src/Cedar/Radius.c
  86. 4 0
      src/Cedar/Radius.h
  87. 8 1
      src/Cedar/Remote.c
  88. 2 0
      src/Cedar/Remote.h
  89. 23 26
      src/Cedar/SM.c
  90. 12 1
      src/Cedar/SMInner.h
  91. 20 31
      src/Cedar/SW.c
  92. 2 0
      src/Cedar/SW.h
  93. 2 0
      src/Cedar/SWInner.h
  94. 25 2
      src/Cedar/Sam.c
  95. 3 0
      src/Cedar/Sam.h
  96. 16 14
      src/Cedar/SeLowUser.c
  97. 4 0
      src/Cedar/SeLowUser.h
  98. 0 10
      src/Cedar/SecureInfo.c
  99. 0 14
      src/Cedar/SecureInfo.h
  100. 12 1
      src/Cedar/SecureNAT.c

+ 2 - 2
src/CMakeLists.txt

@@ -59,7 +59,7 @@ add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_S
 include_directories(.)
 
 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()
 
 if(UNIX)
@@ -67,7 +67,7 @@ if(UNIX)
   set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
   set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
 
-  add_definitions(-DUNIX)
+  add_definitions(-DUNIX -DOS_UNIX)
 
   if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
     add_definitions(-DUNIX_LINUX)

+ 12 - 1
src/Cedar/Account.c

@@ -5,7 +5,18 @@
 // Account.c
 // 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_ITEM policy_item[] =

+ 4 - 0
src/Cedar/Account.h

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

+ 36 - 1
src/Cedar/Admin.c

@@ -5,7 +5,42 @@
 // Admin.c
 // 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
 #define	DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc)		\

+ 8 - 0
src/Cedar/Admin.h

@@ -8,6 +8,14 @@
 #ifndef	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
 struct RPC_WINVER
 {

+ 17 - 1
src/Cedar/AzureClient.c

@@ -5,7 +5,23 @@
 // AzureClient.c
 // 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
 void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)

+ 5 - 0
src/Cedar/AzureClient.h

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

+ 0 - 10
src/Cedar/AzureServer.c

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

+ 0 - 14
src/Cedar/AzureServer.h

@@ -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
-
-

+ 13 - 19
src/Cedar/Bridge.c

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

+ 2 - 12
src/Cedar/Bridge.h

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

+ 27 - 18
src/Cedar/BridgeUnix.c

@@ -4,22 +4,31 @@
 
 // BridgeUnix.c
 // 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 <wchar.h>
-#include <stdarg.h>
-#include <time.h>
+
 #include <errno.h>
-#include <Mayaqua/Mayaqua.h>
-#include <Cedar/Cedar.h>
+#include <fcntl.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
 
 #ifdef UNIX_SOLARIS
 #include <sys/sockio.h>
@@ -27,17 +36,18 @@
 
 #ifdef BRIDGE_PCAP
 #include <pcap.h>
-#endif // BRIDGE_PCAP
+#endif
 
 #ifdef BRIDGE_BPF
-#include <sys/ioctl.h>
+#include <ifaddrs.h>
 #include <net/bpf.h>
 #include <net/if_types.h>
 #include <net/if_dl.h>
-#include <ifaddrs.h>
-#endif // BRIDGE_BPF
+#endif
+
+#ifdef UNIX_LINUX
+#include <linux/if_packet.h>
 
-#ifdef	UNIX_LINUX
 struct my_tpacket_auxdata
 {
 	UINT tp_status;
@@ -2688,5 +2698,4 @@ void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size)
 	Free(data);
 }
 
-
-#endif	// BRIDGE_C
+#endif

+ 8 - 2
src/Cedar/BridgeUnix.h

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

+ 19 - 18
src/Cedar/BridgeWin32.c

@@ -5,24 +5,27 @@
 // BridgeWin32.c
 // Ethernet Bridge Program (Win32)
 
-#include <GlobalConst.h>
+#ifdef OS_WIN32
 
-#ifdef	BRIDGE_C
+#define BRIDGE_C
 
-#include <winsock2.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>
+#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 <Ws2tcpip.h>
 
 static WP *wp = NULL;
 static LIST *eth_list = NULL;
@@ -2091,6 +2094,4 @@ void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name)
 	Free(ncname);
 }
 
-#endif	// BRIDGE_C
-
-
+#endif

+ 9 - 6
src/Cedar/BridgeWin32.h

@@ -5,9 +5,15 @@
 // BridgeWin32.h
 // Header of BridgeWin32.c
 
+#ifdef OS_WIN32
+
 #ifndef	BRIDGEWIN32_H
 #define	BRIDGEWIN32_H
 
+#include "Bridge.h"
+
+#include <Packet32.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"
@@ -18,10 +24,7 @@
 
 #define	BRIDGE_WIN32_ETH_BUFFER		(1048576)
 
-
-typedef void *HANDLE;
-
-#ifdef	BRIDGE_C
+#ifdef BRIDGE_C
 
 // Header for Internal function (for BridgeWin32.c)
 typedef struct WP
@@ -157,6 +160,6 @@ bool Win32IsUsingSeLow();
 void Win32SetEnableSeLow(bool b);
 bool Win32GetEnableSeLow();
 
-#endif	// BRIDGEWIN32_H
-
+#endif // BRIDGEWIN32_H
 
+#endif // OS_WIN32

+ 23 - 36
src/Cedar/CM.c

@@ -5,46 +5,33 @@
 // CM.c
 // VPN Client Connection Manager for Win32
 
-#include <GlobalConst.h>
-
-#ifdef	WIN32
-
-#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>
+#ifdef OS_WIN32
+
+#define WINUI_C
+#define MICROSOFT_C
+
 #include "CMInner.h"
+
+#include "Nat.h"
+#include "Protocol.h"
+#include "Remote.h"
 #include "SMInner.h"
-#include "NMInner.h"
-#include "EMInner.h"
+#include "UT.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 <shellapi.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)

+ 10 - 4
src/Cedar/CM.h

@@ -5,8 +5,14 @@
 // CM.h
 // Header of CM.c
 
-#ifndef	CM_H
-#define	CM_H
+#ifdef OS_WIN32
+
+#ifndef CM_H
+#define CM_H
+
+#include "GlobalConst.h"
+
+#include "Mayaqua/MayaType.h"
 
 // Constants
 #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();
 UINT CmGetSecureBitmapId(char *dest_hostname);
 
-#endif	// CM_H
-
+#endif // CM_H
 
+#endif // OS_WIN32

+ 11 - 0
src/Cedar/CMInner.h

@@ -5,10 +5,21 @@
 // CMInner.h
 // 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	NAME_OF_VPN_CLIENT_MANAGER	"vpncmgr"
 
+typedef struct LVB LVB;
+
 void CmVoice(char *name);
 
 typedef struct CM_UAC_HELPER

+ 29 - 2
src/Cedar/Cedar.c

@@ -5,8 +5,35 @@
 // Cedar.c
 // Cedar Communication Module
 
-
-#include "CedarPch.h"
+#include "Cedar.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 REF *cedar_log_ref = NULL;

+ 8 - 130
src/Cedar/Cedar.h

@@ -8,6 +8,10 @@
 #ifndef	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 data
-typedef struct TRAFFIC
+struct TRAFFIC
 {
 	TRAFFIC_ENTRY Send;				// Transmitted data
 	TRAFFIC_ENTRY Recv;				// Received data
-} TRAFFIC;
+};
 
 // Non-SSL connection source
 typedef struct NON_SSL
@@ -911,7 +915,7 @@ typedef struct TINY_LOG
 } TINY_LOG;
 
 // CEDAR structure
-typedef struct CEDAR
+struct CEDAR
 {
 	LOCK *lock;						// Lock
 	REF *ref;						// Reference counter
@@ -979,7 +983,7 @@ typedef struct CEDAR
 	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
@@ -987,132 +991,6 @@ typedef struct CEDAR
 #define	CEDAR_FARM_CONTROLLER		2	// Server farm controller
 #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
 

+ 0 - 9
src/Cedar/CedarPch.c

@@ -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"
-

+ 0 - 20
src/Cedar/CedarPch.h

@@ -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>
-

+ 10 - 0
src/Cedar/CedarType.h

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

+ 37 - 1
src/Cedar/Client.c

@@ -5,7 +5,43 @@
 // Client.c
 // 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 LISTENER *cn_listener = NULL;

+ 6 - 4
src/Cedar/Client.h

@@ -8,6 +8,10 @@
 #ifndef	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_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
@@ -742,11 +746,9 @@ 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
+#ifdef OS_WIN32
+typedef struct MS_DRIVER_VER MS_DRIVER_VER;
 void CiInitDriverVerStruct(MS_DRIVER_VER *ver);
 #endif	// OS_EIN32
 
 #endif	// CLIENT_H
-
-

+ 39 - 1
src/Cedar/Command.c

@@ -5,7 +5,45 @@
 // Command.c
 // 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
 typedef bool (CHECKER_PROC_DEF)();

+ 6 - 0
src/Cedar/Command.h

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

+ 25 - 1
src/Cedar/Connection.c

@@ -5,7 +5,31 @@
 // Connection.c
 // 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
 #define	IS_SEND_TCP_SOCK(ts)		\

+ 5 - 0
src/Cedar/Connection.h

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

+ 27 - 3
src/Cedar/Console.c

@@ -5,8 +5,32 @@
 // Console.c
 // 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
 void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list)
@@ -1911,7 +1935,7 @@ bool PasswordPrompt(char *password, UINT size)
 		int c;
 
 #ifdef	OS_WIN32
-		c = getch();
+		c = _getch();
 #else	// OS_WIN32
 		c = getc(stdin);
 #endif	// OS_WIN32
@@ -1943,7 +1967,7 @@ bool PasswordPrompt(char *password, UINT size)
 		{
 			// Read one more character
 #ifdef	OS_WIN32
-			c = getch();
+			c = _getch();
 #else	// OS_WIN32
 			c = getc(stdin);
 #endif	// OS_WIN32

+ 4 - 0
src/Cedar/Console.h

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

+ 15 - 1
src/Cedar/DDNS.c

@@ -5,7 +5,21 @@
 // DDNS.c
 // 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
 void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st)

+ 5 - 0
src/Cedar/DDNS.h

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

+ 7 - 1
src/Cedar/Database.c

@@ -5,7 +5,13 @@
 // Database.c
 // 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
 wchar_t *LiGetLicenseStatusStr(UINT i)

+ 2 - 0
src/Cedar/Database.h

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

+ 21 - 29
src/Cedar/EM.c

@@ -5,39 +5,31 @@
 // EM.c
 // EtherLogger Manager for Win32
 
-#include <GlobalConst.h>
-
-#ifdef	WIN32
-
-#define	SM_C
-#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>
+#ifdef OS_WIN32
+
+#define WINUI_C
+
+#include "EM.h"
+#include "EMInner.h"
+
 #include "CMInner.h"
+#include "Database.h"
+#include "EtherLog.h"
+#include "Remote.h"
 #include "SMInner.h"
-#include "NMInner.h"
-#include "EMInner.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 <shellapi.h>
+#include <ShlObj.h>
 
 // License registration process
 void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s)

+ 4 - 0
src/Cedar/EMInner.h

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

+ 18 - 1
src/Cedar/EtherLog.c

@@ -5,7 +5,24 @@
 // EtherLog.c
 // 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 EL *el = NULL;

+ 2 - 0
src/Cedar/EtherLog.h

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

+ 31 - 10
src/Cedar/Hub.c

@@ -5,7 +5,28 @@
 // Hub.c
 // 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) \
 	value = GetHubAdminOptionData(ao, name);        \
@@ -4000,7 +4021,7 @@ DISCARD_PACKET:
 
 			if (forward_now)
 			{
-				if (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0)
+				if (Cmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0)
 				{
 					if (s != NULL)
 					{
@@ -4008,7 +4029,7 @@ 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
 					Copy(t.MacAddress, packet->MacAddressSrc, 6);
@@ -4167,7 +4188,7 @@ DISCARD_PACKET:
 							}
 
 							// 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))
 							{
 								UCHAR *mac = packet->MacAddressSrc;
@@ -4184,7 +4205,7 @@ DISCARD_PACKET:
 
 									if ((s->LastDLinkSTPPacketSendTick != 0) &&
 										(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
 										Debug("D-Link Discard %u\n", (UINT)tick_diff);
@@ -4824,8 +4845,8 @@ UPDATE_FDB:
 
 						if (s != NULL)
 						{
-							if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
-								memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
+							if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
+								Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
 							{
 								goto DISCARD_UNICAST_PACKET;
 							}
@@ -5041,8 +5062,8 @@ DISCARD_UNICAST_PACKET:
 
 								if (s != NULL)
 								{
-									if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
-										memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
+									if (Cmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 ||
+										Cmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0)
 									{
 										discard = true;
 									}
@@ -6664,7 +6685,7 @@ int CompareMacTable(void *p1, void *p2)
 	{
 		return 0;
 	}
-	r = memcmp(e1->MacAddress, e2->MacAddress, 6);
+	r = Cmp(e1->MacAddress, e2->MacAddress, 6);
 	if (r != 0)
 	{
 		return r;

+ 2 - 0
src/Cedar/Hub.h

@@ -8,6 +8,8 @@
 #ifndef	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 
 #define	ACCESS_LIST_INCLUDED_PREFIX		"include:"		// Included

+ 16 - 1
src/Cedar/IPC.c

@@ -5,7 +5,22 @@
 // IPC.c
 // 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
 bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password)

+ 5 - 0
src/Cedar/IPC.h

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

+ 15 - 1
src/Cedar/Layer3.c

@@ -5,7 +5,21 @@
 // Layer3.c
 // 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};
 

+ 2 - 0
src/Cedar/Layer3.h

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

+ 15 - 1
src/Cedar/Link.c

@@ -5,7 +5,21 @@
 // Link.c
 // 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
 void LinkServerSessionThread(THREAD *t, void *param)

+ 4 - 0
src/Cedar/Link.h

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

+ 12 - 1
src/Cedar/Listener.c

@@ -5,7 +5,18 @@
 // Listener.c
 // 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 UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP;

+ 3 - 0
src/Cedar/Listener.h

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

+ 25 - 4
src/Cedar/Logging.c

@@ -5,7 +5,28 @@
 // Logging.c
 // 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[] =
 {
@@ -832,8 +853,8 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe
 		return true;
 	}
 
-	if (memcmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 ||
-	        memcmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0)
+	if (Cmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 ||
+		Cmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0)
 	{
 		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;
 		StrCpy(old_datestr, MAX_SIZE, tmp);

+ 3 - 0
src/Cedar/Logging.h

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

+ 13 - 29
src/Cedar/NM.c

@@ -5,36 +5,20 @@
 // NM.c
 // VPN User-mode Router Manager for Win32
 
-#include <GlobalConst.h>
-
-#ifdef	WIN32
-
-#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"
+#ifdef OS_WIN32
+
+#include "NM.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"
 
 // Global variable

+ 3 - 0
src/Cedar/NMInner.h

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

+ 12 - 1
src/Cedar/Nat.c

@@ -5,7 +5,18 @@
 // Nat.c
 // 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 NAT *nat = NULL;

+ 5 - 0
src/Cedar/Nat.h

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

+ 15 - 1
src/Cedar/NativeStack.c

@@ -5,7 +5,21 @@
 // NativeStack.c
 // 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
 void NsMainThread(THREAD *thread, void *param)

+ 4 - 0
src/Cedar/NativeStack.h

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

+ 11 - 1
src/Cedar/NullLan.c

@@ -5,7 +5,17 @@
 // NullLan.c
 // 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};
 

+ 3 - 0
src/Cedar/NullLan.h

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

+ 13 - 1
src/Cedar/Proto.c

@@ -1,6 +1,18 @@
-#include "CedarPch.h"
+#include "Proto.h"
 
+#include "Cedar.h"
+#include "Logging.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, ...)
 {

+ 7 - 2
src/Cedar/Proto.h

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

+ 12 - 1
src/Cedar/Proto_EtherIP.c

@@ -5,7 +5,18 @@
 // Proto_EtherIP.c
 // 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
 void EtherIPIpcConnectThread(THREAD *t, void *p)

+ 1 - 2
src/Cedar/Proto_EtherIP.h

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

+ 16 - 1
src/Cedar/Proto_IKE.c

@@ -5,7 +5,22 @@
 // Proto_IKE.c
 // 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
 

+ 1 - 1
src/Cedar/Proto_IKE.h

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

+ 15 - 2
src/Cedar/Proto_IPsec.c

@@ -5,8 +5,21 @@
 // Proto_IPsec.c
 // 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;
 

+ 2 - 0
src/Cedar/Proto_IPsec.h

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

+ 5 - 1
src/Cedar/Proto_IkePacket.c

@@ -5,7 +5,11 @@
 // Proto_IkePacket.c
 // 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
 BUF *IkeStrToPassword(char *str)

+ 5 - 0
src/Cedar/Proto_IkePacket.h

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

+ 14 - 1
src/Cedar/Proto_L2TP.c

@@ -5,7 +5,20 @@
 // Proto_L2TP.c
 // 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
 void FreeL2TPAVP(L2TP_AVP *a)

+ 3 - 1
src/Cedar/Proto_L2TP.h

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

+ 16 - 1
src/Cedar/Proto_OpenVPN.c

@@ -5,7 +5,22 @@
 // Proto_OpenVPN.c
 // 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
 static UCHAR ping_signature[] =

+ 1 - 0
src/Cedar/Proto_OpenVPN.h

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

+ 16 - 1
src/Cedar/Proto_PPP.c

@@ -5,7 +5,22 @@
 // Proto_PPP.c
 // 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
 void PPPThread(THREAD *thread, void *param)

+ 3 - 0
src/Cedar/Proto_PPP.h

@@ -8,6 +8,9 @@
 #ifndef	PROTO_PPP_H
 #define	PROTO_PPP_H
 
+#include "CedarType.h"
+
+#include "Mayaqua/TcpIp.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)

+ 11 - 1
src/Cedar/Proto_SSTP.c

@@ -5,7 +5,17 @@
 // Proto_SSTP.c
 // 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()
 {

+ 2 - 0
src/Cedar/Proto_SSTP.h

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

+ 15 - 28
src/Cedar/Proto_Win7.c

@@ -5,39 +5,26 @@
 // 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 <GlobalConst.h>
-
-#ifdef	WIN32
-
-#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"
+#ifdef OS_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"
+
 #include <Wfp/Wfp.h>
 
+#include <stdlib.h>
+
+#include <fwpmu.h>
+
 static IPSEC_WIN7_FUNCTIONS *api = NULL;
 static HINSTANCE hDll = NULL;
 
-
 // Initialize the IPsec helper module for Windows 7
 IPSEC_WIN7 *IPsecWin7Init()
 {

+ 3 - 0
src/Cedar/Proto_Win7.h

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

+ 12 - 3
src/Cedar/Proto_Win7Inner.h

@@ -5,8 +5,15 @@
 // Proto_Win7Inner.h
 // Internal header of Proto_Win7.c
 
-#ifndef	PROTO_WIN7_INNER_H
-#define	PROTO_WIN7_INNER_H
+#ifdef OS_WIN32
+
+#ifndef PROTO_WIN7_INNER_H
+#define PROTO_WIN7_INNER_H
+
+#include "Mayaqua/MayaType.h"
+
+#include <rpc.h>
+#include <fwpmtypes.h>
 
 // API function
 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

+ 11 - 1
src/Cedar/Proto_WireGuard.c

@@ -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>
 

+ 2 - 0
src/Cedar/Proto_WireGuard.h

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

+ 37 - 4
src/Cedar/Protocol.c

@@ -5,9 +5,42 @@
 // Protocol.c
 // SoftEther protocol related routines
 
-#include "CedarPch.h"
-
-static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00};
+#include "Protocol.h"
+
+#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
 bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x)
@@ -3156,7 +3189,7 @@ bool ServerAccept(CONNECTION *c)
 			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
 					wchar_t *tmp2;

+ 2 - 0
src/Cedar/Protocol.h

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

+ 9 - 2
src/Cedar/Radius.c

@@ -5,10 +5,17 @@
 // Radius.c
 // 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
 bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge)

+ 4 - 0
src/Cedar/Radius.h

@@ -8,6 +8,10 @@
 #ifndef	RADIUS_H
 #define	RADIUS_H
 
+#include "Cedar.h"
+
+#include "Mayaqua/Mayaqua.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

+ 8 - 1
src/Cedar/Remote.c

@@ -5,7 +5,14 @@
 // Remote.c
 // 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
 void EndRpc(RPC *rpc)

+ 2 - 0
src/Cedar/Remote.h

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

+ 23 - 26
src/Cedar/SM.c

@@ -5,38 +5,35 @@
 // SM.c
 // VPN Server Manager for Win32
 
-#include <GlobalConst.h>
+#ifdef OS_WIN32
 
-#ifdef	WIN32
-
-#define	SM_C
-#define	CM_C
-#define	NM_C
+#include "SM.h"
+#include "SMInner.h"
 
-#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 "AzureClient.h"
 #include "CMInner.h"
-#include "SMInner.h"
+#include "Console.h"
+#include "Database.h"
+#include "Layer3.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 <shellapi.h>
+#include <shlobj.h>
+
 // Global variable
 static SM *sm = NULL;
 static bool link_create_now = false;

+ 12 - 1
src/Cedar/SMInner.h

@@ -5,6 +5,17 @@
 // SMInner.h
 // 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
 #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"
@@ -720,4 +731,4 @@ 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);
 
-
+#endif

+ 20 - 31
src/Cedar/SW.c

@@ -5,40 +5,29 @@
 // SW.c
 // Setup Wizard for Win32
 
-#include <GlobalConst.h>
-
-#ifdef	WIN32
-
-#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"
+#ifdef OS_WIN32
+
+#include "SW.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 <ShlObj.h>
+
 //// Old MSI product information
 // VPN Server
 static SW_OLD_MSI old_msi_vpnserver[] =

+ 2 - 0
src/Cedar/SW.h

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

+ 2 - 0
src/Cedar/SWInner.h

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

+ 25 - 2
src/Cedar/Sam.c

@@ -5,8 +5,31 @@
 // Sam.c
 // 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) {
 	unsigned int n = plainLen;

+ 3 - 0
src/Cedar/Sam.h

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

+ 16 - 14
src/Cedar/SeLowUser.c

@@ -5,20 +5,22 @@
 // SeLowUser.c
 // SoftEther Lightweight Network Protocol User-mode Library
 
-#include <GlobalConst.h>
-
-#ifdef	WIN32
-
-#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 <Mayaqua/Mayaqua.h>
-#include <Cedar/Cedar.h>
+#ifdef OS_WIN32
+
+#include "SeLowUser.h"
+
+#include "BridgeWin32.h"
+#include "Win32Com.h"
+
+#include "Mayaqua/Cfg.h"
+#include "Mayaqua/FileIO.h"
+#include "Mayaqua/Internat.h"
+#include "Mayaqua/Microsoft.h"
+#include "Mayaqua/Memory.h"
+#include "Mayaqua/Str.h"
+#include "Mayaqua/Tick64.h"
+
+#include "See/Devioctl.h"
 
 // Load the drivers hive
 bool SuLoadDriversHive()

+ 4 - 0
src/Cedar/SeLowUser.h

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

+ 0 - 10
src/Cedar/SecureInfo.c

@@ -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"
-
-

+ 0 - 14
src/Cedar/SecureInfo.h

@@ -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
-
-

+ 12 - 1
src/Cedar/SecureNAT.c

@@ -5,7 +5,18 @@
 // SecureNAT.c
 // 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
 void SnSecureNATThread(THREAD *t, void *param)

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно