}
}
enumerator->destroy(enumerator);
+ return NULL;
}
METHOD(imc_manager_t, notify_connection_change, void,
private_tnc_imc_manager_t *this, TNC_ConnectionID id,
- TNC_ConnectionState state)
+ TNC_ConnectionState state)
{
enumerator_t *enumerator;
imc_t *imc;
.next_imc_id = 1,
);
-
return &this->public;
}
-
-
/* Create IMC manager */
charon->imcs = tnc_imc_manager_create();
- /* Create and register IMCs */
- name = "Dummy";
- filename = "/usr/local/lib/libdummyimc.so";
- imc = tnc_imc_create(name, filename);
- if (imc)
+ /**
+ * Create, register and initialize IMCs
+ * Abort if one of the IMCs fails to initialize successfully
+ */
{
+ name = "Dummy";
+ filename = "/usr/local/lib/libdummyimc.so";
+ imc = tnc_imc_create(name, filename);
+ if (!imc)
+ {
+ charon->imcs->destroy(charon->imcs);
+ free(this);
+ return NULL;
+ }
if (!charon->imcs->add(charon->imcs, imc))
{
imc->destroy(imc);
+ charon->imcs->destroy(charon->imcs);
+ free(this);
+ return NULL;
}
}
return &this->plugin;
this->imvs->remove_last(this->imvs, (void**)&imv);
return FALSE;
}
+
return TRUE;
}
}
}
enumerator->destroy(enumerator);
+ return NULL;
}
METHOD(imv_manager_t, notify_connection_change, void,
.next_imv_id = 1,
);
-
return &this->public;
}
-
-
/* Create IMV manager */
charon->imvs = tnc_imv_manager_create();
- /* Create and register IMVs */
- name = "Dummy";
- filename = "/usr/local/lib/libdummyimv.so";
- imv = tnc_imv_create(name, filename);
- if (imv)
+ /**
+ * Create, register and initialize IMVs
+ * Abort if one of the IMVs fails to initialize successfully
+ */
{
+ name = "Dummy";
+ filename = "/usr/local/lib/libdummyimv.so";
+ imv = tnc_imv_create(name, filename);
+
+ if (!imv)
+ {
+ charon->imvs->destroy(charon->imvs);
+ free(this);
+ return NULL;
+ }
if (!charon->imvs->add(charon->imvs, imv))
{
imv->destroy(imv);
+ charon->imvs->destroy(charon->imvs);
+ free(this);
+ return NULL;
}
}
return &this->plugin;
* @param id ID of IMV instance
* @return removed IMC instance
*/
- void (*remove)(imv_manager_t *this, TNC_IMVID id);
+ imv_t* (*remove)(imv_manager_t *this, TNC_IMVID id);
/**
* Notify all IMV instances