support of reportMessageTypes() function
[strongswan.git] / src / libcharon / plugins / tnc_imv / tnc_imv_manager.c
index 44849c1..a5309e4 100644 (file)
@@ -70,7 +70,7 @@ METHOD(imv_manager_t, add, bool,
 
 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;
@@ -86,6 +86,29 @@ METHOD(imv_manager_t, notify_connection_change, void,
        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)
 {
@@ -116,6 +139,7 @@ imv_manager_t* tnc_imv_manager_create(void)
                .public = {
                        .add = _add,
                        .notify_connection_change = _notify_connection_change,
+                       .set_message_types = _set_message_types,
                        .destroy = _destroy,
         },
                .imvs = linked_list_create(),