Added a get_name() function to plugin_t, create_plugin_enumerator enumerates over plugin_t
This commit is contained in:
+3
-2
@@ -834,7 +834,8 @@ DBG_dump(const char *label, const void *p, size_t len)
|
||||
|
||||
static void show_loaded_plugins()
|
||||
{
|
||||
char buf[BUF_LEN], *plugin;
|
||||
char buf[BUF_LEN];
|
||||
plugin_t *plugin;
|
||||
int len = 0;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
@@ -842,7 +843,7 @@ static void show_loaded_plugins()
|
||||
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
|
||||
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
|
||||
{
|
||||
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
|
||||
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
whack_log(RC_COMMENT, "loaded plugins: %s", buf);
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
#include "xauth_default_provider.h"
|
||||
#include "xauth_default_verifier.h"
|
||||
|
||||
METHOD(plugin_t, get_name, char*,
|
||||
xauth_plugin_t *this)
|
||||
{
|
||||
return "xauth";
|
||||
}
|
||||
|
||||
METHOD(plugin_t, destroy, void,
|
||||
xauth_plugin_t *this)
|
||||
{
|
||||
@@ -34,6 +40,7 @@ plugin_t *xauth_plugin_create()
|
||||
|
||||
INIT(this,
|
||||
.plugin = {
|
||||
.get_name = _get_name,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -239,7 +239,8 @@ options_t *options;
|
||||
*/
|
||||
static void print_plugins()
|
||||
{
|
||||
char buf[BUF_LEN], *plugin;
|
||||
char buf[BUF_LEN];
|
||||
plugin_t *plugin;
|
||||
int len = 0;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
@@ -247,7 +248,7 @@ static void print_plugins()
|
||||
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
|
||||
while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin))
|
||||
{
|
||||
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin);
|
||||
len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
DBG1(DBG_DMN, "loaded plugins: %s", buf);
|
||||
|
||||
Reference in New Issue
Block a user