msg_flags, msg, msg_len, msg_vid, msg_subtype);
}
+/**
+ * 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
*/
{
*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;
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);
}
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);
}
}
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,
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;
}
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,
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))
{
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;
* 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
* @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,
* 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,