Add a counter : "enabled_plugins_number", to record how many plugins are
enabled. The counter is incremented in enable_plugin() and decremented in disable_plugin(). In add_packet_to_packet_list(), we check this counter (instead of plugin_list) to see if there is at least one enabled plugin. If this is the case, we must build the protocol tree. svn path=/trunk/; revision=1770
This commit is contained in:
parent
87e3becab5
commit
2673685067
4
file.c
4
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.173 2000/03/28 08:11:43 guy Exp $
|
||||
* $Id: file.c,v 1.174 2000/03/31 21:42:23 oabad Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -550,7 +550,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf
|
|||
}
|
||||
else {
|
||||
#ifdef HAVE_PLUGINS
|
||||
if (plugin_list)
|
||||
if (enabled_plugins_number > 0)
|
||||
protocol_tree = proto_tree_create_root();
|
||||
#endif
|
||||
dissect_packet(buf, fdata, protocol_tree);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugins.c
|
||||
* plugin routines
|
||||
*
|
||||
* $Id: plugins.c,v 1.11 2000/03/15 19:09:23 guy Exp $
|
||||
* $Id: plugins.c,v 1.12 2000/03/31 21:42:24 oabad Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -64,6 +64,7 @@ plugin_address_table_t patable;
|
|||
|
||||
/* linked list of all plugins */
|
||||
plugin *plugin_list;
|
||||
guint32 enabled_plugins_number;
|
||||
|
||||
#ifdef WIN32
|
||||
static gchar std_plug_dir[] = "c:/program files/ethereal/plugins/0.8";
|
||||
|
@ -148,6 +149,7 @@ enable_plugin(const gchar *name, const gchar *version)
|
|||
if (!strcmp(pt_plug->name, name) && !strcmp(pt_plug->version, version))
|
||||
{
|
||||
pt_plug->enabled = TRUE;
|
||||
enabled_plugins_number++;
|
||||
return pt_plug;
|
||||
}
|
||||
pt_plug = pt_plug->next;
|
||||
|
@ -171,6 +173,7 @@ disable_plugin(const gchar *name, const gchar *version)
|
|||
if (!strcmp(pt_plug->name, name) && !strcmp(pt_plug->version, version))
|
||||
{
|
||||
pt_plug->enabled = FALSE;
|
||||
enabled_plugins_number--;
|
||||
return pt_plug;
|
||||
}
|
||||
pt_plug = pt_plug->next;
|
||||
|
@ -447,6 +450,7 @@ init_plugins()
|
|||
|
||||
if (plugin_list == NULL) /* ensure init_plugins is only run once */
|
||||
{
|
||||
enabled_plugins_number = 0;
|
||||
|
||||
#ifdef PLUGINS_NEED_ADDRESS_TABLE
|
||||
/* Intialize address table */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* plugins.h
|
||||
* definitions for plugins structures
|
||||
*
|
||||
* $Id: plugins.h,v 1.5 2000/01/15 00:22:34 gram Exp $
|
||||
* $Id: plugins.h,v 1.6 2000/03/31 21:42:24 oabad Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -64,6 +64,7 @@ typedef struct _plugin {
|
|||
} plugin;
|
||||
|
||||
extern plugin *plugin_list;
|
||||
extern guint32 enabled_plugins_number;
|
||||
|
||||
int add_plugin(void *, gchar *, gchar *, gchar *, gchar *, dfilter *,
|
||||
void (*) (const u_char *, int, frame_data *, proto_tree *));
|
||||
|
|
Loading…
Reference in New Issue