1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-06 07:44:57 +03:00

Cedar: introduce options API in Proto

PROTO_OPTION is a structure that describes an option (who would've guessed?).

It's designed in a way that allows it to occupy as low memory as possible, while providing great flexibility.

The idea is similar to the one implemented in LIST for trivial types, with the difference that PROTO_OPTION doesn't require casting due to the use of union.
This commit is contained in:
Davide Beatrici
2020-07-20 02:03:44 +02:00
parent 8685fe0da1
commit 6d85fffdb5
6 changed files with 179 additions and 12 deletions

View File

@ -21,6 +21,7 @@ const PROTO_IMPL *SstpGetProtoImpl()
static const PROTO_IMPL impl =
{
SstpName,
SstpOptions,
SstpInit,
SstpFree,
NULL,
@ -36,9 +37,19 @@ const char *SstpName()
return "SSTP";
}
bool SstpInit(void **param, struct CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname)
const PROTO_OPTION *SstpOptions()
{
if (param == NULL || cedar == NULL || im == NULL || se == NULL)
static const PROTO_OPTION options[] =
{
{ .Name = NULL, .Type = PROTO_OPTION_UNKNOWN }
};
return options;
}
bool SstpInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname)
{
if (param == NULL || options == NULL || cedar == NULL || im == NULL || se == NULL)
{
return false;
}