aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2011-10-20 22:06:10 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-10-25 01:10:16 +0200
commitc008d2cc4618ff5afcb8ea8b8ff7e756545e4c47 (patch)
treee4801e2498c8b377b513c612cf123ea52d58ca7c /src/libcharon/plugins
parentf0fa002fd186a375a5924bce7e779535febd57d6 (diff)
downloadstrongswan-c008d2cc4618ff5afcb8ea8b8ff7e756545e4c47.tar.bz2
strongswan-c008d2cc4618ff5afcb8ea8b8ff7e756545e4c47.tar.xz
moved imv_manager to libtnccs
Diffstat (limited to 'src/libcharon/plugins')
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c64
-rw-r--r--src/libcharon/plugins/tnccs_11/tnccs_11.c10
-rw-r--r--src/libcharon/plugins/tnccs_20/tnccs_20.c10
3 files changed, 62 insertions, 22 deletions
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c b/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
index 45cf95c1b..bec151047 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_plugin.c
@@ -24,13 +24,31 @@
#include <errno.h>
#include <fcntl.h>
-#include <daemon.h>
#include <utils/lexparser.h>
+#include <debug.h>
+
+typedef struct private_tnc_imv_plugin_t private_tnc_imv_plugin_t;
+
+/**
+ * Private data of a tnc_imv_plugin_t object.
+ */
+struct private_tnc_imv_plugin_t {
+
+ /**
+ * Public interface.
+ */
+ tnc_imv_plugin_t public;
+
+ /**
+ * TNC IMV manager controlling Integrity Measurement Verifiers
+ */
+ imv_manager_t *imvs;
+};
/**
* load IMVs from a configuration file
*/
-static bool load_imvs(char *filename)
+static bool load_imvs(private_tnc_imv_plugin_t *this, char *filename)
{
int fd, line_nr = 0;
chunk_t src, line;
@@ -128,7 +146,7 @@ static bool load_imvs(char *filename)
free(path);
return FALSE;
}
- if (!charon->imvs->add(charon->imvs, imv))
+ if (!this->imvs->add(this->imvs, imv))
{
if (imv->terminate &&
imv->terminate(imv->get_id(imv)) != TNC_RESULT_SUCCESS)
@@ -153,10 +171,21 @@ METHOD(plugin_t, get_name, char*,
return "tnc-imv";
}
+METHOD(plugin_t, get_features, int,
+ private_tnc_imv_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_PROVIDE(CUSTOM, "imv-manager"),
+ };
+ *features = f;
+ return countof(f);
+}
+
METHOD(plugin_t, destroy, void,
tnc_imv_plugin_t *this)
{
- charon->imvs->destroy(charon->imvs);
+ lib->set(lib, "imv-manager", NULL);
+ this->imvs->destroy(this->imvs);
free(this);
}
@@ -169,27 +198,26 @@ plugin_t *tnc_imv_plugin_create()
tnc_imv_plugin_t *this;
INIT(this,
- .plugin = {
- .get_name = _get_name,
- .reload = (void*)return_false,
- .destroy = _destroy,
+ .public = {
+ .plugin = {
+ .get_name = _get_name,
+ .get_features = _get_features,
+ .destroy = _destroy,
+ },
},
+ .imvs = tnc_imv_manager_create(),
);
- tnc_config = lib->settings->get_str(lib->settings,
- "charon.plugins.tnc-imv.tnc_config", "/etc/tnc_config");
-
- /* Create IMV manager */
- charon->imvs = tnc_imv_manager_create();
+ lib->set(lib, "imv-manager", this->imvs);
/* Load IMVs and abort if not all instances initalize successfully */
- if (!load_imvs(tnc_config))
+ tnc_config = lib->settings->get_str(lib->settings,
+ "charon.plugins.tnc-imv.tnc_config", "/etc/tnc_config");
+ if (!load_imvs(this, tnc_config))
{
- charon->imvs->destroy(charon->imvs);
- charon->imvs = NULL;
- free(this);
+ destroy(this);
return NULL;
}
- return &this->plugin;
+ return &this->public.plugin;
}
diff --git a/src/libcharon/plugins/tnccs_11/tnccs_11.c b/src/libcharon/plugins/tnccs_11/tnccs_11.c
index c7f96731e..4000ae2be 100644
--- a/src/libcharon/plugins/tnccs_11/tnccs_11.c
+++ b/src/libcharon/plugins/tnccs_11/tnccs_11.c
@@ -99,6 +99,11 @@ struct private_tnccs_11_t {
*/
imc_manager_t *imcs;
+ /**
+ * TNC IMV manager controlling Integrity Measurement Verifiers
+ */
+ imc_manager_t *imvs;
+
};
METHOD(tnccs_t, send_msg, TNC_Result,
@@ -181,7 +186,7 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
this->send_msg = TRUE;
if (this->is_server)
{
- charon->imvs->receive_message(charon->imvs,
+ this->imvs->receive_message(this->imvs,
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
}
else
@@ -343,7 +348,7 @@ METHOD(tls_t, process, status_t,
this->send_msg = TRUE;
if (this->is_server)
{
- charon->imvs->batch_ending(charon->imvs, this->connection_id);
+ this->imvs->batch_ending(this->imvs, this->connection_id);
}
else
{
@@ -540,6 +545,7 @@ tls_t *tnccs_11_create(bool is_server)
.is_server = is_server,
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.imcs = lib->get(lib, "imc-manager"),
+ .imvs = lib->get(lib, "imv-manager"),
);
return &this->public;
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c
index c9e62e093..d3a560f6f 100644
--- a/src/libcharon/plugins/tnccs_20/tnccs_20.c
+++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c
@@ -99,6 +99,11 @@ struct private_tnccs_20_t {
*/
imc_manager_t *imcs;
+ /**
+ * TNC IMV manager controlling Integrity Measurement Verifiers
+ */
+ imv_manager_t *imvs;
+
};
METHOD(tnccs_t, send_msg, TNC_Result,
@@ -198,7 +203,7 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
this->send_msg = TRUE;
if (this->is_server)
{
- charon->imvs->receive_message(charon->imvs,
+ this->imvs->receive_message(this->imvs,
this->connection_id, msg_body.ptr, msg_body.len, msg_type);
}
else
@@ -447,7 +452,7 @@ METHOD(tls_t, process, status_t,
this->send_msg = TRUE;
if (this->is_server)
{
- charon->imvs->batch_ending(charon->imvs, this->connection_id);
+ this->imvs->batch_ending(this->imvs, this->connection_id);
}
else
{
@@ -740,6 +745,7 @@ tls_t *tnccs_20_create(bool is_server)
.state_machine = pb_tnc_state_machine_create(is_server),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
.imcs = lib->get(lib, "imc-manager"),
+ .imvs = lib->get(lib, "imv-manager"),
);
return &this->public;