plugin-loader: Add method to print loaded plugins on a given log level
This commit is contained in:
@@ -361,6 +361,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
DBG1(DBG_DMN, "Starting charon-cmd IKE client (strongSwan %s, %s %s, %s)",
|
DBG1(DBG_DMN, "Starting charon-cmd IKE client (strongSwan %s, %s %s, %s)",
|
||||||
VERSION, utsname.sysname, utsname.release, utsname.machine);
|
VERSION, utsname.sysname, utsname.release, utsname.machine);
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
/* add handler for SEGV and ILL,
|
/* add handler for SEGV and ILL,
|
||||||
* INT, TERM and HUP are handled by sigwait() in run() */
|
* INT, TERM and HUP are handled by sigwait() in run() */
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ int main(int argc, char *argv[])
|
|||||||
DBG1(DBG_DMN, "initialization failed - aborting charon-nm");
|
DBG1(DBG_DMN, "initialization failed - aborting charon-nm");
|
||||||
goto deinit;
|
goto deinit;
|
||||||
}
|
}
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
if (!charon->caps->drop(charon->caps))
|
if (!charon->caps->drop(charon->caps))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ int main(int argc, char *argv[])
|
|||||||
DBG1(DBG_DMN, "initialization failed - aborting %s", dmn_name);
|
DBG1(DBG_DMN, "initialization failed - aborting %s", dmn_name);
|
||||||
goto deinit;
|
goto deinit;
|
||||||
}
|
}
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
/* set global pidfile name depending on daemon name */
|
/* set global pidfile name depending on daemon name */
|
||||||
if (asprintf(&pidfile_name, IPSEC_PIDDIR"/%s.pid", dmn_name) < 0)
|
if (asprintf(&pidfile_name, IPSEC_PIDDIR"/%s.pid", dmn_name) < 0)
|
||||||
|
|||||||
@@ -398,6 +398,7 @@ int main(int argc, char *argv[])
|
|||||||
DBG1(DBG_DMN, "initialization failed - aborting charon");
|
DBG1(DBG_DMN, "initialization failed - aborting charon");
|
||||||
goto deinit;
|
goto deinit;
|
||||||
}
|
}
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
if (check_pidfile())
|
if (check_pidfile())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -518,6 +518,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
if (!load_certs(conftest->test, conftest->suite_dir))
|
if (!load_certs(conftest->test, conftest->suite_dir))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, void,
|
|||||||
library_deinit();
|
library_deinit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||||
|
|
||||||
/* add handler for SEGV and ILL etc. */
|
/* add handler for SEGV and ILL etc. */
|
||||||
action.sa_handler = segv_handler;
|
action.sa_handler = segv_handler;
|
||||||
|
|||||||
@@ -538,8 +538,6 @@ METHOD(daemon_t, initialize, bool,
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DBG1(DBG_DMN, "loaded plugins: %s",
|
|
||||||
lib->plugins->loaded_plugins(lib->plugins));
|
|
||||||
|
|
||||||
this->public.ike_sa_manager = ike_sa_manager_create();
|
this->public.ike_sa_manager = ike_sa_manager_create();
|
||||||
if (this->public.ike_sa_manager == NULL)
|
if (this->public.ike_sa_manager == NULL)
|
||||||
|
|||||||
@@ -1082,6 +1082,15 @@ METHOD(plugin_loader_t, loaded_plugins, char*,
|
|||||||
return this->loaded_plugins ?: "";
|
return this->loaded_plugins ?: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(plugin_loader_t, status, void,
|
||||||
|
private_plugin_loader_t *this, level_t level)
|
||||||
|
{
|
||||||
|
if (this->loaded_plugins)
|
||||||
|
{
|
||||||
|
dbg(DBG_LIB, level, "loaded plugins: %s", this->loaded_plugins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(plugin_loader_t, destroy, void,
|
METHOD(plugin_loader_t, destroy, void,
|
||||||
private_plugin_loader_t *this)
|
private_plugin_loader_t *this)
|
||||||
{
|
{
|
||||||
@@ -1109,6 +1118,7 @@ plugin_loader_t *plugin_loader_create()
|
|||||||
.create_plugin_enumerator = _create_plugin_enumerator,
|
.create_plugin_enumerator = _create_plugin_enumerator,
|
||||||
.has_feature = _has_feature,
|
.has_feature = _has_feature,
|
||||||
.loaded_plugins = _loaded_plugins,
|
.loaded_plugins = _loaded_plugins,
|
||||||
|
.status = _status,
|
||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
.plugins = linked_list_create(),
|
.plugins = linked_list_create(),
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
typedef struct plugin_loader_t plugin_loader_t;
|
typedef struct plugin_loader_t plugin_loader_t;
|
||||||
|
|
||||||
#include <collections/enumerator.h>
|
#include <collections/enumerator.h>
|
||||||
|
#include <utils/debug.h>
|
||||||
|
|
||||||
/* to avoid circular references we can't include plugin_feature.h */
|
/* to avoid circular references we can't include plugin_feature.h */
|
||||||
struct plugin_feature_t;
|
struct plugin_feature_t;
|
||||||
@@ -109,6 +110,13 @@ struct plugin_loader_t {
|
|||||||
*/
|
*/
|
||||||
char* (*loaded_plugins)(plugin_loader_t *this);
|
char* (*loaded_plugins)(plugin_loader_t *this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log status about loaded plugins and features.
|
||||||
|
*
|
||||||
|
* @param level log level to use
|
||||||
|
*/
|
||||||
|
void (*status)(plugin_loader_t *this, level_t level);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload loaded plugins, destroy plugin_loader instance.
|
* Unload loaded plugins, destroy plugin_loader instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -929,8 +929,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
exit_scepclient("plugin loading failed");
|
exit_scepclient("plugin loading failed");
|
||||||
}
|
}
|
||||||
DBG1(DBG_APP, " loaded plugins: %s",
|
lib->plugins->status(lib->plugins, LEVEL_DIAG);
|
||||||
lib->plugins->loaded_plugins(lib->plugins));
|
|
||||||
|
|
||||||
if ((filetype_out == 0) && (!request_ca_certificate))
|
if ((filetype_out == 0) && (!request_ca_certificate))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user