summaryrefslogtreecommitdiff
path: root/epan/plugins.c
diff options
context:
space:
mode:
authorTomas Kukosa <tomas.kukosa@siemens.com>2007-10-25 09:38:15 +0000
committerTomas Kukosa <tomas.kukosa@siemens.com>2007-10-25 09:38:15 +0000
commit136de3920c4f703e9d7aeb5f6d3b6484a2bc6479 (patch)
treeb55286be4fe6da2b8556a21a18dea5b3563ed374 /epan/plugins.c
parent821106256bf98c026652181dbdf9480abf080f6a (diff)
downloadwireshark-136de3920c4f703e9d7aeb5f6d3b6484a2bc6479.tar.gz
new codec table for registering codecs by name
new codec plugin type search registered codecs in rtp player fix memory leak in rtp player svn path=/trunk/; revision=23270
Diffstat (limited to 'epan/plugins.c')
-rw-r--r--epan/plugins.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/epan/plugins.c b/epan/plugins.c
index 6594afd3b9..68031b5be2 100644
--- a/epan/plugins.c
+++ b/epan/plugins.c
@@ -69,7 +69,8 @@ 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_wtap_module)(void))
+ void (*register_wtap_module)(void),
+ void (*register_codec_module)(void))
{
plugin *new_plug, *pt_plug;
@@ -108,6 +109,7 @@ add_plugin(void *handle, gchar *name, gchar *version,
new_plug->reg_handoff = reg_handoff;
new_plug->register_tap_listener = register_tap_listener;
new_plug->register_wtap_module = register_wtap_module;
+ new_plug->register_codec_module = register_codec_module;
new_plug->next = NULL;
return 0;
@@ -145,6 +147,7 @@ plugins_scan_dir(const char *dirname)
void (*reg_handoff)(void);
void (*register_tap_listener)(void);
void (*register_wtap_module)(void);
+ void (*register_codec_module)(void);
gchar *dot;
int cr;
@@ -310,18 +313,29 @@ plugins_scan_dir(const char *dirname)
register_wtap_module = NULL;
}
+ /*
+ * Do we have a register_codec_module routine?
+ */
+ if (g_module_symbol(handle, "register_codec_module", &gp))
+ {
+ register_codec_module = gp;
+ } else {
+ register_codec_module = NULL;
+ }
+
/*
* Does this dissector do anything useful?
*/
if (register_protoinfo == NULL &&
register_tap_listener == NULL &&
- register_wtap_module == NULL )
+ register_wtap_module == NULL &&
+ register_codec_module == NULL )
{
/*
* No.
*/
report_failure("The plugin '%s' has neither a register routine, "
- "a register_tap_listener or a register_wtap_module routine",
+ "a register_tap_listener or a register_wtap_module or a register_codec_module routine",
name);
g_module_close(handle);
continue;
@@ -332,7 +346,7 @@ plugins_scan_dir(const char *dirname)
*/
if ((cr = add_plugin(handle, g_strdup(name), version,
register_protoinfo, reg_handoff,
- register_tap_listener,register_wtap_module)))
+ register_tap_listener,register_wtap_module,register_codec_module)))
{
if (cr == EEXIST)
fprintf(stderr, "The plugin %s, version %s\n"
@@ -432,6 +446,7 @@ init_plugins(void)
}
}
register_all_wiretap_modules();
+ register_all_codecs();
}
void
@@ -507,4 +522,20 @@ register_all_wiretap_modules(void)
(pt_plug->register_wtap_module)();
}
}
+
+void
+register_all_codecs(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_codec_module)
+ (pt_plug->register_codec_module)();
+ }
+}
#endif