mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
Cedar: Improve IsPacketForMe()'s "data" argumment in PROTO_IMPL
This allows a protocol implementation to implicitly cast the variable to the type it prefers.
This commit is contained in:
parent
b339104f4f
commit
d8aa470192
@ -48,7 +48,7 @@ typedef struct PROTO_IMPL
|
||||
const PROTO_OPTION *(*Options)();
|
||||
bool (*Init)(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
void (*Free)(void *param);
|
||||
bool (*IsPacketForMe)(const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
bool (*IsPacketForMe)(const PROTO_MODE mode, const void *data, const UINT size);
|
||||
bool (*ProcessData)(void *param, TCP_RAW_DATA *in, FIFO *out);
|
||||
bool (*ProcessDatagrams)(void *param, LIST *in, LIST *out);
|
||||
} PROTO_IMPL;
|
||||
|
@ -69,16 +69,17 @@ void OvsFree(void *param)
|
||||
}
|
||||
|
||||
// Check whether it's an OpenVPN packet
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size)
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const void *data, const UINT size)
|
||||
{
|
||||
if (mode == PROTO_MODE_TCP)
|
||||
{
|
||||
if (data == NULL || size < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data[0] == 0x00 && data[1] == 0x0E)
|
||||
if (mode == PROTO_MODE_TCP)
|
||||
{
|
||||
const UCHAR *raw = data;
|
||||
if (raw[0] == 0x00 && raw[1] == 0x0E)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -215,11 +215,9 @@ const char *OvsName();
|
||||
const PROTO_OPTION *OvsOptions();
|
||||
bool OvsInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname);
|
||||
void OvsFree(void *param);
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
bool OvsIsPacketForMe(const PROTO_MODE mode, const void *data, const UINT size);
|
||||
bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out);
|
||||
bool OvsProcessDatagrams(void *param, LIST *in, LIST *out);
|
||||
bool OvsIsOk(void *param);
|
||||
UINT OvsEstablishedSessions(void *param);
|
||||
|
||||
OPENVPN_SERVER *NewOpenVpnServer(const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event);
|
||||
void FreeOpenVpnServer(OPENVPN_SERVER *s);
|
||||
|
Loading…
Reference in New Issue
Block a user