added IMC/IMV support for send_message_long() and reserve_additional_id() functions
This commit is contained in:
@@ -98,18 +98,19 @@ METHOD(imc_t, get_id, TNC_IMCID,
|
||||
METHOD(imc_t, add_id, void,
|
||||
private_tnc_imc_t *this, TNC_IMCID id)
|
||||
{
|
||||
TNC_IMCID *new_id;
|
||||
void *pointer;
|
||||
|
||||
new_id = malloc_thing(TNC_IMCID);
|
||||
*new_id = id;
|
||||
this->additional_ids->insert_last(this->additional_ids, new_id);
|
||||
/* store the scalar value in the pointer */
|
||||
pointer = (void*)id;
|
||||
this->additional_ids->insert_last(this->additional_ids, pointer);
|
||||
}
|
||||
|
||||
METHOD(imc_t, has_id, bool,
|
||||
private_tnc_imc_t *this, TNC_IMCID id)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
TNC_IMCID *additional_id;
|
||||
TNC_IMCID additional_id;
|
||||
void *pointer;
|
||||
bool found = FALSE;
|
||||
|
||||
/* check primary IMC ID */
|
||||
@@ -126,9 +127,12 @@ METHOD(imc_t, has_id, bool,
|
||||
|
||||
/* check additional IMC IDs */
|
||||
enumerator = this->additional_ids->create_enumerator(this->additional_ids);
|
||||
while (enumerator->enumerate(enumerator, &additional_id))
|
||||
while (enumerator->enumerate(enumerator, &pointer))
|
||||
{
|
||||
if (id == *additional_id)
|
||||
/* interpret pointer as scalar value */
|
||||
additional_id = (TNC_UInt32)pointer;
|
||||
|
||||
if (id == additional_id)
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
@@ -305,7 +309,7 @@ METHOD(imc_t, destroy, void,
|
||||
{
|
||||
dlclose(this->handle);
|
||||
this->mutex->destroy(this->mutex);
|
||||
this->additional_ids->destroy_function(this->additional_ids, free);
|
||||
this->additional_ids->destroy(this->additional_ids);
|
||||
free(this->supported_vids);
|
||||
free(this->supported_subtypes);
|
||||
free(this->name);
|
||||
|
||||
@@ -154,8 +154,11 @@ METHOD(imc_manager_t, reserve_id, bool,
|
||||
{
|
||||
if (imc->get_id(imc))
|
||||
{
|
||||
imc->add_id(imc, this->next_imc_id++);
|
||||
found = TRUE;
|
||||
*new_id = this->next_imc_id++;
|
||||
imc->add_id(imc, *new_id);
|
||||
DBG2(DBG_TNC, "additional ID %u reserved for IMC with primary ID %u",
|
||||
*new_id, id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,11 @@ METHOD(imv_manager_t, reserve_id, bool,
|
||||
{
|
||||
if (imv->get_id(imv))
|
||||
{
|
||||
imv->add_id(imv, this->next_imv_id++);
|
||||
found = TRUE;
|
||||
*new_id = this->next_imv_id++;
|
||||
imv->add_id(imv, *new_id);
|
||||
DBG2(DBG_TNC, "additional ID %u reserved for IMV with primary ID %u",
|
||||
*new_id, id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user