aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/libwireshark.def4
-rw-r--r--epan/plugins.c91
-rw-r--r--epan/plugins.h2
-rw-r--r--gtk/main.c3
-rw-r--r--gtk/plugins_dlg.c14
-rw-r--r--tshark.c1
6 files changed, 79 insertions, 36 deletions
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index 20f845b2ac..45d3a26b9f 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -657,8 +657,10 @@ reassembled_table_init
register_all_plugin_tap_listeners
register_all_protocols
register_all_protocol_handoffs
-register_ber_syntax_dissector
+register_all_protocol_handoffs
+register_all_wiretap_modules
register_ber_oid_syntax
+register_ber_syntax_dissector
register_count
register_dissector
register_dissector_table
diff --git a/epan/plugins.c b/epan/plugins.c
index 241ee45f98..4841751311 100644
--- a/epan/plugins.c
+++ b/epan/plugins.c
@@ -68,7 +68,8 @@ plugin *plugin_list;
static int
add_plugin(void *handle, gchar *name, gchar *version,
void (*register_protoinfo)(void), void (*reg_handoff)(void),
- void (*register_tap_listener)(void))
+ void (*register_tap_listener)(void),
+ void (*register_wtap_module)(void))
{
plugin *new_plug, *pt_plug;
@@ -106,7 +107,9 @@ add_plugin(void *handle, gchar *name, gchar *version,
new_plug->register_protoinfo = register_protoinfo;
new_plug->reg_handoff = reg_handoff;
new_plug->register_tap_listener = register_tap_listener;
+ new_plug->register_wtap_module = register_wtap_module;
new_plug->next = NULL;
+
return 0;
}
@@ -141,6 +144,8 @@ plugins_scan_dir(const char *dirname)
void (*register_protoinfo)(void);
void (*reg_handoff)(void);
void (*register_tap_listener)(void);
+ void (*register_wtap_module)(void);
+
gchar *dot;
int cr;
@@ -171,6 +176,7 @@ plugins_scan_dir(const char *dirname)
while ((file = eth_dir_read_name(dir)) != NULL)
{
name = eth_dir_get_name(file);
+
#if GLIB_MAJOR_VERSION < 2
/* don't try to open "." and ".." */
if (!(strcmp(name, "..") &&
@@ -201,6 +207,7 @@ plugins_scan_dir(const char *dirname)
g_module_error());
continue;
}
+
if (!g_module_symbol(handle, "version", &gp))
{
report_failure("The plugin %s has no version symbol", name);
@@ -265,43 +272,55 @@ plugins_scan_dir(const char *dirname)
register_tap_listener = NULL;
}
- /*
+ /*
* Do we have an old-style init routine?
*/
if (g_module_symbol(handle, "plugin_init", &gp))
{
- /*
- * Yes - do we also have a register routine or a
- * register_tap_listener routine? If so, this is a bogus
- * hybrid of an old-style and new-style plugin.
- */
- if (register_protoinfo != NULL || register_tap_listener != NULL)
- {
- report_failure("The plugin %s has an old plugin init routine\nand a new register or register_tap_listener routine.",
- name);
- g_module_close(handle);
- continue;
- }
+ /*
+ * Yes - do we also have a register routine or a
+ * register_tap_listener routine? If so, this is a bogus
+ * hybrid of an old-style and new-style plugin.
+ */
+ if (register_protoinfo != NULL || register_tap_listener != NULL)
+ {
+ report_failure("The plugin '%s' has an old plugin init routine\nand a new register or register_tap_listener routine.",
+ name);
+ g_module_close(handle);
+ continue;
+ }
- /*
- * It's just an unsupported old-style plugin;
- */
- report_failure("The plugin %s has an old plugin init routine. Support has been dropped.\n Information on how to update your plugin is available at \nhttp://anonsvn.wireshark.org/wireshark/trunk/doc/README.plugins",
- name);
- g_module_close(handle);
- continue;
+ /*
+ * It's just an unsupported old-style plugin;
+ */
+ report_failure("The plugin '%s' has an old plugin init routine. Support has been dropped.\n Information on how to update your plugin is available at \nhttp://anonsvn.wireshark.org/wireshark/trunk/doc/README.plugins",
+ name);
+ g_module_close(handle);
+ continue;
}
-
+
/*
- * Does this dissector do anything useful?
- */
+ * Do we have a register_wtap_module routine?
+ */
+ if (g_module_symbol(handle, "register_wtap_module", &gp))
+ {
+ register_wtap_module = gp;
+ } else {
+ register_wtap_module = NULL;
+ }
+
+ /*
+ * Does this dissector do anything useful?
+ */
if (register_protoinfo == NULL &&
- register_tap_listener == NULL)
+ register_tap_listener == NULL &&
+ register_wtap_module == NULL )
{
/*
* No.
*/
- report_failure("The plugin %s has neither a register routine, or a register_tap_listener routine",
+ report_failure("The plugin '%s' has neither a register routine, "
+ "a register_tap_listener or a register_wtap_module routine",
name);
g_module_close(handle);
continue;
@@ -312,7 +331,7 @@ plugins_scan_dir(const char *dirname)
*/
if ((cr = add_plugin(handle, g_strdup(name), version,
register_protoinfo, reg_handoff,
- register_tap_listener)))
+ register_tap_listener,register_wtap_module)))
{
if (cr == EEXIST)
fprintf(stderr, "The plugin %s, version %s\n"
@@ -324,7 +343,7 @@ plugins_scan_dir(const char *dirname)
g_module_close(handle);
continue;
}
-
+
/*
* Call its register routine if it has one.
* XXX - just save this and call it with the built-in
@@ -457,4 +476,20 @@ register_all_plugin_tap_listeners(void)
(pt_plug->register_tap_listener)();
}
}
+
+void
+register_all_wiretap_modules(void)
+{
+ plugin *pt_plug;
+
+ /*
+ * For all plugins with register_wtap_module routines, call the
+ * routines.
+ */
+ for (pt_plug = plugin_list; pt_plug != NULL; pt_plug = pt_plug->next)
+ {
+ if (pt_plug->register_wtap_module)
+ (pt_plug->register_wtap_module)();
+ }
+}
#endif
diff --git a/epan/plugins.h b/epan/plugins.h
index f806522cf9..b554a6013f 100644
--- a/epan/plugins.h
+++ b/epan/plugins.h
@@ -37,6 +37,7 @@ typedef struct _plugin {
void (*register_protoinfo)(void); /* routine to call to register protocol information */
void (*reg_handoff)(void); /* routine to call to register dissector handoff */
void (*register_tap_listener)(void); /* routine to call to register tap listener */
+ void (*register_wtap_module)(void); /* routine to call to register a wiretap module */
struct _plugin *next; /* forward link */
} plugin;
@@ -45,6 +46,7 @@ WS_VAR_IMPORT plugin *plugin_list;
extern void init_plugins(void);
extern void register_all_plugin_handoffs(void);
extern void register_all_plugin_tap_listeners(void);
+extern void register_all_wiretap_modules(void);
/* get the personal plugin dir */
/* Return value is g_malloced so the caller should g_free() it. */
diff --git a/gtk/main.c b/gtk/main.c
index 4adec4d06d..a2adf38e74 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -2163,7 +2163,7 @@ main(int argc, char *argv[])
* Now attempt to get the pathname of the plugins.
*/
init_plugin_dir();
-
+
/* initialize the funnel mini-api */
initialize_funnel_ops();
@@ -2412,6 +2412,7 @@ main(int argc, char *argv[])
#ifdef HAVE_PLUGINS
register_all_plugin_tap_listeners();
+ register_all_wiretap_modules();
#endif
register_all_tap_listeners();
diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c
index 4b04a1a98b..7bb76af491 100644
--- a/gtk/plugins_dlg.c
+++ b/gtk/plugins_dlg.c
@@ -47,27 +47,29 @@ plugins_scan(GtkWidget *list)
GString *type;
const char *sep;
- pt_plug = plugin_list;
- while (pt_plug)
+ for (pt_plug = plugin_list; pt_plug != NULL; pt_plug = pt_plug->next)
{
type = g_string_new("");
sep = "";
if (pt_plug->register_protoinfo)
{
- type = g_string_append(type, sep);
type = g_string_append(type, "dissector");
- sep = ",";
+ sep = ", ";
}
if (pt_plug->register_tap_listener)
{
type = g_string_append(type, sep);
type = g_string_append(type, "tap");
- sep = ",";
+ sep = ", ";
+ }
+ if (pt_plug->register_wtap_module)
+ {
+ type = g_string_append(type, sep);
+ type = g_string_append(type, "file_format");
}
simple_list_append(list, 0, pt_plug->name, 1, pt_plug->version,
2, type->str, -1);
g_string_free(type, TRUE);
- pt_plug = pt_plug->next;
}
}
diff --git a/tshark.c b/tshark.c
index 493b26d856..d51e1b3c37 100644
--- a/tshark.c
+++ b/tshark.c
@@ -797,6 +797,7 @@ main(int argc, char *argv[])
by stats_tree_stat.c and need to registered before that */
#ifdef HAVE_PLUGINS
register_all_plugin_tap_listeners();
+ register_all_wiretap_modules();
#endif
register_all_tap_listeners();