imcv.h imcv.c \
imc/imc_agent.h imc/imc_agent.c imc/imc_state.h \
imc/imc_msg.h imc/imc_msg.c \
- imv/imv_agent.h imv/imv_agent.c imv/imv_state.h \
+ imv/imv_agent.h imv/imv_agent.c imv/imv_agent_if.h imv/imv_state.h \
imv/imv_database.h imv/imv_database.c \
imv/imv_msg.h imv/imv_msg.c \
imv/imv_lang_string.h imv/imv_lang_string.c \
--- /dev/null
+/*
+ * Copyright (C) 2013 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.
+ */
+
+/**
+ * @defgroup imv_agent_if_t imv_agent_if
+ * @{ @ingroup imv_os
+ */
+
+#ifndef IMV_AGENT_IF_H_
+#define IMV_AGENT_IF_H_
+
+#include <tncifimv.h>
+
+#include <library.h>
+
+typedef struct imv_agent_if_t imv_agent_if_t;
+
+/**
+ * IF-IMV interface for IMV agents
+ */
+struct imv_agent_if_t {
+
+ /**
+ * Implements the TNC_IMV_ProvideBindFunction function of the IMV
+ *
+ * @param bind_function Function offered by the TNCS
+ * @return TNC result code
+ */
+ TNC_Result (*bind_functions)(imv_agent_if_t *this,
+ TNC_TNCS_BindFunctionPointer bind_function);
+
+ /**
+ * Implements the TNC_IMV_NotifyConnectionChange() function of the IMV
+ *
+ * @param id Network connection ID assigned by TNCS
+ * @param new_state New connection state to be set
+ * @return TNC result code
+ */
+ TNC_Result (*notify_connection_change)(imv_agent_if_t *this,
+ TNC_ConnectionID id,
+ TNC_ConnectionState new_state);
+
+ /**
+ * Implements the TNC_IMV_ReceiveMessage() function of the IMV
+ *
+ * @param id Network connection ID assigned by TNCS
+ * @param msg_type PA-TNC message type
+ * @param msg Received message
+ * @return TNC result code
+ */
+ TNC_Result (*receive_message)(imv_agent_if_t *this, TNC_ConnectionID id,
+ TNC_MessageType msg_type, chunk_t msg);
+
+ /**
+ * Implements the TNC_IMV_ReceiveMessageLong() function of the IMV
+ *
+ * @param id Network connection ID assigned by TNCS
+ * @param src_imc_id ID of source IMC
+ * @param dst_imv_id ID of destination IMV
+ * @param msg_vid Vendor ID of message type
+ * @param msg_subtype PA-TNC message subtype
+ * @param msg Received message
+ * @return TNC result code
+ */
+ TNC_Result (*receive_message_long)(imv_agent_if_t *this,
+ TNC_ConnectionID id,
+ TNC_UInt32 src_imc_id,
+ TNC_UInt32 dst_imv_id,
+ TNC_VendorID msg_vid,
+ TNC_MessageSubtype msg_subtype,
+ chunk_t msg);
+
+ /**
+ * Implements the TNC_IMV_BatchEnding() function of the IMV
+ *
+ * @param id Network connection ID assigned by TNCS
+ * @return TNC result code
+ */
+ TNC_Result (*batch_ending)(imv_agent_if_t *this, TNC_ConnectionID id);
+
+ /**
+ * Implements the TNC_IMV_SolicitRecommendation() function of the IMV
+ *
+ * @param id Network connection ID assigned by TNCS
+ * @return TNC result code
+ */
+ TNC_Result (*solicit_recommendation)(imv_agent_if_t *this,
+ TNC_ConnectionID id);
+
+ /**
+ * Destroys an imv_agent_if_t object
+ */
+ void (*destroy)(imv_agent_if_t *this);
+
+};
+
+/**
+ * Creates the an IMV agent
+ *
+ * @param name Name of the IMV
+ * @param id ID of the IMV
+ * @param actual_version TNC IF-IMV version
+ */
+imv_agent_if_t* imv_agent_if_create(const char* name, TNC_IMVID id,
+ TNC_Version *actual_version);
+
+#endif /** IMV_AGENT_IF_H_ @}*/
static const char imv_name[] = "OS";
-static imv_os_agent_t *imv_agent;
+static imv_agent_if_t *imv_agent;
/*
* see section 3.8.1 of TCG TNC IF-IMV Specification 1.3
return TNC_RESULT_ALREADY_INITIALIZED;
}
- imv_agent =imv_os_agent_create(imv_name, imv_id, actual_version);
+ imv_agent = imv_os_agent_create(imv_name, imv_id, actual_version);
if (!imv_agent)
{
/**
* Public members of imv_os_agent_t
*/
- imv_os_agent_t public;
+ imv_agent_if_t public;
/**
* IMV agent responsible for generic functions
};
-METHOD(imv_os_agent_t, bind_functions, TNC_Result,
+METHOD(imv_agent_if_t, bind_functions, TNC_Result,
private_imv_os_agent_t *this, TNC_TNCS_BindFunctionPointer bind_function)
{
return this->agent->bind_functions(this->agent, bind_function);
}
-METHOD(imv_os_agent_t, notify_connection_change, TNC_Result,
+METHOD(imv_agent_if_t, notify_connection_change, TNC_Result,
private_imv_os_agent_t *this, TNC_ConnectionID id,
TNC_ConnectionState new_state)
{
return result;
}
-METHOD(imv_os_agent_t, receive_message, TNC_Result,
+METHOD(imv_agent_if_t, receive_message, TNC_Result,
private_imv_os_agent_t *this, TNC_ConnectionID id,
TNC_MessageType msg_type, chunk_t msg)
{
return result;
}
-METHOD(imv_os_agent_t, receive_message_long, TNC_Result,
+METHOD(imv_agent_if_t, receive_message_long, TNC_Result,
private_imv_os_agent_t *this, TNC_ConnectionID id,
TNC_UInt32 src_imc_id, TNC_UInt32 dst_imv_id,
TNC_VendorID msg_vid, TNC_MessageSubtype msg_subtype, chunk_t msg)
return attr;
}
-METHOD(imv_os_agent_t, batch_ending, TNC_Result,
+METHOD(imv_agent_if_t, batch_ending, TNC_Result,
private_imv_os_agent_t *this, TNC_ConnectionID id)
{
imv_msg_t *out_msg;
return result;
}
-METHOD(imv_os_agent_t, solicit_recommendation, TNC_Result,
+METHOD(imv_agent_if_t, solicit_recommendation, TNC_Result,
private_imv_os_agent_t *this, TNC_ConnectionID id)
{
imv_state_t *state;
return this->agent->provide_recommendation(this->agent, state);
}
-METHOD(imv_os_agent_t, destroy, void,
+METHOD(imv_agent_if_t, destroy, void,
private_imv_os_agent_t *this)
{
DESTROY_IF(this->agent);
/**
* Described in header.
*/
-imv_os_agent_t *imv_os_agent_create(const char *name, TNC_IMVID id,
+imv_agent_if_t *imv_os_agent_create(const char *name, TNC_IMVID id,
TNC_Version *actual_version)
{
private_imv_os_agent_t *this;
#ifndef IMV_OS_AGENT_H_
#define IMV_OS_AGENT_H_
-#include <imv/imv_state.h>
-#include <imv/imv_msg.h>
-
-#include <tncif.h>
-
-typedef struct imv_os_agent_t imv_os_agent_t;
-
-/**
- * Public interface of the OS IMV agent
- */
-struct imv_os_agent_t {
-
- /**
- * Implements the TNC_IMV_ProvideBindFunction function of the OS IMV
- *
- * @param bind_function Function offered by the TNCS
- * @return TNC result code
- */
- TNC_Result (*bind_functions)(imv_os_agent_t *this,
- TNC_TNCS_BindFunctionPointer bind_function);
-
- /**
- * Implements the TNC_IMV_NotifyConnectionChange() function of the OS IMV
- *
- * @param id Network connection ID assigned by TNCS
- * @param new_state New connection state to be set
- * @return TNC result code
- */
- TNC_Result (*notify_connection_change)(imv_os_agent_t *this,
- TNC_ConnectionID id,
- TNC_ConnectionState new_state);
-
- /**
- * Implements the TNC_IMV_ReceiveMessage() function of the OS IMV
- *
- * @param id Network connection ID assigned by TNCS
- * @param msg_type PA-TNC message type
- * @param msg Received message
- * @return TNC result code
- */
- TNC_Result (*receive_message)(imv_os_agent_t *this, TNC_ConnectionID id,
- TNC_MessageType msg_type, chunk_t msg);
-
- /**
- * Implements the TNC_IMV_ReceiveMessageLong() function of the OS IMV
- *
- * @param id Network connection ID assigned by TNCS
- * @param src_imc_id ID of source IMC
- * @param dst_imv_id ID of destination IMV
- * @param msg_vid Vendor ID of message type
- * @param msg_subtype PA-TNC message subtype
- * @param msg Received message
- * @return TNC result code
- */
- TNC_Result (*receive_message_long)(imv_os_agent_t *this,
- TNC_ConnectionID id,
- TNC_UInt32 src_imc_id,
- TNC_UInt32 dst_imv_id,
- TNC_VendorID msg_vid,
- TNC_MessageSubtype msg_subtype,
- chunk_t msg);
-
- /**
- * Implements the TNC_IMV_BatchEnding() function of the OS IMV
- *
- * @param id Network connection ID assigned by TNCS
- * @return TNC result code
- */
- TNC_Result (*batch_ending)(imv_os_agent_t *this, TNC_ConnectionID id);
-
- /**
- * Implements the TNC_IMV_SolicitRecommendation() function of the OS IMV
- *
- * @param id Network connection ID assigned by TNCS
- * @return TNC result code
- */
- TNC_Result (*solicit_recommendation)(imv_os_agent_t *this,
- TNC_ConnectionID id);
-
- /**
- * Destroys an imv_os_agent_t object
- */
- void (*destroy)(imv_os_agent_t *this);
-
-};
+#include <imv/imv_agent_if.h>
/**
- * Creates the an OS IMV agent
+ * Creates an OS IMV agent
*
* @param name Name of the IMV
* @param id ID of the IMV
* @param actual_version TNC IF-IMV version
*/
-imv_os_agent_t* imv_os_agent_create(const char* name, TNC_IMVID id,
+imv_agent_if_t* imv_os_agent_create(const char* name, TNC_IMVID id,
TNC_Version *actual_version);
#endif /** IMV_OS_AGENT_H_ @}*/