abort if one of the IMCs or IMVs fail to initialize
This commit is contained in:
@@ -90,11 +90,12 @@ METHOD(imc_manager_t, remove_, imc_t*,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imc_manager_t, notify_connection_change, void,
|
METHOD(imc_manager_t, notify_connection_change, void,
|
||||||
private_tnc_imc_manager_t *this, TNC_ConnectionID id,
|
private_tnc_imc_manager_t *this, TNC_ConnectionID id,
|
||||||
TNC_ConnectionState state)
|
TNC_ConnectionState state)
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
imc_t *imc;
|
imc_t *imc;
|
||||||
@@ -208,8 +209,5 @@ imc_manager_t* tnc_imc_manager_create(void)
|
|||||||
.next_imc_id = 1,
|
.next_imc_id = 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,26 @@ plugin_t *tnc_imc_plugin_create()
|
|||||||
/* Create IMC manager */
|
/* Create IMC manager */
|
||||||
charon->imcs = tnc_imc_manager_create();
|
charon->imcs = tnc_imc_manager_create();
|
||||||
|
|
||||||
/* Create and register IMCs */
|
/**
|
||||||
name = "Dummy";
|
* Create, register and initialize IMCs
|
||||||
filename = "/usr/local/lib/libdummyimc.so";
|
* Abort if one of the IMCs fails to initialize successfully
|
||||||
imc = tnc_imc_create(name, filename);
|
*/
|
||||||
if (imc)
|
|
||||||
{
|
{
|
||||||
|
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))
|
if (!charon->imcs->add(charon->imcs, imc))
|
||||||
{
|
{
|
||||||
imc->destroy(imc);
|
imc->destroy(imc);
|
||||||
|
charon->imcs->destroy(charon->imcs);
|
||||||
|
free(this);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &this->plugin;
|
return &this->plugin;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ METHOD(imv_manager_t, add, bool,
|
|||||||
this->imvs->remove_last(this->imvs, (void**)&imv);
|
this->imvs->remove_last(this->imvs, (void**)&imv);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ METHOD(imv_manager_t, remove_, imv_t*,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(imv_manager_t, notify_connection_change, void,
|
METHOD(imv_manager_t, notify_connection_change, void,
|
||||||
@@ -192,8 +194,5 @@ imv_manager_t* tnc_imv_manager_create(void)
|
|||||||
.next_imv_id = 1,
|
.next_imv_id = 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,15 +47,27 @@ plugin_t *tnc_imv_plugin_create()
|
|||||||
/* Create IMV manager */
|
/* Create IMV manager */
|
||||||
charon->imvs = tnc_imv_manager_create();
|
charon->imvs = tnc_imv_manager_create();
|
||||||
|
|
||||||
/* Create and register IMVs */
|
/**
|
||||||
name = "Dummy";
|
* Create, register and initialize IMVs
|
||||||
filename = "/usr/local/lib/libdummyimv.so";
|
* Abort if one of the IMVs fails to initialize successfully
|
||||||
imv = tnc_imv_create(name, filename);
|
*/
|
||||||
if (imv)
|
|
||||||
{
|
{
|
||||||
|
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))
|
if (!charon->imvs->add(charon->imvs, imv))
|
||||||
{
|
{
|
||||||
imv->destroy(imv);
|
imv->destroy(imv);
|
||||||
|
charon->imvs->destroy(charon->imvs);
|
||||||
|
free(this);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &this->plugin;
|
return &this->plugin;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ struct imv_manager_t {
|
|||||||
* @param id ID of IMV instance
|
* @param id ID of IMV instance
|
||||||
* @return removed IMC 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
|
* Notify all IMV instances
|
||||||
|
|||||||
Reference in New Issue
Block a user