moved TNCCS callback functions into bind_function.c
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 6 Nov 2010 19:38:59 +0000 (20:38 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 9 Nov 2010 19:43:50 +0000 (20:43 +0100)
src/libcharon/plugins/tnc_imc/Makefile.am
src/libcharon/plugins/tnc_imc/tnc_imc.c
src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c [new file with mode: 0644]
src/libcharon/plugins/tnc_imv/Makefile.am
src/libcharon/plugins/tnc_imv/tnc_imv.c
src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c [new file with mode: 0644]

index 4b54d45..2c55181 100644 (file)
@@ -12,7 +12,7 @@ endif
 
 libstrongswan_tnc_imc_la_SOURCES = \
        tnc_imc_plugin.h tnc_imc_plugin.c tnc_imc.h tnc_imc.c \
-       tnc_imc_manager.h tnc_imc_manager.c
+       tnc_imc_manager.h tnc_imc_manager.c tnc_imc_bind_function.c
 
 libstrongswan_tnc_imc_la_LDFLAGS = -module -avoid-version
 
index b3f5717..1306847 100644 (file)
@@ -18,7 +18,7 @@
 #include <dlfcn.h>
 
 #include <debug.h>
-#include <daemon.h>
+#include <library.h>
 
 typedef struct private_tnc_imc_t private_tnc_imc_t;
 
@@ -131,67 +131,3 @@ imc_t* tnc_imc_create(char* name, char *filename)
 
        return &this->public;
 }
