diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-10-01 00:56:03 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-12-14 08:43:57 +0000 |
commit | 995812c5f1add94df1c237596939130c1704b099 (patch) | |
tree | 42542c56b9a70c7d2d231c8bc36649be35af46b4 /epan/prefs.c | |
parent | a9821caab8a1f2c6e265bd5b63a060f1f241c704 (diff) |
Refactor plugin registration and loading
Put different types of plugins (libwiretap, libwireshark) in different
subdirectories, give libwiretap and libwireshark init routines that
load the plugins, and have them scan the appropriate subdirectories
so that we don't even *try* to, for example, load libwireshark plugins
in programs that only use libwiretap.
Compiled plugins are stored in subfolders of the plugin folders, with
the subfolder name being the Wireshark minor version number (X.Y). There is
another hierarchical level for each Wireshark library (libwireshark, libwscodecs
and libwiretap).
The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}.
Currently we only distribute "epan" (libwireshark) plugins.
Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb
Reviewed-on: https://code.wireshark.org/review/23983
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/prefs.c')
-rw-r--r-- | epan/prefs.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index 9ae9cfd21b..a3dfdd8859 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -737,6 +737,38 @@ prefs_register_stat(const char *name, const char *title, apply_cb, TRUE); } +/* + * Register that a codec has preferences. + * + * "name" is a name for the codec to use on the command line with "-o" + * and in preference files. + * + * "title" is a short human-readable name for the codec. + * + * "description" is a longer human-readable description of the codec. + */ +module_t *codecs_module = NULL; + +module_t * +prefs_register_codec(const char *name, const char *title, + const char *description, void (*apply_cb)(void)) +{ + /* + * Have we yet created the "Codecs" subtree? + */ + if (codecs_module == NULL) { + /* + * No. Register Codecs subtree as well as any preferences + * for non-dissector modules. + */ + pre_init_prefs(); + prefs_register_modules(); + } + + return prefs_register_module(codecs_module, name, title, description, + apply_cb, TRUE); +} + module_t * prefs_find_module(const char *name) { @@ -3479,6 +3511,10 @@ prefs_register_modules(void) "This is the file that gets written to when the destination is set to \"file\"", &prefs.pr_file, PREF_SAVE_FILENAME, NULL, TRUE); + /* Codecs */ + codecs_module = prefs_register_module(NULL, "codecs", "Codecs", + "Codecs", NULL, TRUE); + /* Statistics */ stats_module = prefs_register_module(NULL, "statistics", "Statistics", "Statistics", &stats_callback, TRUE); |