Add features support to eap-md5 plugin

This commit is contained in:
Andreas Steffen
2011-10-14 17:31:16 +02:00
parent e0f4f26ded
commit 6022b1558a
+18 -10
View File
@@ -24,13 +24,26 @@ METHOD(plugin_t, get_name, char*,
return "eap-md5";
}
METHOD(plugin_t, get_features, int,
eap_md5_plugin_t *this, plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
PLUGIN_CALLBACK(eap_method_register, eap_md5_create_server),
PLUGIN_PROVIDE(EAP_SERVER, EAP_MD5),
PLUGIN_DEPENDS(HASHER, HASH_MD5),
PLUGIN_DEPENDS(RNG, RNG_WEAK),
PLUGIN_CALLBACK(eap_method_register, eap_md5_create_peer),
PLUGIN_PROVIDE(EAP_PEER, EAP_MD5),
PLUGIN_DEPENDS(HASHER, HASH_MD5),
PLUGIN_DEPENDS(RNG, RNG_WEAK),
};
*features = f;
return countof(f);
}
METHOD(plugin_t, destroy, void,
eap_md5_plugin_t *this)
{
charon->eap->remove_method(charon->eap,
(eap_constructor_t)eap_md5_create_server);
charon->eap->remove_method(charon->eap,
(eap_constructor_t)eap_md5_create_peer);
free(this);
}
@@ -44,16 +57,11 @@ plugin_t *eap_md5_plugin_create()
INIT(this,
.plugin = {
.get_name = _get_name,
.reload = (void*)return_false,
.get_features = _get_features,
.destroy = _destroy,
},
);
charon->eap->add_method(charon->eap, EAP_MD5, 0, EAP_SERVER,
(eap_constructor_t)eap_md5_create_server);
charon->eap->add_method(charon->eap, EAP_MD5, 0, EAP_PEER,
(eap_constructor_t)eap_md5_create_peer);
return &this->plugin;
}