Migrated remaining plugin_t implementations to INIT/METHOD macros
This commit is contained in:
@@ -20,10 +20,8 @@
|
|||||||
|
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
eap_aka_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(eap_aka_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->eap->remove_method(charon->eap,
|
charon->eap->remove_method(charon->eap,
|
||||||
(eap_constructor_t)eap_aka_server_create);
|
(eap_constructor_t)eap_aka_server_create);
|
||||||
@@ -37,9 +35,13 @@ static void destroy(eap_aka_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_aka_plugin_create()
|
plugin_t *eap_aka_plugin_create()
|
||||||
{
|
{
|
||||||
eap_aka_plugin_t *this = malloc_thing(eap_aka_plugin_t);
|
eap_aka_plugin_t *this;
|
||||||
|
|
||||||
this->plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
charon->eap->add_method(charon->eap, EAP_AKA, 0, EAP_SERVER,
|
charon->eap->add_method(charon->eap, EAP_AKA, 0, EAP_SERVER,
|
||||||
(eap_constructor_t)eap_aka_server_create);
|
(eap_constructor_t)eap_aka_server_create);
|
||||||
|
|||||||
@@ -48,10 +48,8 @@ struct private_eap_aka_3gpp2_t {
|
|||||||
eap_aka_3gpp2_functions_t *functions;
|
eap_aka_3gpp2_functions_t *functions;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of eap_aka_3gpp2_t.destroy.
|
private_eap_aka_3gpp2_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_aka_3gpp2_t *this)
|
|
||||||
{
|
{
|
||||||
charon->sim->remove_card(charon->sim, &this->card->card);
|
charon->sim->remove_card(charon->sim, &this->card->card);
|
||||||
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
||||||
@@ -66,11 +64,17 @@ static void destroy(private_eap_aka_3gpp2_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_aka_3gpp2_plugin_create()
|
plugin_t *eap_aka_3gpp2_plugin_create()
|
||||||
{
|
{
|
||||||
private_eap_aka_3gpp2_t *this = malloc_thing(private_eap_aka_3gpp2_t);
|
private_eap_aka_3gpp2_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
this->functions = eap_aka_3gpp2_functions_create();
|
||||||
|
);
|
||||||
|
|
||||||
this->functions = eap_aka_3gpp2_functions_create();
|
|
||||||
if (!this->functions)
|
if (!this->functions)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
|
|||||||
@@ -22,10 +22,8 @@
|
|||||||
/* missing in cababilities.h */
|
/* missing in cababilities.h */
|
||||||
#define CAP_AUDIT_WRITE 29
|
#define CAP_AUDIT_WRITE 29
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
eap_gtc_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(eap_gtc_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->eap->remove_method(charon->eap,
|
charon->eap->remove_method(charon->eap,
|
||||||
(eap_constructor_t)eap_gtc_create_server);
|
(eap_constructor_t)eap_gtc_create_server);
|
||||||
@@ -39,9 +37,13 @@ static void destroy(eap_gtc_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_gtc_plugin_create()
|
plugin_t *eap_gtc_plugin_create()
|
||||||
{
|
{
|
||||||
eap_gtc_plugin_t *this = malloc_thing(eap_gtc_plugin_t);
|
eap_gtc_plugin_t *this;
|
||||||
|
|
||||||
this->plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
/* required for PAM authentication */
|
/* required for PAM authentication */
|
||||||
charon->keep_cap(charon, CAP_AUDIT_WRITE);
|
charon->keep_cap(charon, CAP_AUDIT_WRITE);
|
||||||
|
|||||||
@@ -19,10 +19,8 @@
|
|||||||
|
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
eap_mschapv2_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(eap_mschapv2_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->eap->remove_method(charon->eap,
|
charon->eap->remove_method(charon->eap,
|
||||||
(eap_constructor_t)eap_mschapv2_create_server);
|
(eap_constructor_t)eap_mschapv2_create_server);
|
||||||
@@ -36,9 +34,13 @@ static void destroy(eap_mschapv2_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_mschapv2_plugin_create()
|
plugin_t *eap_mschapv2_plugin_create()
|
||||||
{
|
{
|
||||||
eap_mschapv2_plugin_t *this = malloc_thing(eap_mschapv2_plugin_t);
|
eap_mschapv2_plugin_t *this;
|
||||||
|
|
||||||
this->plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
charon->eap->add_method(charon->eap, EAP_MSCHAPV2, 0, EAP_SERVER,
|
charon->eap->add_method(charon->eap, EAP_MSCHAPV2, 0, EAP_SERVER,
|
||||||
(eap_constructor_t)eap_mschapv2_create_server);
|
(eap_constructor_t)eap_mschapv2_create_server);
|
||||||
|
|||||||
@@ -20,10 +20,8 @@
|
|||||||
|
|
||||||
#include <daemon.h>
|
#include <daemon.h>
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
eap_sim_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(eap_sim_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->eap->remove_method(charon->eap,
|
charon->eap->remove_method(charon->eap,
|
||||||
(eap_constructor_t)eap_sim_server_create);
|
(eap_constructor_t)eap_sim_server_create);
|
||||||
@@ -37,9 +35,13 @@ static void destroy(eap_sim_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_sim_plugin_create()
|
plugin_t *eap_sim_plugin_create()
|
||||||
{
|
{
|
||||||
eap_sim_plugin_t *this = malloc_thing(eap_sim_plugin_t);
|
eap_sim_plugin_t *this;
|
||||||
|
|
||||||
this->plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
charon->eap->add_method(charon->eap, EAP_SIM, 0, EAP_SERVER,
|
charon->eap->add_method(charon->eap, EAP_SIM, 0, EAP_SERVER,
|
||||||
(eap_constructor_t)eap_sim_server_create);
|
(eap_constructor_t)eap_sim_server_create);
|
||||||
|
|||||||
@@ -50,10 +50,8 @@ struct private_eap_sim_file_t {
|
|||||||
eap_sim_file_triplets_t *triplets;
|
eap_sim_file_triplets_t *triplets;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of eap_sim_file_t.destroy.
|
private_eap_sim_file_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_sim_file_t *this)
|
|
||||||
{
|
{
|
||||||
charon->sim->remove_card(charon->sim, &this->card->card);
|
charon->sim->remove_card(charon->sim, &this->card->card);
|
||||||
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
||||||
@@ -68,12 +66,18 @@ static void destroy(private_eap_sim_file_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_sim_file_plugin_create()
|
plugin_t *eap_sim_file_plugin_create()
|
||||||
{
|
{
|
||||||
private_eap_sim_file_t *this = malloc_thing(private_eap_sim_file_t);
|
private_eap_sim_file_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.triplets = eap_sim_file_triplets_create(TRIPLET_FILE),
|
||||||
|
.provider = eap_sim_file_provider_create(this->triplets),
|
||||||
|
);
|
||||||
|
|
||||||
this->triplets = eap_sim_file_triplets_create(TRIPLET_FILE);
|
|
||||||
this->provider = eap_sim_file_provider_create(this->triplets);
|
|
||||||
if (!this->provider)
|
if (!this->provider)
|
||||||
{
|
{
|
||||||
this->triplets->destroy(this->triplets);
|
this->triplets->destroy(this->triplets);
|
||||||
|
|||||||
@@ -42,10 +42,8 @@ struct private_eap_simaka_pseudonym_t {
|
|||||||
eap_simaka_pseudonym_provider_t *provider;
|
eap_simaka_pseudonym_provider_t *provider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of eap_simaka_pseudonym_t.destroy.
|
private_eap_simaka_pseudonym_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_simaka_pseudonym_t *this)
|
|
||||||
{
|
{
|
||||||
charon->sim->remove_card(charon->sim, &this->card->card);
|
charon->sim->remove_card(charon->sim, &this->card->card);
|
||||||
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
||||||
@@ -61,11 +59,15 @@ plugin_t *eap_simaka_pseudonym_plugin_create()
|
|||||||
{
|
{
|
||||||
private_eap_simaka_pseudonym_t *this;
|
private_eap_simaka_pseudonym_t *this;
|
||||||
|
|
||||||
this = malloc_thing(private_eap_simaka_pseudonym_t);
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.provider = eap_simaka_pseudonym_provider_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
|
||||||
|
|
||||||
this->provider = eap_simaka_pseudonym_provider_create();
|
|
||||||
if (!this->provider)
|
if (!this->provider)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
|
|||||||
@@ -42,10 +42,8 @@ struct private_eap_simaka_reauth_t {
|
|||||||
eap_simaka_reauth_provider_t *provider;
|
eap_simaka_reauth_provider_t *provider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of eap_simaka_reauth_t.destroy.
|
private_eap_simaka_reauth_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_eap_simaka_reauth_t *this)
|
|
||||||
{
|
{
|
||||||
charon->sim->remove_card(charon->sim, &this->card->card);
|
charon->sim->remove_card(charon->sim, &this->card->card);
|
||||||
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
charon->sim->remove_provider(charon->sim, &this->provider->provider);
|
||||||
@@ -59,11 +57,17 @@ static void destroy(private_eap_simaka_reauth_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *eap_simaka_reauth_plugin_create()
|
plugin_t *eap_simaka_reauth_plugin_create()
|
||||||
{
|
{
|
||||||
private_eap_simaka_reauth_t *this = malloc_thing(private_eap_simaka_reauth_t);
|
private_eap_simaka_reauth_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.provider = eap_simaka_reauth_provider_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->provider = eap_simaka_reauth_provider_create();
|
|
||||||
if (!this->provider)
|
if (!this->provider)
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
|
|||||||
@@ -146,10 +146,8 @@ static job_requeue_t do_load_test(private_load_tester_plugin_t *this)
|
|||||||
return JOB_REQUEUE_NONE;
|
return JOB_REQUEUE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_load_tester_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_load_tester_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
this->iterations = -1;
|
this->iterations = -1;
|
||||||
this->mutex->lock(this->mutex);
|
this->mutex->lock(this->mutex);
|
||||||
@@ -188,32 +186,37 @@ plugin_t *load_tester_plugin_create()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this = malloc_thing(private_load_tester_plugin_t);
|
INIT(this,
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.delay = lib->settings->get_int(lib->settings,
|
||||||
|
"charon.plugins.load-tester.delay", 0),
|
||||||
|
.iterations = lib->settings->get_int(lib->settings,
|
||||||
|
"charon.plugins.load-tester.iterations", 1),
|
||||||
|
.initiators = lib->settings->get_int(lib->settings,
|
||||||
|
"charon.plugins.load-tester.initiators", 0),
|
||||||
|
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
|
||||||
|
.condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
|
||||||
|
.config = load_tester_config_create(),
|
||||||
|
.creds = load_tester_creds_create(),
|
||||||
|
.listener = load_tester_listener_create(shutdown_on),
|
||||||
|
);
|
||||||
|
|
||||||
lib->crypto->add_dh(lib->crypto, MODP_NULL, plugin_name,
|
lib->crypto->add_dh(lib->crypto, MODP_NULL, plugin_name,
|
||||||
(dh_constructor_t)load_tester_diffie_hellman_create);
|
(dh_constructor_t)load_tester_diffie_hellman_create);
|
||||||
|
charon->backends->add_backend(charon->backends, &this->config->backend);
|
||||||
|
lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);
|
||||||
|
charon->bus->add_listener(charon->bus, &this->listener->listener);
|
||||||
|
|
||||||
this->delay = lib->settings->get_int(lib->settings,
|
|
||||||
"charon.plugins.load-tester.delay", 0);
|
|
||||||
this->iterations = lib->settings->get_int(lib->settings,
|
|
||||||
"charon.plugins.load-tester.iterations", 1);
|
|
||||||
this->initiators = lib->settings->get_int(lib->settings,
|
|
||||||
"charon.plugins.load-tester.initiators", 0);
|
|
||||||
if (lib->settings->get_bool(lib->settings,
|
if (lib->settings->get_bool(lib->settings,
|
||||||
"charon.plugins.load-tester.shutdown_when_complete", 0))
|
"charon.plugins.load-tester.shutdown_when_complete", 0))
|
||||||
{
|
{
|
||||||
shutdown_on = this->iterations * this->initiators;
|
shutdown_on = this->iterations * this->initiators;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
|
|
||||||
this->condvar = condvar_create(CONDVAR_TYPE_DEFAULT);
|
|
||||||
this->config = load_tester_config_create();
|
|
||||||
this->creds = load_tester_creds_create();
|
|
||||||
this->listener = load_tester_listener_create(shutdown_on);
|
|
||||||
charon->backends->add_backend(charon->backends, &this->config->backend);
|
|
||||||
lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);
|
|
||||||
charon->bus->add_listener(charon->bus, &this->listener->listener);
|
|
||||||
|
|
||||||
if (lib->settings->get_bool(lib->settings,
|
if (lib->settings->get_bool(lib->settings,
|
||||||
"charon.plugins.load-tester.fake_kernel", FALSE))
|
"charon.plugins.load-tester.fake_kernel", FALSE))
|
||||||
|
|||||||
@@ -54,10 +54,8 @@ struct private_medcli_plugin_t {
|
|||||||
medcli_listener_t *listener;
|
medcli_listener_t *listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_medcli_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_medcli_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->bus->remove_listener(charon->bus, &this->listener->listener);
|
charon->bus->remove_listener(charon->bus, &this->listener->listener);
|
||||||
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
||||||
@@ -75,9 +73,15 @@ static void destroy(private_medcli_plugin_t *this)
|
|||||||
plugin_t *medcli_plugin_create()
|
plugin_t *medcli_plugin_create()
|
||||||
{
|
{
|
||||||
char *uri;
|
char *uri;
|
||||||
private_medcli_plugin_t *this = malloc_thing(private_medcli_plugin_t);
|
private_medcli_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
uri = lib->settings->get_str(lib->settings,
|
uri = lib->settings->get_str(lib->settings,
|
||||||
"medcli.database", NULL);
|
"medcli.database", NULL);
|
||||||
|
|||||||
@@ -48,10 +48,8 @@ struct private_medsrv_plugin_t {
|
|||||||
medsrv_config_t *config;
|
medsrv_config_t *config;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_medsrv_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_medsrv_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
||||||
lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
|
lib->credmgr->remove_set(lib->credmgr, &this->creds->set);
|
||||||
@@ -67,9 +65,15 @@ static void destroy(private_medsrv_plugin_t *this)
|
|||||||
plugin_t *medsrv_plugin_create()
|
plugin_t *medsrv_plugin_create()
|
||||||
{
|
{
|
||||||
char *uri;
|
char *uri;
|
||||||
private_medsrv_plugin_t *this = malloc_thing(private_medsrv_plugin_t);
|
private_medsrv_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
uri = lib->settings->get_str(lib->settings,
|
uri = lib->settings->get_str(lib->settings,
|
||||||
"medsrv.database", NULL);
|
"medsrv.database", NULL);
|
||||||
|
|||||||
@@ -67,10 +67,8 @@ static job_requeue_t run(private_nm_plugin_t *this)
|
|||||||
return JOB_REQUEUE_NONE;
|
return JOB_REQUEUE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_nm_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_nm_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
if (this->loop)
|
if (this->loop)
|
||||||
{
|
{
|
||||||
@@ -96,22 +94,27 @@ static void destroy(private_nm_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *nm_plugin_create()
|
plugin_t *nm_plugin_create()
|
||||||
{
|
{
|
||||||
private_nm_plugin_t *this = malloc_thing(private_nm_plugin_t);
|
private_nm_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
|
||||||
|
|
||||||
this->loop = NULL;
|
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
if (!g_thread_supported())
|
if (!g_thread_supported())
|
||||||
{
|
{
|
||||||
g_thread_init(NULL);
|
g_thread_init(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->creds = nm_creds_create();
|
INIT(this,
|
||||||
this->handler = nm_handler_create();
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.creds = nm_creds_create(),
|
||||||
|
.handler = nm_handler_create(),
|
||||||
|
.plugin = nm_strongswan_plugin_new(this->creds, this->handler),
|
||||||
|
);
|
||||||
|
|
||||||
hydra->attributes->add_handler(hydra->attributes, &this->handler->handler);
|
hydra->attributes->add_handler(hydra->attributes, &this->handler->handler);
|
||||||
lib->credmgr->add_set(lib->credmgr, &this->creds->set);
|
lib->credmgr->add_set(lib->credmgr, &this->creds->set);
|
||||||
this->plugin = nm_strongswan_plugin_new(this->creds, this->handler);
|
|
||||||
if (!this->plugin)
|
if (!this->plugin)
|
||||||
{
|
{
|
||||||
DBG1(DBG_CFG, "DBUS binding failed");
|
DBG1(DBG_CFG, "DBUS binding failed");
|
||||||
|
|||||||
@@ -707,10 +707,8 @@ static job_requeue_t dispatch(private_smp_t *this)
|
|||||||
return JOB_REQUEUE_DIRECT;
|
return JOB_REQUEUE_DIRECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of itnerface_t.destroy.
|
private_smp_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_smp_t *this)
|
|
||||||
{
|
{
|
||||||
this->job->cancel(this->job);
|
this->job->cancel(this->job);
|
||||||
close(this->socket);
|
close(this->socket);
|
||||||
@@ -723,10 +721,16 @@ static void destroy(private_smp_t *this)
|
|||||||
plugin_t *smp_plugin_create()
|
plugin_t *smp_plugin_create()
|
||||||
{
|
{
|
||||||
struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
|
struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
|
||||||
private_smp_t *this = malloc_thing(private_smp_t);
|
private_smp_t *this;
|
||||||
mode_t old;
|
mode_t old;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void (*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
/* set up unix socket */
|
/* set up unix socket */
|
||||||
this->socket = socket(AF_UNIX, SOCK_STREAM, 0);
|
this->socket = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
|||||||
@@ -58,10 +58,8 @@ struct private_uci_plugin_t {
|
|||||||
uci_control_t *control;
|
uci_control_t *control;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_uci_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_uci_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
charon->backends->remove_backend(charon->backends, &this->config->backend);
|
||||||
lib->credmgr->remove_set(lib->credmgr, &this->creds->credential_set);
|
lib->credmgr->remove_set(lib->credmgr, &this->creds->credential_set);
|
||||||
@@ -77,14 +75,20 @@ static void destroy(private_uci_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *uci_plugin_create()
|
plugin_t *uci_plugin_create()
|
||||||
{
|
{
|
||||||
private_uci_plugin_t *this = malloc_thing(private_uci_plugin_t);
|
private_uci_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.parser = uci_parser_create(UCI_PACKAGE),
|
||||||
|
.config = uci_config_create(this->parser),
|
||||||
|
.creds = uci_creds_create(this->parser),
|
||||||
|
.control = uci_control_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->parser = uci_parser_create(UCI_PACKAGE);
|
|
||||||
this->config = uci_config_create(this->parser);
|
|
||||||
this->creds = uci_creds_create(this->parser);
|
|
||||||
this->control = uci_control_create();
|
|
||||||
charon->backends->add_backend(charon->backends, &this->config->backend);
|
charon->backends->add_backend(charon->backends, &this->config->backend);
|
||||||
lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);
|
lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,8 @@ static void run_tests(private_unit_tester_t *this)
|
|||||||
success, run, failed, skipped);
|
success, run, failed, skipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of 2007_t.destroy
|
private_unit_tester_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_unit_tester_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -105,9 +103,15 @@ static void destroy(private_unit_tester_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *unit_tester_plugin_create()
|
plugin_t *unit_tester_plugin_create()
|
||||||
{
|
{
|
||||||
private_unit_tester_t *this = malloc_thing(private_unit_tester_t);
|
private_unit_tester_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
run_tests(this);
|
run_tests(this);
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ struct private_updown_plugin_t {
|
|||||||
updown_listener_t *listener;
|
updown_listener_t *listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
METHOD(plugin_t, destroy, void,
|
||||||
* Implementation of plugin_t.destroy
|
private_updown_plugin_t *this)
|
||||||
*/
|
|
||||||
static void destroy(private_updown_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
charon->bus->remove_listener(charon->bus, &this->listener->listener);
|
charon->bus->remove_listener(charon->bus, &this->listener->listener);
|
||||||
this->listener->destroy(this->listener);
|
this->listener->destroy(this->listener);
|
||||||
@@ -51,11 +49,17 @@ static void destroy(private_updown_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *updown_plugin_create()
|
plugin_t *updown_plugin_create()
|
||||||
{
|
{
|
||||||
private_updown_plugin_t *this = malloc_thing(private_updown_plugin_t);
|
private_updown_plugin_t *this;
|
||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.public = {
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
.listener = updown_listener_create(),
|
||||||
|
);
|
||||||
|
|
||||||
this->listener = updown_listener_create();
|
|
||||||
charon->bus->add_listener(charon->bus, &this->listener->listener);
|
charon->bus->add_listener(charon->bus, &this->listener->listener);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ plugin_loader_t *plugin_loader_create()
|
|||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.load = _load,
|
.load = _load_plugins,
|
||||||
.unload = _unload,
|
.unload = _unload,
|
||||||
.create_plugin_enumerator = _create_plugin_enumerator,
|
.create_plugin_enumerator = _create_plugin_enumerator,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
|
|||||||
@@ -18,10 +18,9 @@
|
|||||||
#include "xauth_plugin.h"
|
#include "xauth_plugin.h"
|
||||||
#include "xauth_default_provider.h"
|
#include "xauth_default_provider.h"
|
||||||
#include "xauth_default_verifier.h"
|
#include "xauth_default_verifier.h"
|
||||||
/**
|
|
||||||
* Implementation of plugin_t.destroy
|
METHOD(plugin_t, destroy, void,
|
||||||
*/
|
xauth_plugin_t *this)
|
||||||
static void destroy(xauth_plugin_t *this)
|
|
||||||
{
|
{
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
@@ -31,9 +30,13 @@ static void destroy(xauth_plugin_t *this)
|
|||||||
*/
|
*/
|
||||||
plugin_t *xauth_plugin_create()
|
plugin_t *xauth_plugin_create()
|
||||||
{
|
{
|
||||||
xauth_plugin_t *this = malloc_thing(xauth_plugin_t);
|
xauth_plugin_t *this;
|
||||||
|
|
||||||
this->plugin.destroy = (void(*)(plugin_t*))destroy;
|
INIT(this,
|
||||||
|
.plugin = {
|
||||||
|
.destroy = _destroy,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
pluto->xauth->add_provider(pluto->xauth, xauth_default_provider_create());
|
pluto->xauth->add_provider(pluto->xauth, xauth_default_provider_create());
|
||||||
pluto->xauth->add_verifier(pluto->xauth, xauth_default_verifier_create());
|
pluto->xauth->add_verifier(pluto->xauth, xauth_default_verifier_create());
|
||||||
|
|||||||
Reference in New Issue
Block a user