# Makefile.am
# Automake file for the GTK interface routines for Ethereal
#
-# $Id: Makefile.am,v 1.56 2003/04/23 03:51:02 guy Exp $
+# $Id: Makefile.am,v 1.57 2003/04/23 05:37:21 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
ETHEREAL_TAP_SRC = \
dcerpc_stat.c \
- dcerpc_stat.h \
io_stat.c \
- io_stat.h \
mgcp_stat.c \
- mgcp_stat.h \
rpc_stat.c \
- rpc_stat.h \
rpc_progs.c \
- rpc_progs.h \
smb_stat.c \
- smb_stat.h \
tap_rtp.c
ethereal-tap-register.c: $(ETHEREAL_TAP_SRC) $(top_srcdir)/make-tapreg-dotc
/* dcerpc_stat.c
* dcerpc_stat 2002 Ronnie Sahlberg
*
- * $Id: dcerpc_stat.c,v 1.4 2003/04/23 03:51:02 guy Exp $
+ * $Id: dcerpc_stat.c,v 1.5 2003/04/23 05:37:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#endif
#include <gtk/gtk.h>
+#include "menu.h"
#include "epan/packet_info.h"
#include "simple_dialog.h"
#include "tap.h"
#include "../register.h"
#include "packet-dcerpc.h"
-#include "dcerpc_stat.h"
#include "../globals.h"
#include "compat_macros.h"
}
-void
+static void
gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
/* if the window is already open, bring it to front */
{
register_ethereal_tap("dcerpc,rtt,", gtk_dcerpcstat_init);
}
+
+void
+register_tap_menu_gtkdcerpcstat(void)
+{
+ register_tap_menu_item("DCE-RPC/RTT", gtk_dcerpcstat_cb);
+}
+++ /dev/null
-/* dcerpc_stat.h
- * dcerpc_stat 2002 Ronnie Sahlberg
- *
- * $Id: dcerpc_stat.h,v 1.2 2002/11/06 10:53:36 sahlberg Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __DCERPCSTAT_H__
-#define __DCERPCSTAT_H__
-
-void gtk_dcerpcstat_cb(GtkWidget *w, gpointer d);
-
-#endif
/* io_stat.c
* io_stat 2002 Ronnie Sahlberg
*
- * $Id: io_stat.c,v 1.19 2003/04/23 03:51:02 guy Exp $
+ * $Id: io_stat.c,v 1.20 2003/04/23 05:37:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include "epan/packet_info.h"
#include "../tap.h"
#include "../register.h"
-#include "io_stat.h"
#include "simple_dialog.h"
#include "../globals.h"
#include "../color.h"
}
-void
+static void
gtk_iostat_cb(GtkWidget *w _U_, gpointer d _U_)
{
gtk_iostat_init(NULL);
register_ethereal_tap("io,stat", gtk_iostat_init);
}
+void
+register_tap_menu_gtkiostat(void)
+{
+ register_tap_menu_item("IO/IO-Stat", gtk_iostat_cb);
+}
+++ /dev/null
-/* io_stat.h
- * io_stat 2002 Ronnie Sahlberg
- *
- * $Id: io_stat.h,v 1.1 2002/11/14 10:32:22 sahlberg Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __IOSTAT_H__
-#define __IOSTAT_H__
-
-void gtk_iostat_cb(GtkWidget *w, gpointer d);
-
-#endif
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.91 2003/04/23 03:51:03 guy Exp $
+ * $Id: menu.c,v 1.92 2003/04/23 05:37:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <epan/plugins.h>
#include "tcp_graph.h"
#include <epan/epan_dissect.h>
-#include "io_stat.h"
-#include "rpc_stat.h"
-#include "rpc_progs.h"
-#include "dcerpc_stat.h"
-#include "smb_stat.h"
-#include "mgcp_stat.h"
#include "compat_macros.h"
#include "gtkglobals.h"
#include "../tap.h"
ITEM_FACTORY_ENTRY("/Tools/Protocol Hierarchy Statistics", NULL,
proto_hier_stats_cb, 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/Tools/Statistics", NULL, NULL, 0, "<Branch>", NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC", NULL, NULL, 0, "<Branch>",
- NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC/RTT", NULL, gtk_rpcstat_cb,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/ONC-RPC/Programs", NULL,
- gtk_rpcprogs_cb, 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/DCE-RPC", NULL, NULL, 0, "<Branch>",
- NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/DCE-RPC/RTT", NULL, gtk_dcerpcstat_cb,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/IO", NULL, NULL, 0, "<Branch>",
- NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/IO/IO-Stat", NULL, gtk_iostat_cb,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/SMB", NULL, NULL, 0, "<Branch>",
- NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/SMB/RTT", NULL, gtk_smbstat_cb,
- 0, NULL, NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/MGCP", NULL, NULL, 0, "<Branch>",
- NULL),
- ITEM_FACTORY_ENTRY("/Tools/Statistics/MGCP/RTD", NULL, gtk_mgcpstat_cb,
- 0, NULL, NULL),
ITEM_FACTORY_ENTRY("/_Help", NULL, NULL, 0, "<LastBranch>", NULL),
ITEM_FACTORY_STOCK_ENTRY("/Help/_Help", NULL, help_cb, 0, GTK_STOCK_HELP),
ITEM_FACTORY_ENTRY("/Help/<separator>", NULL, NULL, 0, "<Separator>", NULL),
set_menu_sensitivity(main_menu_factory, "/Edit/Paste", FALSE);
#endif
- if(!find_tap_id("mgcp")) {
- set_menu_sensitivity(main_menu_factory, "/Tools/Statistics/MGCP",
- FALSE);
- }
set_menus_for_captured_packets(FALSE);
set_menus_for_selected_packet(FALSE);
set_menus_for_selected_tree_row(FALSE);
* another per-tap registration routine.
*/
void
-register_tap_menu_item(const char *name, GtkItemFactoryCallback callback)
+register_tap_menu_item(char *name, GtkItemFactoryCallback callback)
{
static const char statspath[] = "/Tools/Statistics/";
+ char *p;
char *menupath;
size_t menupathlen;
+ GtkWidget *w;
GtkItemFactoryEntry *entry;
+ /*
+ * The menu path must be relative.
+ */
+ g_assert(*name != '/');
+
+ /*
+ * Create any submenus required.
+ */
+ p = name;
+ while ((p = strchr(p, '/')) != NULL) {
+ /*
+ * OK, everything between "name" and "p" is
+ * a menu relative subtree into which the menu item
+ * will be placed.
+ *
+ * Construct the absolute path name of that subtree.
+ */
+ menupathlen = sizeof statspath + (p - name);
+ menupath = g_malloc(menupathlen);
+ strcpy(menupath, statspath);
+ strncat(menupath, name, p - name);
+
+ /*
+ * Does there exist an entry with that path in the main
+ * menu item factory?
+ */
+ w = gtk_item_factory_get_widget(main_menu_factory, menupath);
+ if (w == NULL) {
+ /*
+ * No. Create such an item as a subtree.
+ */
+ entry = g_malloc0(sizeof (GtkItemFactoryEntry));
+ entry->path = menupath;
+ entry->item_type = "<Branch>";
+ gtk_item_factory_create_item(main_menu_factory, entry,
+ NULL, 2);
+ }
+
+ /*
+ * Skip over the '/' we found.
+ */
+ p++;
+ }
+
/*
* Construct the main menu path for the menu item.
*
/* menu.h
* Menu definitions
*
- * $Id: menu.h,v 1.8 2003/04/23 03:13:16 guy Exp $
+ * $Id: menu.h,v 1.9 2003/04/23 05:37:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* be called from the routine that registers taps - we have to introduce
* another per-tap registration routine.
*/
-extern void register_tap_menu_item(const char *name,
- GtkItemFactoryCallback callback);
+extern void register_tap_menu_item(char *name, GtkItemFactoryCallback callback);
extern GtkWidget *popup_menu_object;
* mgcp-statistics for ethereal
* Copyright 2003 Lars Roland
*
- * $Id: mgcp_stat.c,v 1.2 2003/04/23 03:51:03 guy Exp $
+ * $Id: mgcp_stat.c,v 1.3 2003/04/23 05:37:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include "../register.h"
#include "../plugins/mgcp/packet-mgcp.h"
#include "../timestats.h"
-#include "mgcp_stat.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "../file.h"
}
-void
+static void
gtk_mgcpstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
gtk_mgcpstat_init("mgcp,rtd");
}
+
+void
+register_tap_menu_gtkmgcpstat(void)
+{
+ if (find_tap_id("mgcp"))
+ register_tap_menu_item("MGCP/RTD", gtk_mgcpstat_cb);
+}
+
+++ /dev/null
-/* mgcp_stat.h
- * mgcp_stat 2003 Lars Roland
- *
- * $Id: mgcp_stat.h,v 1.1 2003/04/16 07:24:06 guy Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __MGCPSTAT_H__
-#define __MGCPSTAT_H__
-
-void gtk_mgcpstat_cb(GtkWidget *w, gpointer d);
-
-#endif
/* rpc_progs.c
* rpc_progs 2002 Ronnie Sahlberg
*
- * $Id: rpc_progs.c,v 1.7 2003/04/23 03:51:03 guy Exp $
+ * $Id: rpc_progs.c,v 1.8 2003/04/23 05:37:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include "epan/packet_info.h"
#include "tap.h"
#include "../register.h"
-#include "rpc_progs.h"
#include "packet-rpc.h"
#include "../globals.h"
#include "compat_macros.h"
redissect_packets(&cfile);
}
-void
+static void
gtk_rpcprogs_cb(GtkWidget *w _U_, gpointer d _U_)
{
gtk_rpcprogs_init("");
{
register_ethereal_tap("rpc,programs", gtk_rpcprogs_init);
}
+
+void
+register_tap_menu_gtkrpcprogs(void)
+{
+ register_tap_menu_item("ONC-RPC/Programs", gtk_rpcprogs_cb);
+}
+
+++ /dev/null
-/* rpc_progs.h
- * rpc_progs 2002 Ronnie Sahlberg
- *
- * $Id: rpc_progs.h,v 1.2 2002/11/06 10:53:36 sahlberg Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RPC_PROGS_H__
-#define __RPC_PROGS_H__
-
-void gtk_rpcprogs_cb(GtkWidget *w, gpointer d);
-
-#endif
/* rpc_stat.c
* rpc_stat 2002 Ronnie Sahlberg
*
- * $Id: rpc_stat.c,v 1.7 2003/04/23 03:51:03 guy Exp $
+ * $Id: rpc_stat.c,v 1.8 2003/04/23 05:37:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#endif
#include <gtk/gtk.h>
+#include "menu.h"
#include "epan/packet_info.h"
#include "simple_dialog.h"
#include "tap.h"
#include "../register.h"
-#include "rpc_stat.h"
#include "packet-rpc.h"
#include "../globals.h"
#include "compat_macros.h"
dlg=NULL;
}
-void
+static void
gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
int i;
{
register_ethereal_tap("rpc,rtt,", gtk_rpcstat_init);
}
+
+void
+register_tap_menu_gtkrpcstat(void)
+{
+ register_tap_menu_item("ONC-RPC/RTT", gtk_rpcstat_cb);
+}
+++ /dev/null
-/* rpc_stat.h
- * rpc_stat 2002 Ronnie Sahlberg
- *
- * $Id: rpc_stat.h,v 1.3 2002/11/06 10:53:36 sahlberg Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RPCSTAT_H__
-#define __RPCSTAT_H__
-
-void gtk_rpcstat_cb(GtkWidget *w, gpointer d);
-
-#endif
/* smb_stat.c
* smb_stat 2003 Ronnie Sahlberg
*
- * $Id: smb_stat.c,v 1.3 2003/04/23 03:51:03 guy Exp $
+ * $Id: smb_stat.c,v 1.4 2003/04/23 05:37:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <gtk/gtk.h>
#include <string.h>
+#include "menu.h"
#include "../epan/packet_info.h"
#include "../tap.h"
#include "../epan/value_string.h"
#include "../smb.h"
#include "../register.h"
-#include "smb_stat.h"
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "../file.h"
+
static void
add_table_entry(smbstat_t *ss, char *str, int x, int y)
{
}
-void
-register_tap_listener_gtksmbstat(void)
-{
- register_ethereal_tap("smb,rtt", gtk_smbstat_init);
-}
-
static GtkWidget *dlg=NULL, *dlg_box;
static GtkWidget *filter_box;
}
}
-void
+static void
gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
{
/* if the window is already open, bring it to front */
gtk_widget_show_all(dlg);
}
+void
+register_tap_listener_gtksmbstat(void)
+{
+ register_ethereal_tap("smb,rtt", gtk_smbstat_init);
+}
+
+void
+register_tap_menu_gtksmbstat(void)
+{
+ register_tap_menu_item("SMB/RTT", gtk_smbstat_cb);
+}
+++ /dev/null
-/* smb_stat.h
- * smb_stat 2003 Ronnie Sahlberg
- *
- * $Id: smb_stat.h,v 1.1 2003/01/22 00:42:05 sahlberg Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __SMBSTAT_H__
-#define __SMBSTAT_H__
-
-void gtk_smbstat_cb(GtkWidget *w, gpointer d);
-
-#endif