proposal: Add possibility to register custom proposal keyword parser
If a proposal string cannot be matched to a token using strcmp (e.g. if you want to register a whole class of algorithms containing their ID, like my_alg_2342), you can use the provided function to register a parser that transforms the given string into a proposal token. Signed-off-by: Thomas Egerer <[email protected]>
This commit is contained in:
committed by
Martin Willi
parent
303ec3956c
commit
568e302260
@@ -46,6 +46,8 @@
|
||||
typedef struct proposal_token_t proposal_token_t;
|
||||
typedef struct proposal_keywords_t proposal_keywords_t;
|
||||
|
||||
typedef proposal_token_t*(*proposal_algname_parser_t)(const char *algname);
|
||||
|
||||
#include <library.h>
|
||||
#include <crypto/transform.h>
|
||||
|
||||
@@ -101,6 +103,17 @@ struct proposal_keywords_t {
|
||||
transform_type_t type, u_int16_t algorithm,
|
||||
u_int16_t keysize);
|
||||
|
||||
/**
|
||||
* Register an algorithm name parser.
|
||||
*
|
||||
* It is meant to parse an algorithm name into a proposal token in a
|
||||
* generic, user defined way.
|
||||
*
|
||||
* @param parser a pointer to the parser function
|
||||
*/
|
||||
void (*register_algname_parser)(proposal_keywords_t *this,
|
||||
proposal_algname_parser_t parser);
|
||||
|
||||
/**
|
||||
* Destroy a proposal_keywords_t instance.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user