2017-10-19 05:48:23 +03:00
|
|
|
// SoftEther VPN Source Code - Developer Edition Master Branch
|
2014-01-04 17:00:08 +04:00
|
|
|
// Cedar Communication Module
|
|
|
|
|
|
|
|
|
|
|
|
// vpnserver.c
|
|
|
|
// VPN Server service program
|
|
|
|
|
|
|
|
#include <GlobalConst.h>
|
|
|
|
|
|
|
|
#define VPN_EXE
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <wincrypt.h>
|
|
|
|
#include <wininet.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <Dbghelp.h>
|
|
|
|
#include "../PenCore/resource.h"
|
|
|
|
#endif // WIN32
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <wchar.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <Mayaqua/Mayaqua.h>
|
|
|
|
#include <Cedar/Cedar.h>
|
|
|
|
|
|
|
|
// Process starting function
|
|
|
|
void StartProcess()
|
|
|
|
{
|
|
|
|
// Start the server
|
|
|
|
InitCedar();
|
|
|
|
StInit();
|
|
|
|
StStartServer(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process termination function
|
|
|
|
void StopProcess()
|
|
|
|
{
|
|
|
|
// Stop the server
|
|
|
|
StStopServer();
|
|
|
|
StFree();
|
|
|
|
FreeCedar();
|
|
|
|
}
|
|
|
|
|
|
|
|
// WinMain function
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2018-04-22 12:21:19 +03:00
|
|
|
InitProcessCallOnce();
|
|
|
|
|
2014-01-04 17:00:08 +04:00
|
|
|
VgUseStaticLink();
|
|
|
|
|
|
|
|
#ifdef OS_WIN32
|
|
|
|
|
|
|
|
return MsService(GC_SVC_NAME_VPNSERVER, StartProcess, StopProcess, ICO_CASCADE, argv[0]);
|
|
|
|
#else // OS_WIN32
|
2017-10-19 09:24:51 +03:00
|
|
|
return UnixService(argc, argv, "vpnserver", StartProcess, StopProcess);
|
2014-01-04 17:00:08 +04:00
|
|
|
#endif // OS_WIN32
|
|
|
|
}
|
|
|
|
|