From 995812c5f1add94df1c237596939130c1704b099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sun, 1 Oct 2017 00:56:03 +0100 Subject: Refactor plugin registration and loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- randpkt.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'randpkt.c') diff --git a/randpkt.c b/randpkt.c index 17662416b5..b904bc30c2 100644 --- a/randpkt.c +++ b/randpkt.c @@ -135,6 +135,9 @@ main(int argc, char **argv) g_free(init_progfile_dir_error); } + init_report_message(failure_warning_message, failure_warning_message, + NULL, NULL, NULL); + wtap_init(); cmdarg_err_init(failure_warning_message, failure_message_cont); @@ -144,24 +147,6 @@ main(int argc, char **argv) create_app_running_mutex(); #endif /* _WIN32 */ -#ifdef HAVE_PLUGINS - /* Register wiretap plugins */ - init_report_message(failure_warning_message, failure_warning_message, - NULL, NULL, NULL); - - /* Scan for plugins. This does *not* call their registration routines; - that's done later. - - Don't report failures to load plugins because most - (non-wiretap) plugins *should* fail to load (because - we're not linked against libwireshark and dissector - plugins need libwireshark). */ - scan_plugins(DONT_REPORT_LOAD_FAILURE); - - /* Register all libwiretap plugin modules. */ - register_all_wiretap_modules(); -#endif - while ((opt = getopt_long(argc, argv, "b:c:ht:r", long_options, NULL)) != -1) { switch (opt) { case 'b': /* max bytes */ -- cgit v1.2.3