71
71
class sys_var_pluginvar;
72
72
static vector<sys_var_pluginvar *> plugin_sysvar_vec;
74
char *opt_plugin_add= NULL;
75
char *opt_plugin_remove= NULL;
76
char *opt_plugin_load= NULL;
74
typedef vector<string> PluginOptions;
75
static PluginOptions opt_plugin_load;
76
static PluginOptions opt_plugin_add;
77
static PluginOptions opt_plugin_remove;
77
78
char *opt_plugin_dir_ptr;
78
79
char opt_plugin_dir[FN_REFLEN];
79
const char *opt_plugin_load_default= PANDORA_PLUGIN_LIST;
80
80
const char *builtin_plugins= PANDORA_BUILTIN_LIST;
82
82
/* Note that 'int version' must be the first field of every plugin
359
static void compose_plugin_options(vector<string> &target,
360
vector<string> options)
362
for (vector<string>::iterator it= options.begin();
366
tokenize(*it, target, ",", true);
370
void compose_plugin_add(vector<string> options)
372
compose_plugin_options(opt_plugin_add, options);
375
void compose_plugin_remove(vector<string> options)
377
compose_plugin_options(opt_plugin_remove, options);
380
void notify_plugin_load(string in_plugin_load)
382
tokenize(in_plugin_load, opt_plugin_load, ",", true);
361
386
The logic is that we first load and initialize all compiled in plugins.
377
vector<string> builtin_list;
402
PluginOptions builtin_list;
378
403
tokenize(builtin_plugins, builtin_list, ",", true);
380
405
bool load_failed= false;
381
vector<string> plugin_list;
384
tokenize(opt_plugin_load, plugin_list, ",", true);
388
tokenize(opt_plugin_load_default, plugin_list, ",", true);
392
tokenize(opt_plugin_add, plugin_list, ",", true);
395
if (opt_plugin_remove)
397
vector<string> plugins_to_remove;
398
tokenize(opt_plugin_remove, plugins_to_remove, ",", true);
399
plugin_prune_list(plugin_list, plugins_to_remove);
400
plugin_prune_list(builtin_list, plugins_to_remove);
407
if (opt_plugin_add.size() > 0)
409
opt_plugin_load.insert(opt_plugin_load.end(),
410
opt_plugin_add.begin(),
411
opt_plugin_add.end());
414
if (opt_plugin_remove.size() > 0)
416
plugin_prune_list(opt_plugin_load, opt_plugin_remove);
417
plugin_prune_list(builtin_list, opt_plugin_remove);
416
433
/* Uniquify the list */
417
const set<string> plugin_list_set(plugin_list.begin(), plugin_list.end());
434
const set<string> plugin_list_set(opt_plugin_load.begin(),
435
opt_plugin_load.end());
419
437
/* Register all dynamic plugins */
420
438
load_failed= plugin_load_list(registry, &tmp_root,