PLUGIN_SDEPEND(CERT_DECODE, CERT_X509),
};
lib->plugins->add_static_features(lib->plugins, "nm-backend", features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
}
PLUGIN_PROVIDE(CUSTOM, "kernel-ipsec"),
};
lib->plugins->add_static_features(lib->plugins, "tkm-backend", features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
if (!register_dh_mapping())
{
}
enumerator->destroy(enumerator);
- lib->plugins->add_static_features(lib->plugins, "tkm-dh", f, countof(f), TRUE);
+ lib->plugins->add_static_features(lib->plugins, "tkm-dh", f, countof(f),
+ TRUE, NULL, NULL);
if (count > 0)
{
PLUGIN_PROVIDE(CUSTOM, "kernel-ipsec"),
};
lib->plugins->add_static_features(lib->plugins, "tkm-tests", features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
lib->settings->set_int(lib->settings, "%s.dh_mapping.%d", 1,
lib->ns, MODP_3072_BIT);
charonservice = &this->public;
lib->plugins->add_static_features(lib->plugins, "androidbridge", features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
#ifdef USE_BYOD
if (byod)
};
lib->plugins->add_static_features(lib->plugins, "android-byod",
- byod_features, countof(byod_features), TRUE);
+ byod_features, countof(byod_features), TRUE, NULL, NULL);
}
#endif
}
PLUGIN_DEPENDS(CUSTOM, "socket"),
};
lib->plugins->add_static_features(lib->plugins, lib->ns, features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
/* load plugins, further infrastructure may need it */
if (!lib->plugins->load(lib->plugins, plugins))
*/
char *name;
+ /**
+ * Optional reload function for features
+ */
+ bool (*reload)(void *data);
+
+ /**
+ * User data to pass to reload function
+ */
+ void *reload_data;
+
/**
* Static plugin features
*/
return this->count;
}
+METHOD(plugin_t, static_reload, bool,
+ static_features_t *this)
+{
+ if (this->reload)
+ {
+ return this->reload(this->reload_data);
+ }
+ return FALSE;
+}
+
METHOD(plugin_t, static_destroy, void,
static_features_t *this)
{
* Create a wrapper around static plugin features.
*/
static plugin_t *static_features_create(const char *name,
- plugin_feature_t features[], int count)
+ plugin_feature_t features[], int count,
+ bool (*reload)(void*), void *reload_data)
{
static_features_t *this;
.public = {
.get_name = _get_static_name,
.get_features = _get_static_features,
+ .reload = _static_reload,
.destroy = _static_destroy,
},
.name = strdup(name),
+ .reload = reload,
+ .reload_data = reload_data,
.features = calloc(count, sizeof(plugin_feature_t)),
.count = count,
);
METHOD(plugin_loader_t, add_static_features, void,
private_plugin_loader_t *this, const char *name,
- plugin_feature_t features[], int count, bool critical)
+ plugin_feature_t features[], int count, bool critical,
+ bool (*reload)(void*), void *reload_data)
{
plugin_entry_t *entry;
plugin_t *plugin;
- plugin = static_features_create(name, features, count);
+ plugin = static_features_create(name, features, count, reload, reload_data);
INIT(entry,
.plugin = plugin,
* If critical is TRUE load() will fail if any of the added features could
* not be loaded.
*
+ * If a reload callback function is given, it gets invoked for the
+ * registered feature set when reload() is invoked on the plugin_loader.
+ *
* @note The name should be unique otherwise a plugin with the same name is
* not loaded.
*
* @param features array of plugin features
* @param count number of features in the array
* @param critical TRUE if the features are critical
+ * @param reload feature reload callback, or NULL
+ * @param reload_data user data to pass to reload callback
*/
void (*add_static_features) (plugin_loader_t *this, const char *name,
struct plugin_feature_t *features, int count,
- bool critical);
+ bool critical, bool (*reload)(void*),
+ void *reload_data);
/**
* Load a list of plugins.
options = options_create();
lib->plugins->add_static_features(lib->plugins, "pt-tls-client", features,
- countof(features), TRUE);
+ countof(features), TRUE, NULL, NULL);
if (!lib->plugins->load(lib->plugins,
lib->settings->get_str(lib->settings, "pt-tls-client.load", PLUGINS)))
{