mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Cedar: improve constness of PROTO_IMPL functions, move Name() at the top
This commit is contained in:
parent
b57a4b051b
commit
cd850c07ae
@ -24,9 +24,9 @@ typedef struct PROTO
|
||||
|
||||
typedef struct PROTO_IMPL
|
||||
{
|
||||
const char *(*Name)();
|
||||
bool (*Init)(void **param, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
void (*Free)(void *param);
|
||||
char *(*Name)();
|
||||
bool (*IsPacketForMe)(const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
bool (*ProcessData)(void *param, TCP_RAW_DATA *in, FIFO *out);
|
||||
bool (*ProcessDatagrams)(void *param, LIST *in, LIST *out);
|
||||
|
@ -14,13 +14,13 @@ static UCHAR ping_signature[] =
|
||||
0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48
|
||||
};
|
||||
|
||||
PROTO_IMPL *OvsGetProtoImpl()
|
||||
const PROTO_IMPL *OvsGetProtoImpl()
|
||||
{
|
||||
static PROTO_IMPL impl =
|
||||
static const PROTO_IMPL impl =
|
||||
{
|
||||
OvsName,
|
||||
OvsInit,
|
||||
OvsFree,
|
||||
OvsName,
|
||||
OvsIsPacketForMe,
|
||||
OvsProcessData,
|
||||
OvsProcessDatagrams
|
||||
@ -29,6 +29,11 @@ PROTO_IMPL *OvsGetProtoImpl()
|
||||
return &impl;
|
||||
}
|
||||
|
||||
const char *OvsName()
|
||||
{
|
||||
return "OpenVPN";
|
||||
}
|
||||
|
||||
bool OvsInit(void **param, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname)
|
||||
{
|
||||
if (param == NULL || cedar == NULL || im == NULL || se == NULL)
|
||||
@ -48,12 +53,6 @@ void OvsFree(void *param)
|
||||
FreeOpenVpnServer(param);
|
||||
}
|
||||
|
||||
// Return the protocol name
|
||||
char *OvsName()
|
||||
{
|
||||
return "OpenVPN";
|
||||
}
|
||||
|
||||
// Check whether it's an OpenVPN packet
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size)
|
||||
{
|
||||
|
@ -208,10 +208,10 @@ struct OPENVPN_SERVER
|
||||
#define OVPN_DEF_CLIENT_OPTION_STRING "dev-type tun,link-mtu 1500,tun-mtu 1500,cipher AES-128-CBC,auth SHA1,keysize 128,key-method 2,tls-client"
|
||||
|
||||
//// Function prototype
|
||||
PROTO_IMPL *OvsGetProtoImpl();
|
||||
const PROTO_IMPL *OvsGetProtoImpl();
|
||||
const char *OvsName();
|
||||
bool OvsInit(void **param, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
void OvsFree(void *param);
|
||||
char *OvsName();
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out);
|
||||
bool OvsProcessDatagrams(void *param, LIST *in, LIST *out);
|
||||
|
@ -16,13 +16,13 @@ bool GetNoSstp()
|
||||
return g_no_sstp;
|
||||
}
|
||||
|
||||
PROTO_IMPL *SstpGetProtoImpl()
|
||||
const PROTO_IMPL *SstpGetProtoImpl()
|
||||
{
|
||||
static PROTO_IMPL impl =
|
||||
static const PROTO_IMPL impl =
|
||||
{
|
||||
SstpName,
|
||||
SstpInit,
|
||||
SstpFree,
|
||||
SstpName,
|
||||
NULL,
|
||||
SstpProcessData,
|
||||
NULL
|
||||
@ -31,6 +31,11 @@ PROTO_IMPL *SstpGetProtoImpl()
|
||||
return &impl;
|
||||
}
|
||||
|
||||
const char *SstpName()
|
||||
{
|
||||
return "SSTP";
|
||||
}
|
||||
|
||||
bool SstpInit(void **param, struct CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname)
|
||||
{
|
||||
if (param == NULL || cedar == NULL || im == NULL || se == NULL)
|
||||
@ -50,11 +55,6 @@ void SstpFree(void *param)
|
||||
FreeSstpServer(param);
|
||||
}
|
||||
|
||||
char *SstpName()
|
||||
{
|
||||
return "SSTP";
|
||||
}
|
||||
|
||||
bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out)
|
||||
{
|
||||
FIFO *recv_fifo;
|
||||
|
@ -122,10 +122,10 @@ struct SSTP_SERVER
|
||||
|
||||
|
||||
//// Function prototype
|
||||
PROTO_IMPL *SstpGetProtoImpl();
|
||||
const PROTO_IMPL *SstpGetProtoImpl();
|
||||
const char *SstpName();
|
||||
bool SstpInit(void **param, struct CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
void SstpFree(void *param);
|
||||
char *SstpName();
|
||||
bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out);
|
||||
|
||||
SSTP_SERVER *NewSstpServer(CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
|
Loading…
Reference in New Issue
Block a user