implemented batch_ending() and solicit_recommendation() functions
This commit is contained in:
@@ -175,6 +175,23 @@ METHOD(imc_manager_t, receive_message, void,
|
|||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(imc_manager_t, batch_ending, void,
|
||||||
|
private_tnc_imc_manager_t *this, TNC_ConnectionID id)
|
||||||
|
{
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
imc_t *imc;
|
||||||
|
|
||||||
|
enumerator = this->imcs->create_enumerator(this->imcs);
|
||||||
|
while (enumerator->enumerate(enumerator, &imc))
|
||||||
|
{
|
||||||
|
if (imc->batch_ending)
|
||||||
|
{
|
||||||
|
imc->batch_ending(imc->get_id(imc), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(imc_manager_t, destroy, void,
|
METHOD(imc_manager_t, destroy, void,
|
||||||
private_tnc_imc_manager_t *this)
|
private_tnc_imc_manager_t *this)
|
||||||
{
|
{
|
||||||
@@ -210,6 +227,7 @@ imc_manager_t* tnc_imc_manager_create(void)
|
|||||||
.begin_handshake = _begin_handshake,
|
.begin_handshake = _begin_handshake,
|
||||||
.set_message_types = _set_message_types,
|
.set_message_types = _set_message_types,
|
||||||
.receive_message = _receive_message,
|
.receive_message = _receive_message,
|
||||||
|
.batch_ending = _batch_ending,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.imcs = linked_list_create(),
|
.imcs = linked_list_create(),
|
||||||
|
|||||||
@@ -140,6 +140,20 @@ METHOD(imv_manager_t, set_message_types, TNC_Result,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(imv_manager_t, solicit_recommendation, void,
|
||||||
|
private_tnc_imv_manager_t *this, TNC_ConnectionID id)
|
||||||
|
{
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
imv_t *imv;
|
||||||
|
|
||||||
|
enumerator = this->imvs->create_enumerator(this->imvs);
|
||||||
|
while (enumerator->enumerate(enumerator, &imv))
|
||||||
|
{
|
||||||
|
imv->solicit_recommendation(imv->get_id(imv), id);
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(imv_manager_t, receive_message, void,
|
METHOD(imv_manager_t, receive_message, void,
|
||||||
private_tnc_imv_manager_t *this, TNC_ConnectionID connection_id,
|
private_tnc_imv_manager_t *this, TNC_ConnectionID connection_id,
|
||||||
TNC_BufferReference message,
|
TNC_BufferReference message,
|
||||||
@@ -161,6 +175,23 @@ METHOD(imv_manager_t, receive_message, void,
|
|||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(imv_manager_t, batch_ending, void,
|
||||||
|
private_tnc_imv_manager_t *this, TNC_ConnectionID id)
|
||||||
|
{
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
imv_t *imv;
|
||||||
|
|
||||||
|
enumerator = this->imvs->create_enumerator(this->imvs);
|
||||||
|
while (enumerator->enumerate(enumerator, &imv))
|
||||||
|
{
|
||||||
|
if (imv->batch_ending)
|
||||||
|
{
|
||||||
|
imv->batch_ending(imv->get_id(imv), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(imv_manager_t, destroy, void,
|
METHOD(imv_manager_t, destroy, void,
|
||||||
private_tnc_imv_manager_t *this)
|
private_tnc_imv_manager_t *this)
|
||||||
{
|
{
|
||||||
@@ -194,7 +225,9 @@ imv_manager_t* tnc_imv_manager_create(void)
|
|||||||
.get_count = _get_count,
|
.get_count = _get_count,
|
||||||
.notify_connection_change = _notify_connection_change,
|
.notify_connection_change = _notify_connection_change,
|
||||||
.set_message_types = _set_message_types,
|
.set_message_types = _set_message_types,
|
||||||
|
.solicit_recommendation = _solicit_recommendation,
|
||||||
.receive_message = _receive_message,
|
.receive_message = _receive_message,
|
||||||
|
.batch_ending = _batch_ending,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.imvs = linked_list_create(),
|
.imvs = linked_list_create(),
|
||||||
|
|||||||
@@ -100,11 +100,13 @@ METHOD(tls_t, process, status_t,
|
|||||||
{
|
{
|
||||||
charon->imvs->receive_message(charon->imvs, this->connection_id,
|
charon->imvs->receive_message(charon->imvs, this->connection_id,
|
||||||
pos, len, 0x0080ab31);
|
pos, len, 0x0080ab31);
|
||||||
|
charon->imvs->batch_ending(charon->imvs, this->connection_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
charon->imcs->receive_message(charon->imcs, this->connection_id,
|
charon->imcs->receive_message(charon->imcs, this->connection_id,
|
||||||
pos, len, 0x0080ab31);
|
pos, len, 0x0080ab31);
|
||||||
|
charon->imcs->batch_ending(charon->imcs, this->connection_id);
|
||||||
}
|
}
|
||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ struct imc_manager_t {
|
|||||||
/**
|
/**
|
||||||
* Begin a handshake between the IMCs and a connection
|
* Begin a handshake between the IMCs and a connection
|
||||||
*
|
*
|
||||||
* @param id Connection ID
|
* @param id connection ID
|
||||||
*/
|
*/
|
||||||
void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id);
|
void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id);
|
||||||
|
|
||||||
@@ -98,6 +98,15 @@ struct imc_manager_t {
|
|||||||
TNC_UInt32 message_len,
|
TNC_UInt32 message_len,
|
||||||
TNC_MessageType message_type);
|
TNC_MessageType message_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify all IMCs that all IMV messages received in a batch have been
|
||||||
|
* delivered and this is the IMCs last chance to send a message in the
|
||||||
|
* batch of IMC messages currently being collected.
|
||||||
|
*
|
||||||
|
* @param id connection ID
|
||||||
|
*/
|
||||||
|
void (*batch_ending)(imc_manager_t *this, TNC_ConnectionID id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy an IMC manager and all its controlled instances.
|
* Destroy an IMC manager and all its controlled instances.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -77,6 +77,13 @@ struct imv_manager_t {
|
|||||||
TNC_MessageTypeList supported_types,
|
TNC_MessageTypeList supported_types,
|
||||||
TNC_UInt32 type_count);
|
TNC_UInt32 type_count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Solicit recommendations from IMVs that have not yet provided one
|
||||||
|
*
|
||||||
|
* @param id connection ID
|
||||||
|
*/
|
||||||
|
void (*solicit_recommendation)(imv_manager_t *this, TNC_ConnectionID id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delivers a message to interested IMVs.
|
* Delivers a message to interested IMVs.
|
||||||
*
|
*
|
||||||
@@ -91,6 +98,15 @@ struct imv_manager_t {
|
|||||||
TNC_UInt32 message_len,
|
TNC_UInt32 message_len,
|
||||||
TNC_MessageType message_type);
|
TNC_MessageType message_type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify all IMVs that all IMC messages received in a batch have been
|
||||||
|
* delivered and this is the IMVs last chance to send a message in the
|
||||||
|
* batch of IMV messages currently being collected.
|
||||||
|
*
|
||||||
|
* @param id connection ID
|
||||||
|
*/
|
||||||
|
void (*batch_ending)(imv_manager_t *this, TNC_ConnectionID id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy an IMV manager and all its controlled instances.
|
* Destroy an IMV manager and all its controlled instances.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user