diff options
author | Martin Willi <martin@revosec.ch> | 2013-06-19 14:52:52 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-06-21 10:53:22 +0200 |
commit | 2bedb0f2703b305822a30f03f630ef4b2a695132 (patch) | |
tree | 33cc9981af6af66475b7525bf309b036a8b24289 /src/libstrongswan/plugins/plugin_loader.c | |
parent | df76881f1176be6eada875f9a824e54ef0572d60 (diff) | |
download | strongswan-2bedb0f2703b305822a30f03f630ef4b2a695132.tar.bz2 strongswan-2bedb0f2703b305822a30f03f630ef4b2a695132.tar.xz |
Move test-runners has_feature() function to plugin loader
Diffstat (limited to 'src/libstrongswan/plugins/plugin_loader.c')
-rw-r--r-- | src/libstrongswan/plugins/plugin_loader.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/plugin_loader.c b/src/libstrongswan/plugins/plugin_loader.c index 0549b3728..cd5f93ff3 100644 --- a/src/libstrongswan/plugins/plugin_loader.c +++ b/src/libstrongswan/plugins/plugin_loader.c @@ -387,6 +387,35 @@ METHOD(plugin_loader_t, create_plugin_enumerator, enumerator_t*, (void*)plugin_filter, NULL, NULL); } +METHOD(plugin_loader_t, has_feature, bool, + private_plugin_loader_t *this, plugin_feature_t feature) +{ + enumerator_t *plugins, *features; + plugin_t *plugin; + linked_list_t *list; + plugin_feature_t *current; + bool found = FALSE; + + plugins = create_plugin_enumerator(this); + while (plugins->enumerate(plugins, &plugin, &list)) + { + features = list->create_enumerator(list); + while (features->enumerate(features, ¤t)) + { + if (plugin_feature_matches(&feature, current)) + { + found = TRUE; + break; + } + } + features->destroy(features); + list->destroy(list); + } + plugins->destroy(plugins); + + return found; +} + /** * Create a list of the names of all loaded plugins */ @@ -1085,6 +1114,7 @@ plugin_loader_t *plugin_loader_create() .reload = _reload, .unload = _unload, .create_plugin_enumerator = _create_plugin_enumerator, + .has_feature = _has_feature, .loaded_plugins = _loaded_plugins, .destroy = _destroy, }, |