Added a get_name() function to plugin_t, create_plugin_enumerator enumerates over plugin_t

This commit is contained in:
Martin Willi
2011-04-15 10:07:12 +02:00
parent 6e2791715b
commit 787b5884aa
107 changed files with 828 additions and 245 deletions
@@ -92,7 +92,7 @@ static struct {
/**
* See header.
*/
void af_alg_crypter_probe()
void af_alg_crypter_probe(char *plugin)
{
encryption_algorithm_t prev = -1;
af_alg_ops_t *ops;
@@ -106,7 +106,7 @@ void af_alg_crypter_probe()
if (ops)
{
ops->destroy(ops);
lib->crypto->add_crypter(lib->crypto, algs[i].id, af_alg_plugin_name,
lib->crypto->add_crypter(lib->crypto, algs[i].id, plugin,
(crypter_constructor_t)af_alg_crypter_create);
}
}
@@ -48,7 +48,9 @@ af_alg_crypter_t *af_alg_crypter_create(encryption_algorithm_t algo,
/**
* Probe algorithms and register af_alg_crypter_create().
*
* @param plugin plugin name to register algorithms for
*/
void af_alg_crypter_probe();
void af_alg_crypter_probe(char *plugin);
#endif /** AF_ALG_CRYPTER_H_ @}*/
@@ -59,7 +59,7 @@ static struct {
/**
* See header.
*/
void af_alg_hasher_probe()
void af_alg_hasher_probe(char *plugin)
{
af_alg_ops_t *ops;
int i;
@@ -70,7 +70,7 @@ void af_alg_hasher_probe()
if (ops)
{
ops->destroy(ops);
lib->crypto->add_hasher(lib->crypto, algs[i].id, af_alg_plugin_name,
lib->crypto->add_hasher(lib->crypto, algs[i].id, plugin,
(hasher_constructor_t)af_alg_hasher_create);
}
}
@@ -46,7 +46,9 @@ af_alg_hasher_t *af_alg_hasher_create(hash_algorithm_t algo);
/**
* Probe algorithms and register af_alg_hasher_create().
*
* @param plugin plugin name to register algorithms for
*/
void af_alg_hasher_probe();
void af_alg_hasher_probe(char *plugin);
#endif /** af_alg_HASHER_H_ @}*/
@@ -21,8 +21,6 @@
#include <debug.h>
const char *af_alg_plugin_name = "af-alg";
typedef struct private_af_alg_ops_t private_af_alg_ops_t;
/**
@@ -33,8 +33,6 @@
#define SOL_ALG 279
#endif /* SOL_ALG */
extern const char *af_alg_plugin_name;
typedef struct af_alg_ops_t af_alg_ops_t;
/**
@@ -35,6 +35,12 @@ struct private_af_alg_plugin_t {
af_alg_plugin_t public;
};
METHOD(plugin_t, get_name, char*,
private_af_alg_plugin_t *this)
{
return "af-alg";
}
METHOD(plugin_t, destroy, void,
private_af_alg_plugin_t *this)
{
@@ -60,15 +66,16 @@ plugin_t *af_alg_plugin_create()
INIT(this,
.public = {
.plugin = {
.get_name = _get_name,
.destroy = _destroy,
},
},
);
af_alg_hasher_probe();
af_alg_signer_probe();
af_alg_prf_probe();
af_alg_crypter_probe();
af_alg_hasher_probe(get_name(this));
af_alg_signer_probe(get_name(this));
af_alg_prf_probe(get_name(this));
af_alg_crypter_probe(get_name(this));
return &this->public.plugin;
}
@@ -70,7 +70,7 @@ static struct {
/**
* See header.
*/
void af_alg_prf_probe()
void af_alg_prf_probe(char *plugin)
{
af_alg_ops_t *ops;
int i;
@@ -81,7 +81,7 @@ void af_alg_prf_probe()
if (ops)
{
ops->destroy(ops);
lib->crypto->add_prf(lib->crypto, algs[i].id, af_alg_plugin_name,
lib->crypto->add_prf(lib->crypto, algs[i].id, plugin,
(prf_constructor_t)af_alg_prf_create);
}
}
@@ -46,7 +46,9 @@ af_alg_prf_t *af_alg_prf_create(pseudo_random_function_t algo);
/**
* Probe algorithms and register af_alg_prf_create().
*
* @param plugin plugin name to register algorithms for
*/
void af_alg_prf_probe();
void af_alg_prf_probe(char *plugin);
#endif /** AF_ALG_PRF_H_ @}*/
@@ -71,7 +71,7 @@ static struct {
/**
* See header.
*/
void af_alg_signer_probe()
void af_alg_signer_probe(char *plugin)
{
af_alg_ops_t *ops;
int i;
@@ -82,7 +82,7 @@ void af_alg_signer_probe()
if (ops)
{
ops->destroy(ops);
lib->crypto->add_signer(lib->crypto, algs[i].id, af_alg_plugin_name,
lib->crypto->add_signer(lib->crypto, algs[i].id, plugin,
(signer_constructor_t)af_alg_signer_create);
}
}
@@ -46,7 +46,9 @@ af_alg_signer_t *af_alg_signer_create(integrity_algorithm_t algo);
/**
* Probe algorithms and register af_alg_signer_create().
*
* @param plugin plugin name to register algorithms for
*/
void af_alg_signer_probe();
void af_alg_signer_probe(char *plugin);
#endif /** AF_ALG_SIGNER_H_ @}*/