diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-02 13:42:55 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-11-02 13:42:55 +0100 |
commit | 7a3c8bee42879add84a143ff98f28cbd0251dc7b (patch) | |
tree | 3138520bf3e16cd33fa03dfe68c1fedf67c3d901 /src/methods/null | |
parent | f2c2f2926bce65c5c09d274c514d382ffd98f78c (diff) | |
download | fastd-7a3c8bee42879add84a143ff98f28cbd0251dc7b.tar fastd-7a3c8bee42879add84a143ff98f28cbd0251dc7b.zip |
Allow flexible specification of methods provided by an implementation
Diffstat (limited to 'src/methods/null')
-rw-r--r-- | src/methods/null/null.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/methods/null/null.c b/src/methods/null/null.c index f49d94a..cba7931 100644 --- a/src/methods/null/null.c +++ b/src/methods/null/null.c @@ -33,6 +33,10 @@ struct fastd_method_session_state { }; +static bool method_provides(fastd_context_t *ctx UNUSED, const char *name) { + return !strcmp(name, "null"); +} + static size_t method_max_packet_size(fastd_context_t *ctx) { return fastd_max_packet_size(ctx); } @@ -45,7 +49,7 @@ static size_t method_key_length(fastd_context_t *ctx UNUSED) { return 0; } -static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx UNUSED, const uint8_t *secret UNUSED, bool initiator) { +static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx UNUSED, const char *name UNUSED, const uint8_t *secret UNUSED, bool initiator) { fastd_method_session_state_t *session = malloc(sizeof(fastd_method_session_state_t)); session->valid = true; @@ -54,8 +58,8 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx UN return session; } -static fastd_method_session_state_t* method_session_init_compat(fastd_context_t *ctx, const uint8_t *secret, size_t length UNUSED, bool initiator) { - return method_session_init(ctx, secret, initiator); +static fastd_method_session_state_t* method_session_init_compat(fastd_context_t *ctx, const char *name, const uint8_t *secret, size_t length UNUSED, bool initiator) { + return method_session_init(ctx, name, secret, initiator); } static bool method_session_is_valid(fastd_context_t *ctx UNUSED, fastd_method_session_state_t *session) { @@ -84,7 +88,7 @@ static bool method_passthrough(fastd_context_t *ctx UNUSED, fastd_peer_t *peer U } const fastd_method_t fastd_method_null = { - .name = "null", + .provides = method_provides, .max_packet_size = method_max_packet_size, .min_encrypt_head_space = method_min_head_tail_space, |