ocsp.c ocsp.h \
packet.c packet.h \
pkcs7.c pkcs7.h \
+plugin_list.c plugin_list.h \
pluto.c pluto.h \
plutomain.c \
rcv_whack.c rcv_whack.h \
--- /dev/null
+/*
+ * Copyright (C) 2011 Martin Willi, revosec AG
+ * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include <whack.h>
+
+#include <library.h>
+#include <utils/linked_list.h>
+
+/**
+ * List loaded plugin information
+ */
+void plugin_list(void)
+{
+ plugin_feature_t *features, *fp;
+ enumerator_t *enumerator;
+ linked_list_t *list;
+ plugin_t *plugin;
+ int count, i;
+ bool loaded;
+ char *str;
+
+ whack_log(RC_COMMENT, " ");
+ whack_log(RC_COMMENT, "List of loaded Plugins:");
+ whack_log(RC_COMMENT, " ");
+
+ enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
+ while (enumerator->enumerate(enumerator, &plugin, &list))
+ {
+ whack_log(RC_COMMENT, "%s:", plugin->get_name(plugin));
+ if (plugin->get_features)
+ {
+ count = plugin->get_features(plugin, &features);
+ for (i = 0; i < count; i++)
+ {
+ str = plugin_feature_get_string(&features[i]);
+ switch (features[i].kind)
+ {
+ case FEATURE_PROVIDE:
+ fp = &features[i];
+ loaded = list->find_first(list, NULL,
+ (void**)&fp) == SUCCESS;
+ whack_log(RC_COMMENT, " %s%s",
+ str, loaded ? "" : " (not loaded)");
+ break;
+ case FEATURE_DEPENDS:
+ whack_log(RC_COMMENT, " %s", str);
+ break;
+ case FEATURE_SDEPEND:
+ whack_log(RC_COMMENT, " %s(soft)", str);
+ break;
+ default:
+ break;
+ }
+ free(str);
+ }
+ }
+ }
+ enumerator->destroy(enumerator);
+}
--- /dev/null
+/* Generates a list of all loaded plugins and their dependencies
+ * Copyright (C) 2011 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#ifndef _PLUGIN_LIST_H
+#define _PLUGIN_LIST_H
+
+extern void plugin_list(void);
+
+#endif /* _PLUGIN_LIST_H */
#include "myid.h"
#include "kernel_alg.h"
#include "ike_alg.h"
+#include "plugin_list.h"
#include "whack_attribute.h"
/* helper variables and function to decode strings from whack message */
kernel_alg_list();
}
+ if (msg.whack_list & LIST_PLUGINS)
+ {
+ plugin_list();
+ }
+
if (msg.whack_key)
{
/* add a public key */
" [--listcrls]"
" [--listocsp]"
" [--listcards]"
+ " [--listplugins]"
" [--listall]"
"\n\n"
"purge: whack"
LST_CRLS,
LST_OCSP,
LST_CARDS,
+ LST_PLUGINS,
LST_ALL,
# define LST_LAST LST_ALL /* last list option */
{ "listcrls", no_argument, NULL, LST_CRLS + OO },
{ "listocsp", no_argument, NULL, LST_OCSP + OO },
{ "listcards", no_argument, NULL, LST_CARDS + OO },
+ { "listplugins", no_argument, NULL, LST_PLUGINS + OO },
{ "listall", no_argument, NULL, LST_ALL + OO },
/* options for an end description */
case LST_CRLS: /* --listcrls */
case LST_OCSP: /* --listocsp */
case LST_CARDS: /* --listcards */
+ case LST_PLUGINS: /* --listplugins */
msg.whack_list |= LELEM(c - LST_ALGS);
continue;
#define LIST_CRLS 0x0200 /* list all crls */
#define LIST_OCSP 0x0400 /* list all ocsp cache entries */
#define LIST_CARDS 0x0800 /* list all smartcard records */
+#define LIST_PLUGINS 0x1000 /* list all plugins with dependencies */
-#define LIST_ALL LRANGES(LIST_ALGS, LIST_CARDS) /* all list options */
+#define LIST_ALL LRANGES(LIST_ALGS, LIST_PLUGINS) /* all list options */
/* options of whack --reread*** command */