From: Andreas Steffen Date: Sat, 6 Nov 2010 19:38:59 +0000 (+0100) Subject: moved TNCCS callback functions into bind_function.c X-Git-Tag: 4.5.1~556 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=544b0942776d8434c02d6f00fe1ed40ba78e4de0;p=thirdparty%2Fstrongswan.git moved TNCCS callback functions into bind_function.c --- diff --git a/src/libcharon/plugins/tnc_imc/Makefile.am b/src/libcharon/plugins/tnc_imc/Makefile.am index 4b54d45a73..2c551813ed 100644 --- a/src/libcharon/plugins/tnc_imc/Makefile.am +++ b/src/libcharon/plugins/tnc_imc/Makefile.am @@ -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 diff --git a/src/libcharon/plugins/tnc_imc/tnc_imc.c b/src/libcharon/plugins/tnc_imc/tnc_imc.c index b3f5717a97..13068474a0 100644 --- a/src/libcharon/plugins/tnc_imc/tnc_imc.c +++ b/src/libcharon/plugins/tnc_imc/tnc_imc.c @@ -18,7 +18,7 @@ #include #include -#include +#include 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 index 0000000000..6a266f2256 --- /dev/null +++ b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c @@ -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 . + * + * 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 +#include + +/** + * 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_imv/Makefile.am b/src/libcharon/plugins/tnc_imv/Makefile.am index 5ef0bcfabc..d450bb65f4 100644 --- a/src/libcharon/plugins/tnc_imv/Makefile.am +++ b/src/libcharon/plugins/tnc_imv/Makefile.am @@ -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 diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv.c b/src/libcharon/plugins/tnc_imv/tnc_imv.c index 60e81a4d0a..7f59926edc 100644 --- a/src/libcharon/plugins/tnc_imv/tnc_imv.c +++ b/src/libcharon/plugins/tnc_imv/tnc_imv.c @@ -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 index 0000000000..395501abe6 --- /dev/null +++ b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c @@ -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 . + * + * 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 +#include + +/** + * 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; +}