Use static plugin features in libcharon to define essential dependencies
authorTobias Brunner <tobias@strongswan.org>
Wed, 27 Jun 2012 09:27:36 +0000 (11:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 27 Jun 2012 09:31:16 +0000 (11:31 +0200)
src/charon-nm/nm/nm_backend.c
src/libcharon/daemon.c

index f8ed23e..de9bf27 100644 (file)
@@ -167,6 +167,7 @@ void nm_backend_register()
        static plugin_feature_t features[] = {
                PLUGIN_CALLBACK((plugin_feature_callback_t)nm_backend_cb, NULL),
                        PLUGIN_PROVIDE(CUSTOM, "NetworkManager backend"),
+                               PLUGIN_DEPENDS(CUSTOM, "libcharon"),
        };
        lib->plugins->add_static_features(lib->plugins, "nm-backend", features,
                                                                          countof(features), TRUE);
index 8a4b390..525c987 100644 (file)
@@ -32,7 +32,7 @@
 #include "daemon.h"
 
 #include <library.h>
-#include <plugins/plugin.h>
+#include <plugins/plugin_feature.h>
 #include <config/proposal.h>
 #include <kernel/kernel_handler.h>
 #include <processing/jobs/start_action_job.h>
@@ -213,6 +213,15 @@ METHOD(daemon_t, start, void,
 METHOD(daemon_t, initialize, bool,
        private_daemon_t *this, char *plugins)
 {
+       static plugin_feature_t features[] = {
+               PLUGIN_PROVIDE(CUSTOM, "libcharon"),
+                       PLUGIN_DEPENDS(HASHER, HASH_SHA1),
+                       PLUGIN_DEPENDS(RNG, RNG_STRONG),
+                       PLUGIN_DEPENDS(NONCE_GEN),
+       };
+       lib->plugins->add_static_features(lib->plugins, charon->name, features,
+                                                                         countof(features), TRUE);
+
        /* load plugins, further infrastructure may need it */
        if (!lib->plugins->load(lib->plugins, NULL, plugins))
        {