aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2011-10-20 21:12:29 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-10-25 01:10:16 +0200
commitf0fa002fd186a375a5924bce7e779535febd57d6 (patch)
tree9ecca156de311829a06b3bf44dace7ce31de2afb /src
parente4e96e5c679177e6e1ff3acfe35d8ff36da53903 (diff)
downloadstrongswan-f0fa002fd186a375a5924bce7e779535febd57d6.tar.bz2
strongswan-f0fa002fd186a375a5924bce7e779535febd57d6.tar.xz
moved imc_manager to libtnccs
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/libcharon/Makefile.am4
-rw-r--r--src/libcharon/daemon.h6
-rw-r--r--src/libcharon/plugins/tnc_imc/Makefile.am8
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc.h2
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c17
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc_manager.c2
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc_manager.h2
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c68
-rw-r--r--src/libcharon/plugins/tnccs_11/Makefile.am15
-rw-r--r--src/libcharon/plugins/tnccs_11/tnccs_11.c25
-rw-r--r--src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c2
-rw-r--r--src/libcharon/plugins/tnccs_20/Makefile.am14
-rw-r--r--src/libcharon/plugins/tnccs_20/tnccs_20.c29
-rw-r--r--src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c2
-rw-r--r--src/libcharon/tnc/tnccs/tnccs_manager.c17
-rw-r--r--src/libtnccs/Makefile.am10
-rw-r--r--src/libtnccs/imc/imc.h (renamed from src/libcharon/tnc/imc/imc.h)0
-rw-r--r--src/libtnccs/imc/imc_manager.h (renamed from src/libcharon/tnc/imc/imc_manager.h)4
19 files changed, 159 insertions, 72 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 33e1b1264..7f4651dcd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,6 +20,10 @@ if USE_LIBTNCIF
SUBDIRS += libtncif
endif
+if USE_TNCCS
+ SUBDIRS += libtnccs
+endif
+
if USE_PTS
SUBDIRS += libpts
endif
diff --git a/src/libcharon/Makefile.am b/src/libcharon/Makefile.am
index 371c787a1..6ddf41c53 100644
--- a/src/libcharon/Makefile.am
+++ b/src/libcharon/Makefile.am
@@ -87,7 +87,6 @@ sa/tasks/ike_reauth.c sa/tasks/ike_reauth.h \
sa/tasks/ike_auth_lifetime.c sa/tasks/ike_auth_lifetime.h \
sa/tasks/ike_vendor.c sa/tasks/ike_vendor.h \
sa/tasks/task.c sa/tasks/task.h \
-tnc/imc/imc.h tnc/imc/imc_manager.h \
tnc/imv/imv.h tnc/imv/imv_manager.h \
tnc/imv/imv_recommendations.c tnc/imv/imv_recommendations.h \
tnc/tnccs/tnccs.c tnc/tnccs/tnccs.h \
@@ -100,7 +99,8 @@ INCLUDES = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon \
- -I$(top_srcdir)/src/libtncif
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libtnccs
AM_CFLAGS = \
-DIPSEC_DIR=\"${ipsecdir}\" \
diff --git a/src/libcharon/daemon.h b/src/libcharon/daemon.h
index 0005cd102..3230e7201 100644
--- a/src/libcharon/daemon.h
+++ b/src/libcharon/daemon.h
@@ -152,7 +152,6 @@ typedef struct daemon_t daemon_t;
#include <sa/shunt_manager.h>
#include <config/backend_manager.h>
#include <sa/authenticators/eap/eap_manager.h>
-#include <tnc/imc/imc_manager.h>
#include <tnc/imv/imv_manager.h>
#include <tnc/tnccs/tnccs_manager.h>
@@ -242,11 +241,6 @@ struct daemon_t {
eap_manager_t *eap;
/**
- * TNC IMC manager controlling Integrity Measurement Collectors
- */
- imc_manager_t *imcs;
-
- /**
* TNC IMV manager controlling Integrity Measurement Verifiers
*/
imv_manager_t *imvs;
diff --git a/src/libcharon/plugins/tnc_imc/Makefile.am b/src/libcharon/plugins/tnc_imc/Makefile.am
index 35c9715ce..65c878172 100644
--- a/src/libcharon/plugins/tnc_imc/Makefile.am
+++ b/src/libcharon/plugins/tnc_imc/Makefile.am
@@ -1,6 +1,10 @@
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
- -I$(top_srcdir)/src/libcharon -I$(top_srcdir)/src/libtncif
+INCLUDES = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libhydra \
+ -I$(top_srcdir)/src/libcharon \
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libtnccs
AM_CFLAGS = -DUSE_TNC -rdynamic
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.h b/src/libcharon/plugins/tnc_imc/tnc_imc.h
index 10a67f90b..2c5c67b43 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc.h
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc.h
@@ -22,7 +22,7 @@
#ifndef TNC_IMC_H_
#define TNC_IMC_H_
-#include <tnc/imc/imc.h>
+#include <imc/imc.h>
/**
* Create an Integrity Measurement Collector.
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
index 25a6a1cc4..9c023e615 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
@@ -13,7 +13,7 @@
* for more details.
*/
-#include "tnc_imc.h"
+#include <imc/imc_manager.h>
#include <debug.h>
#include <daemon.h>
@@ -28,14 +28,15 @@ TNC_Result TNC_TNCC_ReportMessageTypes(TNC_IMCID imc_id,
TNC_MessageTypeList supported_types,
TNC_UInt32 type_count)
{
- if (!charon->imcs->is_registered(charon->imcs, imc_id))
+ imc_manager_t *imcs = lib->get(lib, "imc-manager");
+
+ if (!imcs->is_registered(imcs, imc_id))
{
DBG1(DBG_TNC, "ignoring ReportMessageTypes() from unregistered IMC %u",
imc_id);
return TNC_RESULT_INVALID_PARAMETER;
}
- return charon->imcs->set_message_types(charon->imcs, imc_id,
- supported_types, type_count);
+ return imcs->set_message_types(imcs, imc_id, supported_types, type_count);
}
/**
@@ -45,7 +46,9 @@ TNC_Result TNC_TNCC_RequestHandshakeRetry(TNC_IMCID imc_id,
TNC_ConnectionID connection_id,
TNC_RetryReason reason)
{
- if (!charon->imcs->is_registered(charon->imcs, imc_id))
+ imc_manager_t *imcs = lib->get(lib, "imc-manager");
+
+ if (!imcs->is_registered(imcs, imc_id))
{
DBG1(DBG_TNC, "ignoring RequestHandshakeRetry() from unregistered IMC %u",
imc_id);
@@ -64,7 +67,9 @@ TNC_Result TNC_TNCC_SendMessage(TNC_IMCID imc_id,
TNC_UInt32 msg_len,
TNC_MessageType msg_type)
{
- if (!charon->imcs->is_registered(charon->imcs, imc_id))
+ imc_manager_t *imcs = lib->get(lib, "imc-manager");
+
+ if (!imcs->is_registered(imcs, imc_id))
{
DBG1(DBG_TNC, "ignoring SendMessage() from unregistered IMC %u",
imc_id);
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
index c8cc06e0f..0d0737ccb 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
@@ -15,8 +15,6 @@
#include "tnc_imc_manager.h"
-#include <tnc/imc/imc_manager.h>
-
#include <tncifimc.h>
#include <debug.h>
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.h b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.h
index ed490293b..800ee39e1 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc_manager.h
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc_manager.h
@@ -22,7 +22,7 @@
#ifndef TNC_IMC_MANAGER_H_
#define TNC_IMC_MANAGER_H_
-#include <tnc/imc/imc_manager.h>
+#include <imc/imc_manager.h>
/**
* Create an IMC manager instance.
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c b/src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c
index bc13b8735..e78529936 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc_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_imc_plugin_t private_tnc_imc_plugin_t;
+
+/**
+ * Private data of a tnc_imc_plugin_t object.
+ */
+struct private_tnc_imc_plugin_t {
+
+ /**
+ * Public interface.
+ */
+ tnc_imc_plugin_t public;
+
+ /**
+ * TNC IMC manager controlling Integrity Measurement Collectors
+ */
+ imc_manager_t *imcs;
+};
/**
* load IMCs from a configuration file
*/
-static bool load_imcs(char *filename)
+static bool load_imcs(private_tnc_imc_plugin_t *this, char *filename)
{
int fd, line_nr = 0;
chunk_t src, line;
@@ -128,7 +146,7 @@ static bool load_imcs(char *filename)
free(path);
return FALSE;
}
- if (!charon->imcs->add(charon->imcs, imc))
+ if (!this->imcs->add(this->imcs, imc))
{
if (imc->terminate &&
imc->terminate(imc->get_id(imc)) != TNC_RESULT_SUCCESS)
@@ -148,47 +166,59 @@ static bool load_imcs(char *filename)
}
METHOD(plugin_t, get_name, char*,
- tnc_imc_plugin_t *this)
+ private_tnc_imc_plugin_t *this)
{
return "tnc-imc";
}
+METHOD(plugin_t, get_features, int,
+ private_tnc_imc_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_PROVIDE(CUSTOM, "imc-manager"),
+ };
+ *features = f;
+ return countof(f);
+}
+
METHOD(plugin_t, destroy, void,
- tnc_imc_plugin_t *this)
+ private_tnc_imc_plugin_t *this)
{
- charon->imcs->destroy(charon->imcs);
+ lib->set(lib, "imc-manager", NULL);
+ this->imcs->destroy(this->imcs);
free(this);
}
/*
* see header file
*/
-plugin_t *tnc_imc_plugin_create()
+plugin_t *tnc_imc_plugin_create(void)
{
+ private_tnc_imc_plugin_t *this;
char *tnc_config;
- tnc_imc_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,
+ },
},
+ .imcs = tnc_imc_manager_create(),
);
- /* Create IMC manager */
- charon->imcs = tnc_imc_manager_create();
+ lib->set(lib, "imc-manager", this->imcs);
/* Load IMCs and abort if not all instances initalize successfully */
tnc_config = lib->settings->get_str(lib->settings,
"charon.plugins.tnc-imc.tnc_config", "/etc/tnc_config");
- if (!load_imcs(tnc_config))
+ if (!load_imcs(this, tnc_config))
{
- charon->imcs->destroy(charon->imcs);
- charon->imcs = NULL;
- free(this);
+ destroy(this);
return NULL;
}
- return &this->plugin;
+
+ return &this->public.plugin;
}
diff --git a/src/libcharon/plugins/tnccs_11/Makefile.am b/src/libcharon/plugins/tnccs_11/Makefile.am
index 4b51a3c63..782aeb047 100644
--- a/src/libcharon/plugins/tnccs_11/Makefile.am
+++ b/src/libcharon/plugins/tnccs_11/Makefile.am
@@ -1,7 +1,12 @@
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
- -I$(top_srcdir)/src/libcharon -I$(top_srcdir)/src/libtls \
- -I$(top_srcdir)/src/libtncif ${xml_CFLAGS}
+INCLUDES = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libhydra \
+ -I$(top_srcdir)/src/libcharon \
+ -I$(top_srcdir)/src/libtls \
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libtnccs \
+ ${xml_CFLAGS}
AM_CFLAGS = -DUSE_TNC -rdynamic
@@ -11,7 +16,9 @@ if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-tnccs-11.la
else
plugin_LTLIBRARIES = libstrongswan-tnccs-11.la
-libstrongswan_tnccs_11_la_LIBADD += $(top_builddir)/src/libtncif/libtncif.la
+libstrongswan_tnccs_11_la_LIBADD += \
+ $(top_builddir)/src/libtncif/libtncif.la \
+ $(top_builddir)/src/libtnccs/libtnccs.la
endif
libstrongswan_tnccs_11_la_SOURCES = \
diff --git a/src/libcharon/plugins/tnccs_11/tnccs_11.c b/src/libcharon/plugins/tnccs_11/tnccs_11.c
index 53ac99807..c7f96731e 100644
--- a/src/libcharon/plugins/tnccs_11/tnccs_11.c
+++ b/src/libcharon/plugins/tnccs_11/tnccs_11.c
@@ -25,6 +25,8 @@
#include <tncif_names.h>
#include <tncif_pa_subtypes.h>
+#include <imc/imc_manager.h>
+
#include <daemon.h>
#include <debug.h>
#include <threading/mutex.h>
@@ -91,6 +93,12 @@ struct private_tnccs_11_t {
* Set of IMV recommendations (TNC Server only)
*/
recommendations_t *recs;
+
+ /**
+ * TNC IMC manager controlling Integrity Measurement Collectors
+ */
+ imc_manager_t *imcs;
+
};
METHOD(tnccs_t, send_msg, TNC_Result,
@@ -178,7 +186,7 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
}
else
{
- charon->imcs->receive_message(charon->imcs,
+ this->imcs->receive_message(this->imcs,
this->connection_id, msg_body.ptr, msg_body.len,msg_type);
}
this->send_msg = FALSE;
@@ -212,8 +220,8 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
default:
state = TNC_CONNECTION_STATE_ACCESS_NONE;
}
- charon->imcs->notify_connection_change(charon->imcs,
- this->connection_id, state);
+ this->imcs->notify_connection_change(this->imcs,
+ this->connection_id, state);
this->delete_state = TRUE;
break;
}
@@ -339,7 +347,7 @@ METHOD(tls_t, process, status_t,
}
else
{
- charon->imcs->batch_ending(charon->imcs, this->connection_id);
+ this->imcs->batch_ending(this->imcs, this->connection_id);
}
this->send_msg = FALSE;
}
@@ -409,19 +417,19 @@ METHOD(tls_t, build, status_t,
}
/* Create TNCCS-PreferredLanguage message */
- pref_lang = charon->imcs->get_preferred_language(charon->imcs);
+ pref_lang = this->imcs->get_preferred_language(this->imcs);
msg = tnccs_preferred_language_msg_create(pref_lang);
this->mutex->lock(this->mutex);
this->batch = tnccs_batch_create(this->is_server, ++this->batch_id);
this->batch->add_msg(this->batch, msg);
this->mutex->unlock(this->mutex);
- charon->imcs->notify_connection_change(charon->imcs,
+ this->imcs->notify_connection_change(this->imcs,
this->connection_id, TNC_CONNECTION_STATE_CREATE);
- charon->imcs->notify_connection_change(charon->imcs,
+ this->imcs->notify_connection_change(this->imcs,
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
this->send_msg = TRUE;
- charon->imcs->begin_handshake(charon->imcs, this->connection_id);
+ this->imcs->begin_handshake(this->imcs, this->connection_id);
this->send_msg = FALSE;
}
@@ -531,6 +539,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"),
);
return &this->public;
diff --git a/src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c b/src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c
index 9d227f017..c2c173eea 100644
--- a/src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c
+++ b/src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c
@@ -32,6 +32,8 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(CUSTOM, "tnccs-1.1"),
PLUGIN_DEPENDS(EAP_SERVER, EAP_TNC),
PLUGIN_DEPENDS(EAP_PEER, EAP_TNC),
+ PLUGIN_SDEPEND(CUSTOM, "imc-manager"),
+ PLUGIN_SDEPEND(CUSTOM, "imv-manager"),
};
*features = f;
return countof(f);
diff --git a/src/libcharon/plugins/tnccs_20/Makefile.am b/src/libcharon/plugins/tnccs_20/Makefile.am
index ec348357c..6e16485fd 100644
--- a/src/libcharon/plugins/tnccs_20/Makefile.am
+++ b/src/libcharon/plugins/tnccs_20/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
- -I$(top_srcdir)/src/libcharon -I$(top_srcdir)/src/libtls \
- -I$(top_srcdir)/src/libtncif
+INCLUDES = \
+ -I$(top_srcdir)/src/libstrongswan \
+ -I$(top_srcdir)/src/libhydra \
+ -I$(top_srcdir)/src/libcharon \
+ -I$(top_srcdir)/src/libtls \
+ -I$(top_srcdir)/src/libtncif \
+ -I$(top_srcdir)/src/libtnccs
AM_CFLAGS = -DUSE_TNC -rdynamic
@@ -9,7 +13,9 @@ if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-tnccs-20.la
else
plugin_LTLIBRARIES = libstrongswan-tnccs-20.la
-libstrongswan_tnccs_20_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
+libstrongswan_tnccs_20_la_LIBADD = \
+ $(top_builddir)/src/libtncif/libtncif.la \
+ $(top_builddir)/src/libtnccs/libtnccs.la
endif
libstrongswan_tnccs_20_la_SOURCES = \
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c
index db1a4ba2b..c9e62e093 100644
--- a/src/libcharon/plugins/tnccs_20/tnccs_20.c
+++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c
@@ -29,6 +29,8 @@
#include <tncif_names.h>
#include <tncif_pa_subtypes.h>
+#include <imc/imc_manager.h>
+
#include <debug.h>
#include <daemon.h>
#include <threading/mutex.h>
@@ -91,6 +93,12 @@ struct private_tnccs_20_t {
* Set of IMV recommendations (TNC Server only)
*/
recommendations_t *recs;
+
+ /**
+ * TNC IMC manager controlling Integrity Measurement Collectors
+ */
+ imc_manager_t *imcs;
+
};
METHOD(tnccs_t, send_msg, TNC_Result,
@@ -195,7 +203,7 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
}
else
{
- charon->imcs->receive_message(charon->imcs,
+ this->imcs->receive_message(this->imcs,
this->connection_id, msg_body.ptr, msg_body.len,msg_type);
}
this->send_msg = FALSE;
@@ -233,8 +241,8 @@ static void handle_message(private_tnccs_20_t *this, pb_tnc_msg_t *msg)
case PB_REC_QUARANTINED:
state = TNC_CONNECTION_STATE_ACCESS_ISOLATED;
}
- charon->imcs->notify_connection_change(charon->imcs,
- this->connection_id, state);
+ this->imcs->notify_connection_change(this->imcs,
+ this->connection_id, state);
break;
}
case PB_MSG_REMEDIATION_PARAMETERS:
@@ -405,10 +413,10 @@ METHOD(tls_t, process, status_t,
else if (batch_type == PB_BATCH_SRETRY)
{
/* Restart the measurements */
- charon->imcs->notify_connection_change(charon->imcs,
+ this->imcs->notify_connection_change(this->imcs,
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
this->send_msg = TRUE;
- charon->imcs->begin_handshake(charon->imcs, this->connection_id);
+ this->imcs->begin_handshake(this->imcs, this->connection_id);
this->send_msg = FALSE;
}
@@ -443,7 +451,7 @@ METHOD(tls_t, process, status_t,
}
else
{
- charon->imcs->batch_ending(charon->imcs, this->connection_id);
+ this->imcs->batch_ending(this->imcs, this->connection_id);
}
this->send_msg = FALSE;
}
@@ -556,7 +564,7 @@ METHOD(tls_t, build, status_t,
}
/* Create PB-TNC Language Preference message */
- pref_lang = charon->imcs->get_preferred_language(charon->imcs);
+ pref_lang = this->imcs->get_preferred_language(this->imcs);
msg = pb_language_preference_msg_create(chunk_create(pref_lang,
strlen(pref_lang)));
this->mutex->lock(this->mutex);
@@ -564,12 +572,12 @@ METHOD(tls_t, build, status_t,
this->batch->add_msg(this->batch, msg);
this->mutex->unlock(this->mutex);
- charon->imcs->notify_connection_change(charon->imcs,
+ this->imcs->notify_connection_change(this->imcs,
this->connection_id, TNC_CONNECTION_STATE_CREATE);
- charon->imcs->notify_connection_change(charon->imcs,
+ this->imcs->notify_connection_change(this->imcs,
this->connection_id, TNC_CONNECTION_STATE_HANDSHAKE);
this->send_msg = TRUE;
- charon->imcs->begin_handshake(charon->imcs, this->connection_id);
+ this->imcs->begin_handshake(this->imcs, this->connection_id);
this->send_msg = FALSE;
}
@@ -731,6 +739,7 @@ tls_t *tnccs_20_create(bool is_server)
.is_server = is_server,
.state_machine = pb_tnc_state_machine_create(is_server),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
+ .imcs = lib->get(lib, "imc-manager"),
);
return &this->public;
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c b/src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c
index a44c614d5..e06b41dd2 100644
--- a/src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c
+++ b/src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c
@@ -32,6 +32,8 @@ METHOD(plugin_t, get_features, int,
PLUGIN_PROVIDE(CUSTOM, "tnccs-2.0"),
PLUGIN_DEPENDS(EAP_SERVER, EAP_TNC),
PLUGIN_DEPENDS(EAP_PEER, EAP_TNC),
+ PLUGIN_SDEPEND(CUSTOM, "imc-manager"),
+ PLUGIN_SDEPEND(CUSTOM, "imv-manager"),
};
*features = f;
return countof(f);
diff --git a/src/libcharon/tnc/tnccs/tnccs_manager.c b/src/libcharon/tnc/tnccs/tnccs_manager.c
index db72011e2..0e4107eef 100644
--- a/src/libcharon/tnc/tnccs/tnccs_manager.c
+++ b/src/libcharon/tnc/tnccs/tnccs_manager.c
@@ -17,6 +17,7 @@
#include "tnccs_manager.h"
+#include <imc/imc_manager.h>
#include <tnc/imv/imv_recommendations.h>
#include <debug.h>
@@ -110,6 +111,11 @@ struct private_tnccs_manager_t {
*/
rwlock_t *connection_lock;
+ /**
+ * TNC IMC manager controlling Integrity Measurement Collectors
+ */
+ imc_manager_t *imcs;
+
};
METHOD(tnccs_manager_t, add_method, void,
@@ -199,7 +205,11 @@ METHOD(tnccs_manager_t, create_connection, TNC_ConnectionID,
else
{
/* we assume a TNC Client */
- if (!charon->imcs)
+ if (!this->imcs)
+ {
+ this->imcs = lib->get(lib, "imc-manager");
+ }
+ if (!this->imcs)
{
DBG1(DBG_TNC, "no IMC manager available!");
free(entry);
@@ -232,9 +242,9 @@ METHOD(tnccs_manager_t, remove_connection, void,
}
else
{
- if (charon->imcs)
+ if (this->imcs)
{
- charon->imcs->notify_connection_change(charon->imcs, id,
+ this->imcs->notify_connection_change(this->imcs, id,
TNC_CONNECTION_STATE_DELETE);
}
}
@@ -500,6 +510,7 @@ tnccs_manager_t *tnccs_manager_create()
.connections = linked_list_create(),
.protocol_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
.connection_lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
+ .imcs = lib->get(lib, "imc-manager"),
);
return &this->public;
diff --git a/src/libtnccs/Makefile.am b/src/libtnccs/Makefile.am
new file mode 100644
index 000000000..034814402
--- /dev/null
+++ b/src/libtnccs/Makefile.am
@@ -0,0 +1,10 @@
+
+INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libtncif
+
+ipseclib_LTLIBRARIES = libtnccs.la
+
+libtnccs_la_LIBADD = $(top_builddir)/src/libtncif/libtncif.la
+
+libtnccs_la_SOURCES = \
+ imc/imc.h imc/imc_manager.h
+
diff --git a/src/libcharon/tnc/imc/imc.h b/src/libtnccs/imc/imc.h
index ddedf714c..ddedf714c 100644
--- a/src/libcharon/tnc/imc/imc.h
+++ b/src/libtnccs/imc/imc.h
diff --git a/src/libcharon/tnc/imc/imc_manager.h b/src/libtnccs/imc/imc_manager.h
index 11104b649..b475e0eaf 100644
--- a/src/libcharon/tnc/imc/imc_manager.h
+++ b/src/libtnccs/imc/imc_manager.h
@@ -23,8 +23,6 @@
typedef struct imc_manager_t imc_manager_t;
-#ifdef USE_TNC
-
#include "imc.h"
#include <library.h>
@@ -123,6 +121,4 @@ struct imc_manager_t {
void (*destroy)(imc_manager_t *this);
};
-#endif /* USE_TNC */
-
#endif /** IMC_MANAGER_H_ @}*/