tnc-pdp: Initialize TNC-PDP in plugin callback with proper dependencies
This commit is contained in:
@@ -48,12 +48,37 @@ METHOD(plugin_t, get_name, char*,
|
|||||||
return "tnc-pdp";
|
return "tnc-pdp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register listener
|
||||||
|
*/
|
||||||
|
static bool plugin_cb(private_tnc_pdp_plugin_t *this,
|
||||||
|
plugin_feature_t *feature, bool reg, void *cb_data)
|
||||||
|
{
|
||||||
|
if (reg)
|
||||||
|
{
|
||||||
|
int port;
|
||||||
|
|
||||||
|
port = lib->settings->get_int(lib->settings,
|
||||||
|
"%s.plugins.tnc_pdp.port", RADIUS_PORT, charon->name);
|
||||||
|
this->pdp = tnc_pdp_create(port);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DESTROY_IF(this->pdp);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(plugin_t, get_features, int,
|
METHOD(plugin_t, get_features, int,
|
||||||
private_tnc_pdp_plugin_t *this, plugin_feature_t *features[])
|
private_tnc_pdp_plugin_t *this, plugin_feature_t *features[])
|
||||||
{
|
{
|
||||||
static plugin_feature_t f[] = {
|
static plugin_feature_t f[] = {
|
||||||
|
PLUGIN_CALLBACK((plugin_feature_callback_t)plugin_cb, NULL),
|
||||||
PLUGIN_PROVIDE(CUSTOM, "tnc-pdp"),
|
PLUGIN_PROVIDE(CUSTOM, "tnc-pdp"),
|
||||||
PLUGIN_DEPENDS(CUSTOM, "imv-manager"),
|
PLUGIN_DEPENDS(CUSTOM, "imv-manager"),
|
||||||
|
PLUGIN_DEPENDS(HASHER, HASH_MD5),
|
||||||
|
PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_MD5_128),
|
||||||
|
PLUGIN_DEPENDS(NONCE_GEN),
|
||||||
};
|
};
|
||||||
*features = f;
|
*features = f;
|
||||||
return countof(f);
|
return countof(f);
|
||||||
@@ -62,7 +87,6 @@ METHOD(plugin_t, get_features, int,
|
|||||||
METHOD(plugin_t, destroy, void,
|
METHOD(plugin_t, destroy, void,
|
||||||
private_tnc_pdp_plugin_t *this)
|
private_tnc_pdp_plugin_t *this)
|
||||||
{
|
{
|
||||||
DESTROY_IF(this->pdp);
|
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,10 +96,6 @@ METHOD(plugin_t, destroy, void,
|
|||||||
plugin_t *tnc_pdp_plugin_create()
|
plugin_t *tnc_pdp_plugin_create()
|
||||||
{
|
{
|
||||||
private_tnc_pdp_plugin_t *this;
|
private_tnc_pdp_plugin_t *this;
|
||||||
int port;
|
|
||||||
|
|
||||||
port = lib->settings->get_int(lib->settings,
|
|
||||||
"%s.plugins.tnc_pdp.port", RADIUS_PORT, charon->name);
|
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
@@ -85,7 +105,6 @@ plugin_t *tnc_pdp_plugin_create()
|
|||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.pdp = tnc_pdp_create(port),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
Reference in New Issue
Block a user