-
-/**
- * Called by the IMC to inform a TNCC about the set of message types the IMC
- * is able to receive
- */
-TNC_Result TNC_TNCC_ReportMessageTypes(TNC_IMCID imc_id,
-                                                                          TNC_MessageTypeList supported_types,
-                                                                          TNC_UInt32 type_count)
-{
-       DBG2(DBG_TNC,"TNCC_ReportMessageTypes %u %u", imc_id, type_count);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMC to ask a TNCC to retry an Integrity Check Handshake
- */
-TNC_Result TNC_TNCC_RequestHandshakeRetry(TNC_IMCID imc_id,
-                                                                                 TNC_ConnectionID connection_id,
-                                                                                 TNC_RetryReason reason)
-{
-       DBG2(DBG_TNC,"TNCC_RequestHandshakeRetry %u %u", imc_id, connection_id);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMC when an IMC-IMV message is to be sent
- */
-TNC_Result TNC_TNCC_SendMessage(TNC_IMCID imc_id,
-                                                               TNC_ConnectionID connection_id,
-                                                               TNC_BufferReference message,
-                                                               TNC_UInt32 message_len,
-                                                               TNC_MessageType message_type)
-{
-       DBG2(DBG_TNC,"TNCC_SendMessage %u %u '%s' %u %0x", imc_id, connection_id,
-                                 message, message_len, message_type);
-       return charon->tnccs->send_message(charon->tnccs, connection_id, message,
-                                                                          message_len, message_type);
-}
-
-/**
- * Called by the IMC when it needs a function pointer
- */
-TNC_Result TNC_TNCC_BindFunction(TNC_IMCID id,
-                                                                char *function_name,
-                                                                void **function_pointer)
-{
-       if (streq(function_name, "TNC_TNCC_ReportMessageTypes"))
-       {
-               *function_pointer = (void*)TNC_TNCC_ReportMessageTypes;
-       }
-    else if (streq(function_name, "TNC_TNCC_RequestHandshakeRetry"))
-       {
-               *function_pointer = (void*)TNC_TNCC_RequestHandshakeRetry;
-       }
-    else if (streq(function_name, "TNC_TNCC_SendMessage"))
-       {
-               *function_pointer = (void*)TNC_TNCC_SendMessage;
-       }
-    else
-       {
-               return TNC_RESULT_INVALID_PARAMETER;
-       }
-    return TNC_RESULT_SUCCESS;
-}
diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
new file mode 100644 (file)
index 0000000..6a266f2
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2006 Mike McCauley
+ * Copyright (C) 2010 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "tnc_imc.h"
+
+#include <debug.h>
+#include <daemon.h>
+
+/**
+ * Called by the IMC to inform a TNCC about the set of message types the IMC
+ * is able to receive
+ */
+TNC_Result TNC_TNCC_ReportMessageTypes(TNC_IMCID imc_id,
+                                                                          TNC_MessageTypeList supported_types,
+                                                                          TNC_UInt32 type_count)
+{
+       DBG2(DBG_TNC,"TNCC_ReportMessageTypes %u %u", imc_id, type_count);
+       return TNC_RESULT_SUCCESS;
+}
+
+/**
+ * Called by the IMC to ask a TNCC to retry an Integrity Check Handshake
+ */
+TNC_Result TNC_TNCC_RequestHandshakeRetry(TNC_IMCID imc_id,
+                                                                                 TNC_ConnectionID connection_id,
+                                                                                 TNC_RetryReason reason)
+{
+       DBG2(DBG_TNC,"TNCC_RequestHandshakeRetry %u %u", imc_id, connection_id);
+       return TNC_RESULT_SUCCESS;
+}
+
+/**
+ * Called by the IMC when an IMC-IMV message is to be sent
+ */
+TNC_Result TNC_TNCC_SendMessage(TNC_IMCID imc_id,
+                                                               TNC_ConnectionID connection_id,
+                                                               TNC_BufferReference message,
+                                                               TNC_UInt32 message_len,
+                                                               TNC_MessageType message_type)
+{
+       DBG2(DBG_TNC,"TNCC_SendMessage %u %u '%s' %u %0x", imc_id, connection_id,
+                                 message, message_len, message_type);
+       return charon->tnccs->send_message(charon->tnccs, connection_id, message,
+                                                                          message_len, message_type);
+}
+
+/**
+ * Called by the IMC when it needs a function pointer
+ */
+TNC_Result TNC_TNCC_BindFunction(TNC_IMCID id,
+                                                                char *function_name,
+                                                                void **function_pointer)
+{
+       if (streq(function_name, "TNC_TNCC_ReportMessageTypes"))
+       {
+               *function_pointer = (void*)TNC_TNCC_ReportMessageTypes;
+       }
+    else if (streq(function_name, "TNC_TNCC_RequestHandshakeRetry"))
+       {
+               *function_pointer = (void*)TNC_TNCC_RequestHandshakeRetry;
+       }
+    else if (streq(function_name, "TNC_TNCC_SendMessage"))
+       {
+               *function_pointer = (void*)TNC_TNCC_SendMessage;
+       }
+    else
+       {
+               return TNC_RESULT_INVALID_PARAMETER;
+       }
+    return TNC_RESULT_SUCCESS;
+}
index 5ef0bcf..d450bb6 100644 (file)
@@ -12,7 +12,7 @@ endif
 
 libstrongswan_tnc_imv_la_SOURCES = \
        tnc_imv_plugin.h tnc_imv_plugin.c tnc_imv.h tnc_imv.c \
-       tnc_imv_manager.h tnc_imv_manager.c
+       tnc_imv_manager.h tnc_imv_manager.c tnc_imv_bind_function.c
 
 libstrongswan_tnc_imv_la_LDFLAGS = -module -avoid-version
 
index 60e81a4..7f59926 100644 (file)
@@ -132,83 +132,3 @@ imv_t* tnc_imv_create(char *name, char *filename)
 
        return &this->public;
 }
-
-/**
- * Called by the IMV to inform a TNCS about the set of message types the IMV
- * is able to receive
- */
-TNC_Result TNC_TNCS_ReportMessageTypes(TNC_IMVID imv_id,
-                                                                          TNC_MessageTypeList supported_types,
-                                                                          TNC_UInt32 type_count)
-{
-       DBG2(DBG_TNC,"TNCS_ReportMessageTypes %u %u", imv_id, type_count);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMV to ask a TNCS to retry an Integrity Check Handshake
- */
-TNC_Result TNC_TNCS_RequestHandshakeRetry(TNC_IMVID imv_id,
-                                                                                 TNC_ConnectionID connection_id,
-                                                                                 TNC_RetryReason reason)
-{
-       DBG2(DBG_TNC,"TNCS_RequestHandshakeRetry %u %u", imv_id, connection_id);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMV when an IMV-IMC message is to be sent
- */
-TNC_Result TNC_TNCS_SendMessage(TNC_IMVID imv_id,
-                                                               TNC_ConnectionID connection_id,
-                                                               TNC_BufferReference message,
-                                                               TNC_UInt32 message_len,
-                                                               TNC_MessageType message_type)
-{
-       DBG2(DBG_TNC,"TNCS_SendMessage %u %u '%s' %u %0x", imv_id, connection_id,
-                                 message, message_len, message_type);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMV to deliver its IMV Action Recommendation and IMV Evaluation
- * Result to the TNCS
- */
-TNC_Result TNC_TNCS_ProvideRecommendation(TNC_IMVID imv_id,
-                                                               TNC_ConnectionID connection_id,
-                                                               TNC_IMV_Action_Recommendation recommendation,
-                                                               TNC_IMV_Evaluation_Result evaluation)
-{
-       DBG2(DBG_TNC,"TNCS_ProvideRecommendation %u %u", imv_id, connection_id);
-       return TNC_RESULT_SUCCESS;
-}
-
-/**
- * Called by the IMV when it needs a function pointer
- */
-TNC_Result TNC_TNCS_BindFunction(TNC_IMVID id,
-                                                                char *function_name,
-                                                                void **function_pointer)
-{
-       if (streq(function_name, "TNC_TNCS_ReportMessageTypes"))
-       {
-               *function_pointer = (void*)TNC_TNCS_ReportMessageTypes;
-       }
-    else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry"))
-       {
-               *function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry;
-       }
-    else if (streq(function_name, "TNC_TNCS_SendMessage"))
-       {
-               *function_pointer = (void*)TNC_TNCS_SendMessage;
-       }
-    else if (streq(function_name, "TNC_TNCS_ProvideRecommendation"))
-       {
-               *function_pointer = (void*)TNC_TNCS_ProvideRecommendation;
-       }
-    else
-       {
-               return TNC_RESULT_INVALID_PARAMETER;
-       }
-    return TNC_RESULT_SUCCESS;
-}
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
new file mode 100644 (file)
index 0000000..395501a
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2006 Mike McCauley
+ * Copyright (C) 2010 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ */
+
+#include "tnc_imv.h"
+
+#include <debug.h>
+#include <daemon.h>
+
+/**
+ * Called by the IMV to inform a TNCS about the set of message types the IMV
+ * is able to receive
+ */
+TNC_Result TNC_TNCS_ReportMessageTypes(TNC_IMVID imv_id,
+                                                                          TNC_MessageTypeList supported_types,
+                                                                          TNC_UInt32 type_count)
+{
+       DBG2(DBG_TNC,"TNCS_ReportMessageTypes %u %u", imv_id, type_count);
+       return TNC_RESULT_SUCCESS;
+}
+
+/**
+ * Called by the IMV to ask a TNCS to retry an Integrity Check Handshake
+ */
+TNC_Result TNC_TNCS_RequestHandshakeRetry(TNC_IMVID imv_id,
+                                                                                 TNC_ConnectionID connection_id,
+                                                                                 TNC_RetryReason reason)
+{
+       DBG2(DBG_TNC,"TNCS_RequestHandshakeRetry %u %u", imv_id, connection_id);
+       return TNC_RESULT_SUCCESS;
+}
+
+/**
+ * Called by the IMV when an IMV-IMC message is to be sent
+ */
+TNC_Result TNC_TNCS_SendMessage(TNC_IMVID imv_id,
+                                                               TNC_ConnectionID connection_id,
+                                                               TNC_BufferReference message,
+                                                               TNC_UInt32 message_len,
+                                                               TNC_MessageType message_type)
+{
+       DBG2(DBG_TNC,"TNCS_SendMessage %u %u '%s' %u %0x", imv_id, connection_id,
+                                 message, message_len, message_type);
+       return charon->tnccs->send_message(charon->tnccs, connection_id, message,
+                                                                          message_len, message_type);
+}
+
+/**
+ * Called by the IMV to deliver its IMV Action Recommendation and IMV Evaluation
+ * Result to the TNCS
+ */
+TNC_Result TNC_TNCS_ProvideRecommendation(TNC_IMVID imv_id,
+                                                               TNC_ConnectionID connection_id,
+                                                               TNC_IMV_Action_Recommendation recommendation,
+                                                               TNC_IMV_Evaluation_Result evaluation)
+{
+       DBG2(DBG_TNC,"TNCS_ProvideRecommendation %u %u", imv_id, connection_id);
+       return TNC_RESULT_SUCCESS;
+}
+
+/**
+ * Called by the IMV when it needs a function pointer
+ */
+TNC_Result TNC_TNCS_BindFunction(TNC_IMVID id,
+                                                                char *function_name,
+                                                                void **function_pointer)
+{
+       if (streq(function_name, "TNC_TNCS_ReportMessageTypes"))
+       {
+               *function_pointer = (void*)TNC_TNCS_ReportMessageTypes;
+       }
+    else if (streq(function_name, "TNC_TNCS_RequestHandshakeRetry"))
+       {
+               *function_pointer = (void*)TNC_TNCS_RequestHandshakeRetry;
+       }
+    else if (streq(function_name, "TNC_TNCS_SendMessage"))
+       {
+               *function_pointer = (void*)TNC_TNCS_SendMessage;
+       }
+    else if (streq(function_name, "TNC_TNCS_ProvideRecommendation"))
+       {
+               *function_pointer = (void*)TNC_TNCS_ProvideRecommendation;
+       }
+    else
+       {
+               return TNC_RESULT_INVALID_PARAMETER;
+       }
+    return TNC_RESULT_SUCCESS;
+}