mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-09-19 09:49:21 +03:00
Cedar: prepare Proto for UDP support
- An additional parameter is added to IsPacketForMe(), used to specify the protocol type (currently either TCP or UDP). - SupportedModes() is dropped because it's now redundant. - IsOk() and EstablishedSessions() are dropped because error checking should be handled by the implementation. - ProtoImplDetect() now takes a buffer and its size rather than a SOCK, so that it can be used to detect UDP protocols. - The OpenVPN toggle check is moved to ProtoImplDetect(), so that we don't have to duplicate it once UDP support is implemented.
This commit is contained in:
@ -7,8 +7,12 @@
|
||||
|
||||
#define PROTO_TCP_BUFFER_SIZE (128 * 1024)
|
||||
|
||||
#define PROTO_MODE_TCP 1
|
||||
#define PROTO_MODE_UDP 2
|
||||
typedef enum PROTO_MODE
|
||||
{
|
||||
PROTO_MODE_UNKNOWN = 0,
|
||||
PROTO_MODE_TCP = 1,
|
||||
PROTO_MODE_UDP = 2
|
||||
} PROTO_MODE;
|
||||
|
||||
typedef struct PROTO
|
||||
{
|
||||
@ -21,12 +25,9 @@ typedef struct PROTO_IMPL
|
||||
bool (*Init)(void **param, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se);
|
||||
void (*Free)(void *param);
|
||||
char *(*Name)();
|
||||
UINT (*SupportedModes)();
|
||||
bool (*IsPacketForMe)(const UCHAR *data, const UINT size);
|
||||
bool (*IsPacketForMe)(const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
bool (*ProcessData)(void *param, TCP_RAW_DATA *received_data, FIFO *data_to_send);
|
||||
void (*BufferLimit)(void *param, const bool reached);
|
||||
bool (*IsOk)(void *param);
|
||||
UINT (*EstablishedSessions)(void *param);
|
||||
} PROTO_IMPL;
|
||||
|
||||
int ProtoImplCompare(void *p1, void *p2);
|
||||
@ -35,7 +36,7 @@ PROTO *ProtoNew(CEDAR *cedar);
|
||||
void ProtoDelete(PROTO *proto);
|
||||
|
||||
bool ProtoImplAdd(PROTO *proto, PROTO_IMPL *impl);
|
||||
PROTO_IMPL *ProtoImplDetect(PROTO *proto, SOCK *sock);
|
||||
PROTO_IMPL *ProtoImplDetect(PROTO *proto, const PROTO_MODE mode, const UCHAR *data, const UINT size);
|
||||
|
||||
bool ProtoHandleConnection(PROTO *proto, SOCK *sock);
|
||||
|
||||
|
Reference in New Issue
Block a user