* ID of loaded IMC
*/
TNC_IMCID id;
+
+ /**
+ * List of message types supported by IMC
+ */
+ TNC_MessageTypeList supported_types;
+
+ /**
+ * Number of supported message types
+ */
+ TNC_UInt32 type_count;
};
METHOD(imc_t, set_id, void,
return this->name;
}
+METHOD(imc_t, set_message_types, void,
+ private_tnc_imc_t *this, TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count)
+{
+ free(this->supported_types);
+ this->supported_types = NULL;
+ this->type_count = type_count;
+ if (type_count && supported_types)
+ {
+ size_t size = type_count * sizeof(TNC_MessageType);
+
+ this->supported_types = malloc(size);
+ memcpy(this->supported_types, supported_types, size);
+ }
+}
+
METHOD(imc_t, destroy, void,
private_tnc_imc_t *this)
{
free(this->name);
+ free(this->supported_types);
free(this);
}
.set_id = _set_id,
.get_id = _get_id,
.get_name = _get_name,
+ .set_message_types = _set_message_types,
.destroy = _destroy,
},
);
TNC_UInt32 type_count)
{
DBG2(DBG_TNC,"TNCC_ReportMessageTypes %u %u", imc_id, type_count);
- return TNC_RESULT_SUCCESS;
+ return charon->imcs->set_message_types(charon->imcs, imc_id,
+ supported_types, type_count);
}
/**
enumerator->destroy(enumerator);
}
+METHOD(imc_manager_t, set_message_types, TNC_Result,
+ private_tnc_imc_manager_t *this, TNC_IMCID id,
+ TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count)
+{
+ enumerator_t *enumerator;
+ imc_t *imc;
+ TNC_Result result = TNC_RESULT_FATAL;
+
+ enumerator = this->imcs->create_enumerator(this->imcs);
+ while (enumerator->enumerate(enumerator, &imc))
+ {
+ if (id == imc->get_id(imc))
+ {
+ imc->set_message_types(imc, supported_types, type_count);
+ result = TNC_RESULT_SUCCESS;
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ return result;
+}
+
+
METHOD(imc_manager_t, destroy, void,
private_tnc_imc_manager_t *this)
{
.add = _add,
.notify_connection_change = _notify_connection_change,
.begin_handshake = _begin_handshake,
+ .set_message_types = _set_message_types,
.destroy = _destroy,
},
.imcs = linked_list_create(),
* ID of loaded IMV
*/
TNC_IMVID id;
+
+ /**
+ * List of message types supported by IMC
+ */
+ TNC_MessageTypeList supported_types;
+
+ /**
+ * Number of supported message types
+ */
+ TNC_UInt32 type_count;
};
METHOD(imv_t, set_id, void,
return this->name;
}
+METHOD(imv_t, set_message_types, void,
+ private_tnc_imv_t *this, TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count)
+{
+ free(this->supported_types);
+ this->supported_types = NULL;
+ this->type_count = type_count;
+ if (type_count && supported_types)
+ {
+ size_t size = type_count * sizeof(TNC_MessageType);
+
+ this->supported_types = malloc(size);
+ memcpy(this->supported_types, supported_types, size);
+ }
+}
+
METHOD(imv_t, destroy, void,
private_tnc_imv_t *this)
{
free(this->name);
+ free(this->supported_types);
free(this);
}
.set_id = _set_id,
.get_id = _get_id,
.get_name = _get_name,
+ .set_message_types = _set_message_types,
.destroy = _destroy,
},
);
TNC_UInt32 type_count)
{
DBG2(DBG_TNC,"TNCS_ReportMessageTypes %u %u", imv_id, type_count);
- return TNC_RESULT_SUCCESS;
+ return charon->imvs->set_message_types(charon->imvs, imv_id,
+ supported_types, type_count);
}
/**
METHOD(imv_manager_t, notify_connection_change, void,
private_tnc_imv_manager_t *this, TNC_ConnectionID id,
- TNC_ConnectionState state)
+ TNC_ConnectionState state)
{
enumerator_t *enumerator;
imv_t *imv;
enumerator->destroy(enumerator);
}
+METHOD(imv_manager_t, set_message_types, TNC_Result,
+ private_tnc_imv_manager_t *this, TNC_IMVID id,
+ TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count)
+{
+ enumerator_t *enumerator;
+ imv_t *imv;
+ TNC_Result result = TNC_RESULT_FATAL;
+
+ enumerator = this->imvs->create_enumerator(this->imvs);
+ while (enumerator->enumerate(enumerator, &imv))
+ {
+ if (id == imv->get_id(imv))
+ {
+ imv->set_message_types(imv, supported_types, type_count);
+ result = TNC_RESULT_SUCCESS;
+ break;
+ }
+ }
+ enumerator->destroy(enumerator);
+ return result;
+}
+
METHOD(imv_manager_t, destroy, void,
private_tnc_imv_manager_t *this)
{
.public = {
.add = _add,
.notify_connection_change = _notify_connection_change,
+ .set_message_types = _set_message_types,
.destroy = _destroy,
},
.imvs = linked_list_create(),
* @param minVersion Minimum API version supported by TNCC
* @param maxVersion Maximum API version supported by TNCC
* @param OutActualVersion Mutually supported API version number
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*initialize)(TNC_IMCID imcID,
TNC_Version minVersion,
* @param imcID IMC ID assigned by TNCC
* @param connectionID Network connection ID assigned by TNCC
* @param newState New network connection state
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*notify_connection_change)(TNC_IMCID imcID,
TNC_ConnectionID connectionID,
*
* @param imcID IMC ID assigned by TNCC
* @param connectionID Network connection ID assigned by TNCC
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*begin_handshake)(TNC_IMCID imcID,
TNC_ConnectionID connectionID);
* @param message Reference to buffer containing message
* @param messageLength Number of octets in message
* @param messageType Message type of message
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*receive_message)(TNC_IMCID imcID,
TNC_ConnectionID connectionID,
*
* @param imcID IMC ID assigned by TNCC
* @param connectionID Network connection ID assigned by TNCC
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*batch_ending)(TNC_IMCID imcID,
TNC_ConnectionID connectionID);
* complete or the IMC reports TNC_RESULT_FATAL.
*
* @param imcID IMC ID assigned by TNCC
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*terminate)(TNC_IMCID imcID);
*
* @param imcID IMC ID assigned by TNCC
* @param bindFunction Pointer to TNC_TNCC_BindFunction
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*provide_bind_function)(TNC_IMCID imcID,
TNC_TNCC_BindFunctionPointer bindFunction);
/**
* Returns the ID of an imc_t object.
*
- * @result assigned IMC ID
+ * @return assigned IMC ID
*/
TNC_IMCID (*get_id)(imc_t *this);
/**
* Returns the name of an imc_t object.
*
- * @result name of IMC
+ * @return name of IMC
*/
char* (*get_name)(imc_t *this);
/**
+ * Sets the supported message types of an imc_t object.
+ *
+ * @param supported_types List of messages type supported by IMC
+ * @param type_count Number of supported message types
+ */
+ void (*set_message_types)(imc_t *this, TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count);
+
+ /**
* Destroys an imc_t object.
*/
void (*destroy)(imc_t *this);
void (*begin_handshake)(imc_manager_t *this, TNC_ConnectionID id);
/**
+ * Sets the supported message types reported by a given IMC
+ *
+ * @param id ID of reporting IMC
+ * @param supported_types List of messages type supported by IMC
+ * @param type_count Number of supported message types
+ * @return TNC result code
+ */
+ TNC_Result (*set_message_types)(imc_manager_t *this,
+ TNC_IMCID id,
+ TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count);
+
+ /**
* Destroy an IMC manager and all its controlled instances.
*/
void (*destroy)(imc_manager_t *this);
* @param minVersion Minimum API version supported
* @param maxVersion Maximum API version supported by TNCS
* @param OutActualVersion Mutually supported API version number
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*initialize)(TNC_IMVID imvID,
TNC_Version minVersion,
* @param imvID IMV ID assigned by TNCS
* @param connectionID Network connection ID assigned by TNCS
* @param newState New network connection state
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*notify_connection_change)(TNC_IMVID imvID,
TNC_ConnectionID connectionID,
*
* @param imvID IMV ID assigned by TNCS
* @param connectionID Network connection ID assigned by TNCS
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*solicit_recommendation)(TNC_IMVID imvID,
TNC_ConnectionID connectionID);
* @param message Reference to buffer containing message
* @param messageLength Number of octets in message
* @param messageType Message type of message
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*receive_message)(TNC_IMVID imvID,
TNC_ConnectionID connectionID,
*
* @param imvID IMV ID assigned by TNCS
* @param connectionID Network connection ID assigned by TNCS
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*batch_ending)(TNC_IMVID imvID,
TNC_ConnectionID connectionID);
* The TNC Server calls this function to close down the IMV.
*
* @param imvID IMV ID assigned by TNCS
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*terminate)(TNC_IMVID imvID);
*
* @param imvID IMV ID assigned by TNCS
* @param bindFunction Pointer to TNC_TNCS_BindFunction
- * @result TNC result code
+ * @return TNC result code
*/
TNC_Result (*provide_bind_function)(TNC_IMVID imvID,
TNC_TNCS_BindFunctionPointer bindFunction);
/**
* Returns the ID of an imv_t object.
*
- * @result IMV ID assigned by TNCS
+ * @return IMV ID assigned by TNCS
*/
TNC_IMVID (*get_id)(imv_t *this);
/**
* Returns the name of an imv_t object.
*
- * @result name of IMV
+ * @return name of IMV
*/
char* (*get_name)(imv_t *this);
/**
+ * Sets the supported message types of an imv_t object.
+ *
+ * @param supported_types List of messages type supported by IMV
+ * @param type_count Number of supported message types
+ */
+ void (*set_message_types)(imv_t *this, TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count);
+
+ /**
* Destroys an imv_t object.
*/
void (*destroy)(imv_t *this);
void (*notify_connection_change)(imv_manager_t *this,
TNC_ConnectionID id,
TNC_ConnectionState state);
+
+ /**
+ * Sets the supported message types reported by a given IMV
+ *
+ * @param id ID of reporting IMV
+ * @param supported_types List of messages type supported by IMV
+ * @param type_count Number of supported message types
+ * @return TNC result code
+ */
+ TNC_Result (*set_message_types)(imv_manager_t *this,
+ TNC_IMVID id,
+ TNC_MessageTypeList supported_types,
+ TNC_UInt32 type_count);
+
/**
* Destroy an IMV manager and all its controlled instances.
*/
*
* @param tnccs TNCCS connection instance
* @param send_message callback function adding a message to a TNCCS batch
- * @result assigned connection ID
+ * @return assigned connection ID
*/
TNC_ConnectionID (*create_connection)(tnccs_manager_t *this, tnccs_t *tnccs,
tnccs_send_message_t send_message);
* @param message message to be added
* @param message_len message length
* @param message_type message type
- * @result return code
+ * @return return code
*/
TNC_Result (*send_message)(tnccs_manager_t *this, TNC_ConnectionID id,
TNC_BufferReference message,