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)",
|
||||
VERSION, utsname.sysname, utsname.release, utsname.machine);
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
/* add handler for SEGV and ILL,
|
||||
* 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");
|
||||
goto deinit;
|
||||
}
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
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);
|
||||
goto deinit;
|
||||
}
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
/* set global pidfile name depending on daemon name */
|
||||
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");
|
||||
goto deinit;
|
||||
}
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
if (check_pidfile())
|
||||
{
|
||||
|
||||
@@ -518,6 +518,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
if (!load_certs(conftest->test, conftest->suite_dir))
|
||||
{
|
||||
return 1;
|
||||
|
||||
@@ -565,6 +565,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, void,
|
||||
library_deinit();
|
||||
return;
|
||||
}
|
||||
lib->plugins->status(lib->plugins, LEVEL_CTRL);
|
||||
|
||||
/* add handler for SEGV and ILL etc. */
|
||||
action.sa_handler = segv_handler;
|
||||
|
||||
@@ -538,8 +538,6 @@ METHOD(daemon_t, initialize, bool,
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
DBG1(DBG_DMN, "loaded plugins: %s",
|
||||
lib->plugins->loaded_plugins(lib->plugins));
|
||||
|
||||
this->public.ike_sa_manager = ike_sa_manager_create();
|
||||
if (this->public.ike_sa_manager == NULL)
|
||||
|
||||
@@ -1082,6 +1082,15 @@ METHOD(plugin_loader_t, loaded_plugins, char*,
|
||||
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,
|
||||
private_plugin_loader_t *this)
|
||||
{
|
||||
@@ -1109,6 +1118,7 @@ plugin_loader_t *plugin_loader_create()
|
||||
.create_plugin_enumerator = _create_plugin_enumerator,
|
||||
.has_feature = _has_feature,
|
||||
.loaded_plugins = _loaded_plugins,
|
||||
.status = _status,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.plugins = linked_list_create(),
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
typedef struct plugin_loader_t plugin_loader_t;
|
||||
|
||||
#include <collections/enumerator.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
/* to avoid circular references we can't include plugin_feature.h */
|
||||
struct plugin_feature_t;
|
||||
@@ -109,6 +110,13 @@ struct plugin_loader_t {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -929,8 +929,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
exit_scepclient("plugin loading failed");
|
||||
}
|
||||
DBG1(DBG_APP, " loaded plugins: %s",
|
||||
lib->plugins->loaded_plugins(lib->plugins));
|
||||
lib->plugins->status(lib->plugins, LEVEL_DIAG);
|
||||
|
||||
if ((filetype_out == 0) && (!request_ca_certificate))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user