1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-10 03:30:39 +03:00

Merge PR #647: remove unused functions, variables

This commit is contained in:
Davide Beatrici 2018-08-13 06:37:43 +02:00 committed by GitHub
commit 7c72e008eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 265 deletions

View File

@ -124,24 +124,12 @@ static UCHAR ping_signature[] =
0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48
}; };
// Set the OpenVPN over TCP disabling flag
void OvsSetNoOpenVpnTcp(bool b)
{
g_no_openvpn_tcp = b;
}
// Get the OpenVPN over TCP disabling flag // Get the OpenVPN over TCP disabling flag
bool OvsGetNoOpenVpnTcp() bool OvsGetNoOpenVpnTcp()
{ {
return g_no_openvpn_tcp; return g_no_openvpn_tcp;
} }
// Set the OpenVPN over UDP disabling flag
void OvsSetNoOpenVpnUdp(bool b)
{
g_no_openvpn_udp = b;
}
// Get the OpenVPN over UDP disabling flag // Get the OpenVPN over UDP disabling flag
bool OvsGetNoOpenVpnUdp() bool OvsGetNoOpenVpnUdp()
{ {
@ -1043,44 +1031,6 @@ void OvsFreeList(LIST *o)
FreeIni(o); FreeIni(o);
} }
// Create an Option List
LIST *OvsNewList()
{
return NewListFast(NULL);
}
// Add a value to the option list
void OvsAddEntry(LIST *o, char *key, char *value)
{
INI_ENTRY *e;
// Validate arguments
if (o == NULL)
{
return;
}
e = GetIniEntry(o, key);
if (e != NULL)
{
// Overwrite existing keys
Free(e->Key);
e->Key = CopyStr(key);
Free(e->Value);
e->Value = CopyStr(value);
}
else
{
// Create a new key
e = ZeroMalloc(sizeof(INI_ENTRY));
e->Key = CopyStr(key);
e->Value = CopyStr(value);
Add(o, e);
}
}
// Confirm whether there is specified option key string // Confirm whether there is specified option key string
bool OvsHasEntry(LIST *o, char *key) bool OvsHasEntry(LIST *o, char *key)
{ {
@ -2606,22 +2556,6 @@ bool OvsIsCompatibleL3IP(UINT ip)
return false; return false;
} }
// Get an IP address that is compatible to tun device of the OpenVPN after the specified IP address
UINT OvsGetCompatibleL3IPNext(UINT ip)
{
ip = Endian32(ip);
while (true)
{
if (OvsIsCompatibleL3IP(Endian32(ip)))
{
return Endian32(ip);
}
ip++;
}
}
// Create a new OpenVPN server // Create a new OpenVPN server
OPENVPN_SERVER *NewOpenVpnServer(CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event) OPENVPN_SERVER *NewOpenVpnServer(CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event)
{ {
@ -2708,7 +2642,6 @@ void FreeOpenVpnServer(OPENVPN_SERVER *s)
void OpenVpnServerUdpListenerProc(UDPLISTENER *u, LIST *packet_list) void OpenVpnServerUdpListenerProc(UDPLISTENER *u, LIST *packet_list)
{ {
OPENVPN_SERVER_UDP *us; OPENVPN_SERVER_UDP *us;
UINT64 now = Tick64();
// Validate arguments // Validate arguments
if (u == NULL || packet_list == NULL) if (u == NULL || packet_list == NULL)
{ {

View File

@ -361,13 +361,10 @@ void OvsWriteStringToBuf(BUF *b, char *str, UINT max_size);
LIST *OvsParseData(char *str, int type); LIST *OvsParseData(char *str, int type);
void OvsFreeList(LIST *o); void OvsFreeList(LIST *o);
LIST *OvsNewList();
void OvsAddEntry(LIST *o, char *key, char *value);
bool OvsHasEntry(LIST *o, char *key); bool OvsHasEntry(LIST *o, char *key);
UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size); UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size);
void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c);
bool OvsIsCompatibleL3IP(UINT ip); bool OvsIsCompatibleL3IP(UINT ip);
UINT OvsGetCompatibleL3IPNext(UINT ip);
UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c);
CIPHER *OvsGetCipher(char *name); CIPHER *OvsGetCipher(char *name);
@ -378,11 +375,8 @@ bool OvsPerformTcpServer(CEDAR *cedar, SOCK *sock);
void OvsSetReplyForVgsPollEnable(bool b); void OvsSetReplyForVgsPollEnable(bool b);
void OvsSetNoOpenVpnTcp(bool b);
bool OvsGetNoOpenVpnTcp(); bool OvsGetNoOpenVpnTcp();
void OvsSetNoOpenVpnUdp(bool b);
void OpenVpnServerUdpSetDhParam(OPENVPN_SERVER_UDP *u, DH_CTX *dh); void OpenVpnServerUdpSetDhParam(OPENVPN_SERVER_UDP *u, DH_CTX *dh);

View File

@ -291,23 +291,6 @@ void FreeEraseFileList(LIST *o)
ReleaseList(o); ReleaseList(o);
} }
// Show the deleting file list
void PrintEraseFileList(LIST *o)
{
UINT i;
// Validate arguments
if (o == NULL)
{
return;
}
for (i = 0;i < LIST_NUM(o);i++)
{
ERASE_FILE *f = LIST_DATA(o, i);
Print("%I64u - %s\n", f->UpdateTime, f->FullPath);
}
}
// Generate a deleting file list of the specified directory // Generate a deleting file list of the specified directory
void EnumEraseFile(LIST *o, char *dirname) void EnumEraseFile(LIST *o, char *dirname)
{ {
@ -618,23 +601,6 @@ void ELog(ERASER *e, char *name, ...)
va_end(args); va_end(args);
} }
// Take the log of the server
void ServerLog(CEDAR *c, wchar_t *fmt, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
va_start(args, fmt);
UniFormatArgs(buf, sizeof(buf), fmt, args);
WriteServerLog(c, buf);
va_end(args);
}
void SLog(CEDAR *c, char *name, ...) void SLog(CEDAR *c, char *name, ...)
{ {
wchar_t buf[MAX_SIZE * 2]; wchar_t buf[MAX_SIZE * 2];
@ -675,23 +641,6 @@ void CLog(CLIENT *c, char *name, ...)
va_end(args); va_end(args);
} }
// Take the security log of the HUB
void HubLog(HUB *h, wchar_t *fmt, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
va_start(args, fmt);
UniFormatArgs(buf, sizeof(buf), fmt, args);
WriteHubLog(h, buf);
va_end(args);
}
void ALog(ADMIN *a, HUB *h, char *name, ...) void ALog(ADMIN *a, HUB *h, char *name, ...)
{ {
wchar_t buf[MAX_SIZE * 2]; wchar_t buf[MAX_SIZE * 2];
@ -884,34 +833,6 @@ void PPPLog(PPP_SESSION *p, char *name, ...)
WriteServerLog(p->Cedar, buf); WriteServerLog(p->Cedar, buf);
} }
// Write an IPC log
void IPCLog(IPC *ipc, char *name, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
HUB *h;
// Validate arguments
if (name == NULL)
{
return;
}
h = GetHub(ipc->Cedar, ipc->HubName);
if (h == NULL)
{
return;
}
va_start(args, name);
UniFormatArgs(buf, sizeof(buf), _UU(name), args);
WriteHubLog(h, buf);
va_end(args);
ReleaseHub(h);
}
// Save the security log of the HUB // Save the security log of the HUB
void WriteHubLog(HUB *h, wchar_t *str) void WriteHubLog(HUB *h, wchar_t *str)
{ {
@ -993,69 +914,6 @@ void WriteServerLog(CEDAR *c, wchar_t *str)
} }
} }
// Write a multi-line log
void WriteMultiLineLog(LOG *g, BUF *b)
{
// Validate arguments
if (g == NULL || b == NULL)
{
return;
}
SeekBuf(b, 0, 0);
while (true)
{
char *s = CfgReadNextLine(b);
if (s == NULL)
{
break;
}
if (IsEmptyStr(s) == false)
{
InsertStringRecord(g, s);
}
Free(s);
}
}
// Take the security log (variable-length argument) *abolished
void SecLog(HUB *h, char *fmt, ...)
{
char buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
if (h->LogSetting.SaveSecurityLog == false)
{
return;
}
va_start(args, fmt);
FormatArgs(buf, sizeof(buf), fmt, args);
WriteSecurityLog(h, buf);
va_end(args);
}
// Take a security log
void WriteSecurityLog(HUB *h, char *str)
{
// Validate arguments
if (h == NULL || str == NULL)
{
return;
}
InsertStringRecord(h->SecurityLogger, str);
}
// Take a packet log // Take a packet log
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now) bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now)
{ {
@ -1157,7 +1015,7 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe
if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false) if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false)
{ {
if (src_session != NULL && src_session->NormalClient) if (src_session->NormalClient)
{ {
StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP); StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP);
} }
@ -2269,46 +2127,6 @@ void ReplaceForCsv(char *str)
} }
} }
// Set the directory name of the log
void SetLogDirName(LOG *g, char *dir)
{
// Validate arguments
if (g == NULL || dir == NULL)
{
return;
}
LockLog(g);
{
if (g->DirName != NULL)
{
Free(g->DirName);
}
g->DirName = CopyStr(dir);
}
UnlockLog(g);
}
// Set the name of the log
void SetLogPrefix(LOG *g, char *prefix)
{
// Validate arguments
if (g == NULL || prefix == NULL)
{
return;
}
LockLog(g);
{
if (g->DirName != NULL)
{
Free(g->Prefix);
}
g->DirName = CopyStr(prefix);
}
UnlockLog(g);
}
// Set the switch type of log // Set the switch type of log
void SetLogSwitchType(LOG *g, UINT switch_type) void SetLogSwitchType(LOG *g, UINT switch_type)
{ {

View File

@ -223,8 +223,6 @@ char *StringRecordParseProc(RECORD *rec);
bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr); bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr);
void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type); void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type);
void WriteRecordToBuffer(BUF *b, RECORD *r); void WriteRecordToBuffer(BUF *b, RECORD *r);
void SetLogDirName(LOG *g, char *dir);
void SetLogPrefix(LOG *g, char *prefix);
void SetLogSwitchType(LOG *g, UINT switch_type); void SetLogSwitchType(LOG *g, UINT switch_type);
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now); bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now);
char *PacketLogParseProc(RECORD *rec); char *PacketLogParseProc(RECORD *rec);
@ -234,17 +232,12 @@ char *GenCsvLine(TOKEN_LIST *t);
void ReplaceForCsv(char *str); void ReplaceForCsv(char *str);
char *PortStr(CEDAR *cedar, UINT port, bool udp); char *PortStr(CEDAR *cedar, UINT port, bool udp);
char *TcpFlagStr(UCHAR flag); char *TcpFlagStr(UCHAR flag);
void WriteSecurityLog(HUB *h, char *str);
void SecLog(HUB *h, char *fmt, ...);
void SiSetDefaultLogSetting(HUB_LOG *g); void SiSetDefaultLogSetting(HUB_LOG *g);
void DebugLog(CEDAR *c, char *fmt, ...); void DebugLog(CEDAR *c, char *fmt, ...);
void HubLog(HUB *h, wchar_t *fmt, ...);
void ServerLog(CEDAR *c, wchar_t *fmt, ...);
void SLog(CEDAR *c, char *name, ...); void SLog(CEDAR *c, char *name, ...);
void WriteHubLog(HUB *h, wchar_t *str); void WriteHubLog(HUB *h, wchar_t *str);
void HLog(HUB *h, char *name, ...); void HLog(HUB *h, char *name, ...);
void NLog(VH *v, char *name, ...); void NLog(VH *v, char *name, ...);
void IPCLog(IPC *ipc, char *name, ...);
void PPPLog(PPP_SESSION *p, char *name, ...); void PPPLog(PPP_SESSION *p, char *name, ...);
void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...); void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...);
void EtherIPLog(ETHERIP_SERVER *s, char *name, ...); void EtherIPLog(ETHERIP_SERVER *s, char *name, ...);
@ -261,13 +254,11 @@ bool CheckEraserDiskFreeSpace(ERASER *e);
int CompareEraseFile(void *p1, void *p2); int CompareEraseFile(void *p1, void *p2);
LIST *GenerateEraseFileList(ERASER *e); LIST *GenerateEraseFileList(ERASER *e);
void FreeEraseFileList(LIST *o); void FreeEraseFileList(LIST *o);
void PrintEraseFileList(LIST *o);
void EnumEraseFile(LIST *o, char *dirname); void EnumEraseFile(LIST *o, char *dirname);
SLOG *NewSysLog(char *hostname, UINT port, IP *ip); SLOG *NewSysLog(char *hostname, UINT port, IP *ip);
void SetSysLog(SLOG *g, char *hostname, UINT port); void SetSysLog(SLOG *g, char *hostname, UINT port);
void FreeSysLog(SLOG *g); void FreeSysLog(SLOG *g);
void SendSysLog(SLOG *g, wchar_t *str); void SendSysLog(SLOG *g, wchar_t *str);
void WriteMultiLineLog(LOG *g, BUF *b);
char *BuildHttpLogStr(HTTPLOG *h); char *BuildHttpLogStr(HTTPLOG *h);
void MakeSafeLogStr(char *str); void MakeSafeLogStr(char *str);
void AddLogBufToStr(BUF *b, char *name, char *value); void AddLogBufToStr(BUF *b, char *name, char *value);