diff options
author | Gerald Combs <gerald@wireshark.org> | 2011-06-01 21:48:17 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2011-06-01 21:48:17 +0000 |
commit | 0272ec5dd3fcaef37fafedb23d14d1d89db712b6 (patch) | |
tree | c4da1f0931d1db98bb5739a82e5942139a36cd1d | |
parent | a02b8fb24786bee85e2cca4b82489aa332f0150d (diff) |
Show the plugin paths in Help→About→Plugins. Add a "-G plugins" option
to TShark which dumps a list of plugins.
svn path=/trunk/; revision=37512
-rw-r--r-- | epan/libwireshark.def | 1 | ||||
-rw-r--r-- | epan/plugins.c | 52 | ||||
-rw-r--r-- | epan/plugins.h | 2 | ||||
-rw-r--r-- | epan/wslua/init_wslua.c | 6 | ||||
-rw-r--r-- | gtk/plugins_dlg.c | 9 | ||||
-rw-r--r-- | tshark.c | 2 |
6 files changed, 65 insertions, 7 deletions
diff --git a/epan/libwireshark.def b/epan/libwireshark.def index 4305f55ece..b6b1b5fec2 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -698,6 +698,7 @@ p_get_proto_data parse_key_string pe_tree_create plugin_list DATA +plugins_dump_all postseq_cleanup_all_protocols prefs DATA prefs_apply diff --git a/epan/plugins.c b/epan/plugins.c index a511da44f6..4b6a4a45b7 100644 --- a/epan/plugins.c +++ b/epan/plugins.c @@ -506,4 +506,56 @@ register_all_codecs(void) (pt_plug->register_codec_module)(); } } + +/* + * Dump plugin info to stdout. Copied from gtk/plugins_dlg.c:plugins_scan. + */ +void +plugins_dump_all(void) +{ +#ifdef HAVE_PLUGINS + plugin *pt_plug; + const char *sep; +#endif +#ifdef HAVE_LUA_5_1 + wslua_plugin *lua_plug; +#endif + +#ifdef HAVE_PLUGINS + for (pt_plug = plugin_list; pt_plug != NULL; pt_plug = pt_plug->next) + { + sep = ""; + + printf("%s\t%s\t", pt_plug->name, pt_plug->version); + if (pt_plug->register_protoinfo) + { + printf("dissector"); + sep = ", "; + } + if (pt_plug->register_tap_listener) + { + printf("%stap", sep); + sep = ", "; + } + if (pt_plug->register_wtap_module) + { + printf("%sfile format", sep); + sep = ", "; + } + if (pt_plug->register_codec_module) + { + printf("%scodec", sep); + } + printf("\t%s\n", g_module_name(pt_plug->handle)); + } +#endif + +#ifdef HAVE_LUA_5_1 + for (lua_plug = wslua_plugin_list; lua_plug != NULL; lua_plug = lua_plug->next) + { + printf("%s\t%s\tlua script\t%s\n", lua_plug->name, lua_plug->version, lua_plug->filename); + } +#endif +} + #endif diff --git a/epan/plugins.h b/epan/plugins.h index 9fed240062..e081a3e965 100644 --- a/epan/plugins.h +++ b/epan/plugins.h @@ -54,10 +54,12 @@ extern void register_all_plugin_handoffs(void); extern void register_all_plugin_tap_listeners(void); extern void register_all_wiretap_modules(void); extern void register_all_codecs(void); +extern void plugins_dump_all(void); typedef struct _wslua_plugin { gchar *name; /**< plugin name */ gchar *version; /**< plugin version */ + gchar *filename; /**< plugin filename */ struct _wslua_plugin *next; } wslua_plugin; diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c index a1a9b2ab32..a3dcf548b0 100644 --- a/epan/wslua/init_wslua.c +++ b/epan/wslua/init_wslua.c @@ -202,7 +202,7 @@ static int lua_main_error_handler(lua_State* LS) { return 0; } -static void wslua_add_plugin(gchar *name, gchar *version) +static void wslua_add_plugin(gchar *name, gchar *version, gchar *filename) { wslua_plugin *new_plug, *lua_plug; @@ -220,6 +220,7 @@ static void wslua_add_plugin(gchar *name, gchar *version) new_plug->name = name; new_plug->version = version; + new_plug->filename = filename; new_plug->next = NULL; } @@ -309,7 +310,7 @@ static void lua_load_plugins (const char *dirname) if (file_exists(filename)) { if (lua_load_script(filename)) { - wslua_add_plugin(g_strdup(name), g_strdup("")); + wslua_add_plugin(g_strdup(name), g_strdup(""), g_strdup(filename)); } } g_free(filename); @@ -437,4 +438,3 @@ int wslua_init(lua_State* LS) { } lua_State* wslua_state(void) { return L; } - diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c index d6a38ca5ab..015ab57fa5 100644 --- a/gtk/plugins_dlg.c +++ b/gtk/plugins_dlg.c @@ -39,6 +39,7 @@ /* * Fill the list widget with a list of the plugin modules. + * XXX - We might want to combine this with plugins_dump_all(). */ static void plugins_scan(GtkWidget *list) @@ -80,7 +81,7 @@ plugins_scan(GtkWidget *list) type = g_string_append(type, "codec"); } simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version, - 2, type->str, -1); + 2, type->str, 3, g_module_name(pt_plug->handle), -1); g_string_free(type, TRUE); } #endif @@ -91,7 +92,7 @@ plugins_scan(GtkWidget *list) type = g_string_new(""); type = g_string_append(type, "lua script"); - simple_list_append(list, 0, lua_plug->name, 1, lua_plug->version, 2, type->str, -1); + simple_list_append(list, 0, lua_plug->name, 1, lua_plug->version, 2, type->str, 3, lua_plug->filename, -1); g_string_free(type, TRUE); } #endif @@ -103,14 +104,14 @@ about_plugins_page_new(void) { GtkWidget *scrolledwindow; GtkWidget *plugins_list; - const gchar *titles[] = {"Name", "Version", "Type"}; + const gchar *titles[] = {"Name", "Version", "Type", "Path"}; scrolledwindow = scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_IN); - plugins_list = simple_list_new(3 , titles); + plugins_list = simple_list_new(4, titles); plugins_scan(plugins_list); gtk_container_add(GTK_CONTAINER(scrolledwindow), plugins_list); @@ -987,6 +987,8 @@ main(int argc, char *argv[]) dissector_dump_decodes(); else if (strcmp(argv[2], "defaultprefs") == 0) write_prefs(NULL); + else if (strcmp(argv[2], "plugins") == 0) + plugins_dump_all(); else if (strcmp(argv[2], "?") == 0) glossary_option_help(); else if (strcmp(argv[2], "-?") == 0) |