aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c49
-rw-r--r--src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c4
-rw-r--r--src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c14
-rw-r--r--src/libtnccs/tnc/tnccs/tnccs_manager.h14
4 files changed, 67 insertions, 14 deletions
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 95293c957..90a607ccc 100644
--- a/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
+++ b/src/libcharon/plugins/tnc_imc/tnc_imc_bind_function.c
@@ -121,6 +121,47 @@ TNC_Result TNC_TNCC_SendMessageLong(TNC_IMCID imc_id,
}
/**
+ * Called by the IMC to get the value of an attribute associated with a
+ * connection or with the TNCC as a whole.
+ */
+TNC_Result TNC_TNCC_GetAttribute(TNC_IMCID imc_id,
+ TNC_ConnectionID connection_id,
+ TNC_AttributeID attribute_id,
+ TNC_UInt32 buffer_len,
+ TNC_BufferReference buffer,
+ TNC_UInt32 *out_value_len)
+{
+ if (!tnc->imcs->is_registered(tnc->imcs, imc_id))
+ {
+ DBG1(DBG_TNC, "ignoring GetAttribute() from unregistered IMC %u",
+ imc_id);
+ return TNC_RESULT_INVALID_PARAMETER;
+ }
+ return tnc->tnccs->get_attribute(tnc->tnccs, TRUE, imc_id, connection_id,
+ attribute_id, buffer_len, buffer, out_value_len);
+}
+
+/**
+ * Called by the IMC to set the value of an attribute associated with a
+ * connection or with the TNCC as a whole.
+ */
+TNC_Result TNC_TNCC_SetAttribute(TNC_IMCID imc_id,
+ TNC_ConnectionID connection_id,
+ TNC_AttributeID attribute_id,
+ TNC_UInt32 buffer_len,
+ TNC_BufferReference buffer)
+{
+ if (!tnc->imcs->is_registered(tnc->imcs, imc_id))
+ {
+ DBG1(DBG_TNC, "ignoring SetAttribute() from unregistered IMC %u",
+ imc_id);
+ return TNC_RESULT_INVALID_PARAMETER;
+ }
+ return tnc->tnccs->set_attribute(tnc->tnccs, TRUE, imc_id, connection_id,
+ attribute_id, buffer_len, buffer);
+}
+
+/**
* Called by the IMC when it wants to reserve an additional IMC ID for itself
*/
TNC_Result TNC_TNCC_ReserveAdditionalIMCID(TNC_IMCID imc_id, TNC_UInt32 *new_id)
@@ -161,6 +202,14 @@ TNC_Result TNC_TNCC_BindFunction(TNC_IMCID id,
{
*function_pointer = (void*)TNC_TNCC_SendMessageLong;
}
+ else if (streq(function_name, "TNC_TNCC_GetAttribute"))
+ {
+ *function_pointer = (void*)TNC_TNCC_GetAttribute;
+ }
+ else if (streq(function_name, "TNC_TNCC_SetAttribute"))
+ {
+ *function_pointer = (void*)TNC_TNCC_SetAttribute;
+ }
else if (streq(function_name, "TNC_TNCC_ReserveAdditionalIMCID"))
{
*function_pointer = (void*)TNC_TNCC_ReserveAdditionalIMCID;
diff --git a/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
index f24aaac28..dd11c5009 100644
--- a/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
+++ b/src/libcharon/plugins/tnc_imv/tnc_imv_bind_function.c
@@ -157,7 +157,7 @@ TNC_Result TNC_TNCS_GetAttribute(TNC_IMVID imv_id,
imv_id);
return TNC_RESULT_INVALID_PARAMETER;
}
- return tnc->tnccs->get_attribute(tnc->tnccs, imv_id, connection_id,
+ return tnc->tnccs->get_attribute(tnc->tnccs, FALSE, imv_id, connection_id,
attribute_id, buffer_len, buffer, out_value_len);
}
@@ -177,7 +177,7 @@ TNC_Result TNC_TNCS_SetAttribute(TNC_IMVID imv_id,
imv_id);
return TNC_RESULT_INVALID_PARAMETER;
}
- return tnc->tnccs->set_attribute(tnc->tnccs, imv_id, connection_id,
+ return tnc->tnccs->set_attribute(tnc->tnccs, FALSE, imv_id, connection_id,
attribute_id, buffer_len, buffer);
}
diff --git a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
index e6674ae07..5a21556c0 100644
--- a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
+++ b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
@@ -368,7 +368,8 @@ METHOD(tnccs_manager_t, provide_recommendation, TNC_Result,
}
METHOD(tnccs_manager_t, get_attribute, TNC_Result,
- private_tnc_tnccs_manager_t *this, TNC_IMVID imv_id,
+ private_tnc_tnccs_manager_t *this, bool is_imc,
+ TNC_UInt32 imcv_id,
TNC_ConnectionID id,
TNC_AttributeID attribute_id,
TNC_UInt32 buffer_len,
@@ -379,7 +380,7 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
tnccs_connection_entry_t *entry;
recommendations_t *recs = NULL;
- if (id == TNC_CONNECTIONID_ANY ||
+ if (is_imc || id == TNC_CONNECTIONID_ANY ||
attribute_id != TNC_ATTRIBUTEID_PREFERRED_LANGUAGE)
{
return TNC_RESULT_INVALID_PARAMETER;
@@ -418,7 +419,8 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
}
METHOD(tnccs_manager_t, set_attribute, TNC_Result,
- private_tnc_tnccs_manager_t *this, TNC_IMVID imv_id,
+ private_tnc_tnccs_manager_t *this, bool is_imc,
+ TNC_UInt32 imcv_id,
TNC_ConnectionID id,
TNC_AttributeID attribute_id,
TNC_UInt32 buffer_len,
@@ -428,7 +430,7 @@ METHOD(tnccs_manager_t, set_attribute, TNC_Result,
tnccs_connection_entry_t *entry;
recommendations_t *recs = NULL;
- if (id == TNC_CONNECTIONID_ANY ||
+ if (is_imc || id == TNC_CONNECTIONID_ANY ||
(attribute_id != TNC_ATTRIBUTEID_REASON_STRING &&
attribute_id != TNC_ATTRIBUTEID_REASON_LANGUAGE))
{
@@ -454,11 +456,11 @@ METHOD(tnccs_manager_t, set_attribute, TNC_Result,
if (attribute_id == TNC_ATTRIBUTEID_REASON_STRING)
{
- return recs->set_reason_string(recs, imv_id, attribute);
+ return recs->set_reason_string(recs, imcv_id, attribute);
}
else
{
- return recs->set_reason_language(recs, imv_id, attribute);
+ return recs->set_reason_language(recs, imcv_id, attribute);
}
}
return TNC_RESULT_INVALID_PARAMETER;
diff --git a/src/libtnccs/tnc/tnccs/tnccs_manager.h b/src/libtnccs/tnc/tnccs/tnccs_manager.h
index 0720fb4ab..fb5eaf50a 100644
--- a/src/libtnccs/tnc/tnccs/tnccs_manager.h
+++ b/src/libtnccs/tnc/tnccs/tnccs_manager.h
@@ -142,7 +142,8 @@ struct tnccs_manager_t {
* Get the value of an attribute associated with a connection or with the
* TNCS as a whole.
*
- * @param imv_id ID of the IMV requesting the attribute
+ * @param is_imc TRUE if IMC, FALSE if IMV
+ * @param imcv_id ID of the IMC/IMV requesting the attribute
* @param id ID of target connection
* @param attribute_id ID of the requested attribute
* @param buffer_len length of the buffer in bytes
@@ -150,8 +151,8 @@ struct tnccs_manager_t {
* @param out_value_len actual length of the returned attribute
* @return return code
*/
- TNC_Result (*get_attribute)(tnccs_manager_t *this,
- TNC_IMVID imv_id,
+ TNC_Result (*get_attribute)(tnccs_manager_t *this, bool is_imc,
+ TNC_UInt32 imcv_id,
TNC_ConnectionID id,
TNC_AttributeID attribute_id,
TNC_UInt32 buffer_len,
@@ -162,15 +163,16 @@ struct tnccs_manager_t {
* Set the value of an attribute associated with a connection or with the
* TNCS as a whole.
*
- * @param imv_id ID of the IMV setting the attribute
+ * @param is_imc TRUE if IMC, FALSE if IMV
+ * @param imcv_id ID of the IMC/IMV setting the attribute
* @param id ID of target connection
* @param attribute_id ID of the attribute to be set
* @param buffer_len length of the buffer in bytes
* @param buffer pointer to the buffer
* @return return code
*/
- TNC_Result (*set_attribute)(tnccs_manager_t *this,
- TNC_IMVID imv_id,
+ TNC_Result (*set_attribute)(tnccs_manager_t *this, bool is_imc,
+ TNC_UInt32 imcv_id,
TNC_ConnectionID id,
TNC_AttributeID attribute_id,
TNC_UInt32 buffer_len,