implement GetAttribute() callback function
This commit is contained in:
@@ -67,6 +67,35 @@ TNC_Result TNC_TNCS_ProvideRecommendation(TNC_IMVID imv_id,
|
||||
connection_id, recommendation, evaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the IMV to get the value of an attribute associated with a
|
||||
* connection or with the TNCS as a whole.
|
||||
*/
|
||||
TNC_Result TNC_TNCS_GetAttribute(TNC_IMVID imv_id,
|
||||
TNC_ConnectionID connection_id,
|
||||
TNC_AttributeID attribute_id,
|
||||
TNC_UInt32 buffer_len,
|
||||
TNC_BufferReference buffer,
|
||||
TNC_UInt32 *out_value_len)
|
||||
{
|
||||
return charon->tnccs->get_attribute(charon->tnccs, imv_id, connection_id,
|
||||
attribute_id, buffer_len, buffer, out_value_len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the IMV to set the value of an attribute associated with a
|
||||
* connection or with the TNCS as a whole.
|
||||
*/
|
||||
TNC_Result TNC_TNCS_SetAttribute(TNC_IMVID imv_id,
|
||||
TNC_ConnectionID connection_id,
|
||||
TNC_AttributeID attribute_id,
|
||||
TNC_UInt32 buffer_len,
|
||||
TNC_BufferReference buffer)
|
||||
{
|
||||
return charon->tnccs->set_attribute(charon->tnccs, imv_id, connection_id,
|
||||
attribute_id, buffer_len, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the IMV when it needs a function pointer
|
||||
*/
|
||||
@@ -90,6 +119,14 @@ TNC_Result TNC_TNCS_BindFunction(TNC_IMVID id,
|
||||
{
|
||||
*function_pointer = (void*)TNC_TNCS_ProvideRecommendation;
|
||||
}
|
||||
else if (streq(function_name, "TNC_TNCS_GetAttribute"))
|
||||
{
|
||||
*function_pointer = (void*)TNC_TNCS_GetAttribute;
|
||||
}
|
||||
else if (streq(function_name, "TNC_TNCS_SetAttribute"))
|
||||
{
|
||||
*function_pointer = (void*)TNC_TNCS_SetAttribute;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TNC_RESULT_INVALID_PARAMETER;
|
||||
|
||||
@@ -61,6 +61,11 @@ struct private_tnc_imv_recommendations_t {
|
||||
* list of recommendations and evaluations provided by IMVs
|
||||
*/
|
||||
linked_list_t *recs;
|
||||
|
||||
/**
|
||||
* Preferred language for remediation messages
|
||||
*/
|
||||
chunk_t preferred_language;
|
||||
};
|
||||
|
||||
METHOD(recommendations_t, provide_recommendation, TNC_Result,
|
||||
@@ -251,11 +256,24 @@ METHOD(recommendations_t, have_recommendation, bool,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(recommendations_t, get_preferred_language, chunk_t,
|
||||
private_tnc_imv_recommendations_t *this)
|
||||
{
|
||||
return this->preferred_language;
|
||||
}
|
||||
|
||||
METHOD(recommendations_t, set_preferred_language, void,
|
||||
private_tnc_imv_recommendations_t *this, chunk_t pref_lang)
|
||||
{
|
||||
chunk_free(&this->preferred_language);
|
||||
this->preferred_language = chunk_clone(pref_lang);
|
||||
}
|
||||
|
||||
METHOD(recommendations_t, destroy, void,
|
||||
private_tnc_imv_recommendations_t *this)
|
||||
{
|
||||
this->recs->destroy_function(this->recs, free);
|
||||
free(this->preferred_language.ptr);
|
||||
free(this);
|
||||
}
|
||||
|
||||
@@ -273,6 +291,8 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
|
||||
.public = {
|
||||
.provide_recommendation = _provide_recommendation,
|
||||
.have_recommendation = _have_recommendation,
|
||||
.get_preferred_language = _get_preferred_language,
|
||||
.set_preferred_language = _set_preferred_language,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.recs = linked_list_create(),
|
||||
|
||||
Reference in New Issue
Block a user