Added a listplugins stroke command to show plugin features
This commit is contained in:
@@ -1206,6 +1206,57 @@ static void list_algs(FILE *out)
|
|||||||
fprintf(out, "\n");
|
fprintf(out, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List loaded plugin information
|
||||||
|
*/
|
||||||
|
static void list_plugins(FILE *out)
|
||||||
|
{
|
||||||
|
plugin_feature_t *features, *fp;
|
||||||
|
enumerator_t *enumerator;
|
||||||
|
linked_list_t *list;
|
||||||
|
plugin_t *plugin;
|
||||||
|
int count, i;
|
||||||
|
bool loaded;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
fprintf(out, "\n");
|
||||||
|
fprintf(out, "List of loaded plugins:\n");
|
||||||
|
|
||||||
|
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
|
||||||
|
while (enumerator->enumerate(enumerator, &plugin, &list))
|
||||||
|
{
|
||||||
|
fprintf(out, "%s:\n", 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;
|
||||||
|
fprintf(out, " %s%s\n",
|
||||||
|
str, loaded ? "" : " (not loaded)");
|
||||||
|
break;
|
||||||
|
case FEATURE_DEPENDS:
|
||||||
|
fprintf(out, " %s\n", str);
|
||||||
|
break;
|
||||||
|
case FEATURE_SDEPEND:
|
||||||
|
fprintf(out, " %s(soft)\n", str);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumerator->destroy(enumerator);
|
||||||
|
}
|
||||||
|
|
||||||
METHOD(stroke_list_t, list, void,
|
METHOD(stroke_list_t, list, void,
|
||||||
private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
|
private_stroke_list_t *this, stroke_msg_t *msg, FILE *out)
|
||||||
{
|
{
|
||||||
@@ -1277,6 +1328,10 @@ METHOD(stroke_list_t, list, void,
|
|||||||
{
|
{
|
||||||
list_algs(out);
|
list_algs(out);
|
||||||
}
|
}
|
||||||
|
if (msg->list.flags & LIST_PLUGINS)
|
||||||
|
{
|
||||||
|
list_plugins(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ static int list_flags[] = {
|
|||||||
LIST_CRLS,
|
LIST_CRLS,
|
||||||
LIST_OCSP,
|
LIST_OCSP,
|
||||||
LIST_ALGS,
|
LIST_ALGS,
|
||||||
|
LIST_PLUGINS,
|
||||||
LIST_ALL
|
LIST_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -531,6 +532,7 @@ int main(int argc, char *argv[])
|
|||||||
case STROKE_LIST_CRLS:
|
case STROKE_LIST_CRLS:
|
||||||
case STROKE_LIST_OCSP:
|
case STROKE_LIST_OCSP:
|
||||||
case STROKE_LIST_ALGS:
|
case STROKE_LIST_ALGS:
|
||||||
|
case STROKE_LIST_PLUGINS:
|
||||||
case STROKE_LIST_ALL:
|
case STROKE_LIST_ALL:
|
||||||
res = list(token->kw, argc > 2 && strcmp(argv[2], "--utc") == 0);
|
res = list(token->kw, argc > 2 && strcmp(argv[2], "--utc") == 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ typedef enum {
|
|||||||
STROKE_LIST_CRLS,
|
STROKE_LIST_CRLS,
|
||||||
STROKE_LIST_OCSP,
|
STROKE_LIST_OCSP,
|
||||||
STROKE_LIST_ALGS,
|
STROKE_LIST_ALGS,
|
||||||
|
STROKE_LIST_PLUGINS,
|
||||||
STROKE_LIST_ALL,
|
STROKE_LIST_ALL,
|
||||||
STROKE_REREAD_SECRETS,
|
STROKE_REREAD_SECRETS,
|
||||||
STROKE_REREAD_CACERTS,
|
STROKE_REREAD_CACERTS,
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ listcainfos, STROKE_LIST_CAINFOS
|
|||||||
listcrls, STROKE_LIST_CRLS
|
listcrls, STROKE_LIST_CRLS
|
||||||
listocsp, STROKE_LIST_OCSP
|
listocsp, STROKE_LIST_OCSP
|
||||||
listalgs, STROKE_LIST_ALGS
|
listalgs, STROKE_LIST_ALGS
|
||||||
|
listplugins, STROKE_LIST_PLUGINS
|
||||||
listall, STROKE_LIST_ALL
|
listall, STROKE_LIST_ALL
|
||||||
rereadsecrets, STROKE_REREAD_SECRETS
|
rereadsecrets, STROKE_REREAD_SECRETS
|
||||||
rereadcacerts, STROKE_REREAD_CACERTS
|
rereadcacerts, STROKE_REREAD_CACERTS
|
||||||
|
|||||||
@@ -65,8 +65,10 @@ enum list_flag_t {
|
|||||||
LIST_OCSP = 0x0200,
|
LIST_OCSP = 0x0200,
|
||||||
/** list all supported algorithms */
|
/** list all supported algorithms */
|
||||||
LIST_ALGS = 0x0400,
|
LIST_ALGS = 0x0400,
|
||||||
|
/** list plugin information */
|
||||||
|
LIST_PLUGINS = 0x0800,
|
||||||
/** all list options */
|
/** all list options */
|
||||||
LIST_ALL = 0x07FF,
|
LIST_ALL = 0x0FFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum reread_flag_t reread_flag_t;
|
typedef enum reread_flag_t reread_flag_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user