]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
moved imc_manager to libtnccs
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 20 Oct 2011 19:12:29 +0000 (21:12 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 24 Oct 2011 23:10:16 +0000 (01:10 +0200)
20 files changed:
configure.in
src/Makefile.am
src/libcharon/Makefile.am
src/libcharon/daemon.h
src/libcharon/plugins/tnc_imc/Makefile.am
src/libcharon/plugins/tnc_imc/tnc_imc.h
src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libcharon/plugins/tnc_imc/tnc_imc_manager.h
src/libcharon/plugins/tnc_imc/tnc_imc_plugin.c
src/libcharon/plugins/tnccs_11/Makefile.am
src/libcharon/plugins/tnccs_11/tnccs_11.c
src/libcharon/plugins/tnccs_11/tnccs_11_plugin.c
src/libcharon/plugins/tnccs_20/Makefile.am
src/libcharon/plugins/tnccs_20/tnccs_20.c
src/libcharon/plugins/tnccs_20/tnccs_20_plugin.c
src/libcharon/tnc/tnccs/tnccs_manager.c
src/libtnccs/Makefile.am [new file with mode: 0644]
src/libtnccs/imc/imc.h [moved from src/libcharon/tnc/imc/imc.h with 100% similarity]
src/libtnccs/imc/imc_manager.h [moved from src/libcharon/tnc/imc/imc_manager.h with 98% similarity]

index 516f5d9bfae9e679dbac3f5197883f5abba539d6..c0369623f842fc6dc64737f4c69c60cf6515dc7f 100644 (file)
@@ -251,6 +251,10 @@ if test x$eap_tls = xtrue -o x$eap_ttls = xtrue -o x$eap_peap = xtrue; then
        tls=true;
 fi
 
+if test x$tnc_imc = xtrue -o x$tnc_imv = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_11 = xtrue -o x$tnccs_dynamic = xtrue; then
+       tnccs=true;
+fi
+
 if test x$imc_test = xtrue -o x$imv_test = xtrue -o x$imc_scanner = xtrue -o x$imv_scanner = xtrue -o x$imc_attestation = xtrue -o x$imv_attestation = xtrue; then
        imcv=true;
 fi
@@ -1019,6 +1023,7 @@ AM_CONDITIONAL(USE_LIBCAP, test x$capabilities = xlibcap)
 AM_CONDITIONAL(USE_VSTR, test x$vstr = xtrue)
 AM_CONDITIONAL(USE_SIMAKA, test x$simaka = xtrue)
 AM_CONDITIONAL(USE_TLS, test x$tls = xtrue)
+AM_CONDITIONAL(USE_TNCCS, test x$tnccs = xtrue)
 AM_CONDITIONAL(USE_IMCV, test x$imcv = xtrue)
 AM_CONDITIONAL(USE_PTS, test x$pts = xtrue)
 AM_CONDITIONAL(MONOLITHIC, test x$monolithic = xtrue)
@@ -1097,6 +1102,7 @@ AC_OUTPUT(
        src/libsimaka/Makefile
        src/libtls/Makefile
        src/libtncif/Makefile
+       src/libtnccs/Makefile
        src/libpts/Makefile
        src/libimcv/Makefile
        src/libimcv/plugins/imc_test/Makefile
index 33e1b1264c9da5a9f485ec6f529d597ffb58c6f0..7f4651dcd72730ac7f17125527c29ea48dba0b1f 100644 (file)
@@ -20,6 +20,10 @@ if USE_LIBTNCIF
   SUBDIRS += libtncif
 endif
 
+if USE_TNCCS
+  SUBDIRS += libtnccs
+endif
+
 if USE_PTS
   SUBDIRS += libpts
 endif
index 371c787a10d631119e0f3ebb9fc32c35d621d9c4..6ddf41c5317ea9317d4e6ae09f9b52523b5c8ac1 100644 (file)
@@ -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}\" \
index 0005cd1024bef656c743ec716a7fa59e8326118e..3230e7201866f7c6ea2264e2f1dc32979a031115 100644 (file)
@@ -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>
 
@@ -241,11 +240,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
         */
index 35c9715ce27d808718ca646725626d2c1bd93bd6..65c878172e555e94b4a70fc6f3425d78d790bd40 100644 (file)
@@ -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
 
index 10a67f90b6ebf3b40603ef3a936bc5bf20977dfb..2c5c67b431042e5a9a5c6fd89bc8b60dbf671987 100644 (file)
@@ -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.
index 25a6a1cc4bc63a6112462e551e148ac7f36f62e7..9c023e61594a512cd702dc6a41aa78b35f1984f2 100644 (file)
@@ -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);
index c8cc06e0fea87207f631951947f01f31d221a0bb..0d0737ccb98f4e3552178e077946985ba6dd2a3b 100644 (file)
@@ -15,8 +15,6 @@
 
 #include "tnc_imc_manager.h"
 
-#include <tnc/imc/imc_manager.h>
-
 #include <tncifimc.h>
 
 #include <debug.h>
index ed490293b948018d0f85b8a6661e449b8d8f466e..800ee39e193dabcf3a04b23652b3c65094468202 100644 (file)
@@ -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.
index bc13b87353720bbf4a33bf04a63095b662b8b8d1..e78529936eac2571b08dee9d9099966f4a8e497c 100644 (file)
 #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;
 }
 
index 4b51a3c63b0a12f32d9da3c3cf56fcd7ae84551e..782aeb04722bb4414e73a9a1aa87e198517dec2d 100644 (file)
@@ -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 = \
index 53ac99807682e6aacc214b29cd0523a46c190c0a..c7f96731ee3c5b070443bbcdcd32b766cfbdf714 100644 (file)
@@ -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;
index 9d227f017941c5e7d3996f02cad1d2b6c6168ba4..c2c173eea9eb61e578d53761f78a81e34fa4d572 100644 (file)
@@ -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);
index ec348357ccb2bfd64337d44125dd516c2e248a88..6e16485fd6b850433e4e3e171bc1017c16612de6 100644 (file)
@@ -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 = \
index db1a4ba2b65ad5ae29826ed28699e7a48f3aa1ef..c9e62e0931d2f15698f556e2075860727b6c7c3d 100644 (file)
@@ -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;
index a44c614d550de46e1101a39dd68ccc134a3f6fe5..e06b41dd295b89bb33310fddc9840113f6bd54f6 100644 (file)
@@ -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);
index db72011e28f55f0a3105e3098e579dac9634175a..0e4107eef40365952fa97e28f37e48567e1745cf 100644 (file)
@@ -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 (file)
index 0000000..0348144
--- /dev/null
@@ -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
+
similarity index 98%
rename from src/libcharon/tnc/imc/imc_manager.h
rename to src/libtnccs/imc/imc_manager.h
index 11104b649811b9ab4b1f33c2826c6e05f9469635..b475e0eafa3e14dfb9478bb20d87b75c8a11dc7b 100644 (file)
@@ -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_ @}*/