From Lars Roland: have common code to handle display filter dialogs in

taps, and use that in the H.225 taps.

svn path=/trunk/; revision=9327
This commit is contained in:
Guy Harris 2003-12-17 22:13:08 +00:00
parent 1f97bdc27a
commit ac48df79f2
33 changed files with 362 additions and 315 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for the GTK interface routines for Ethereal
#
# $Id: Makefile.am,v 1.80 2003/12/12 19:55:27 guy Exp $
# $Id: Makefile.am,v 1.81 2003/12/17 22:13:05 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@ -144,6 +144,8 @@ libui_a_SOURCES = \
summary_dlg.h \
supported_protos_dlg.c \
supported_protos_dlg.h \
tap_dfilter_dlg.c \
tap_dfilter_dlg.h \
tcp_graph.c \
tcp_graph.h \
toolbar.c \
@ -236,6 +238,8 @@ libui_a_SOURCES = \
summary_dlg.h \
supported_protos_dlg.c \
supported_protos_dlg.h \
tap_dfilter_dlg.c \
tap_dfilter_dlg.h \
tcp_graph.c \
tcp_graph.h \
toolbar.c \

View File

@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.65 2003/12/12 19:55:28 guy Exp $
# $Id: Makefile.nmake,v 1.66 2003/12/17 22:13:05 guy Exp $
include ..\config.nmake
@ -101,6 +101,7 @@ OBJECTS = \
stream_prefs.obj \
summary_dlg.obj \
supported_protos_dlg.obj \
tap_dfilter_dlg.obj \
tcp_graph.obj \
ui_util.obj \
toolbar.obj \

View File

@ -5,7 +5,7 @@
*
* MUCH code modified from service_response_time_table.c.
*
* $Id: ansi_a_stat.c,v 1.5 2003/12/16 18:43:33 oabad Exp $
* $Id: ansi_a_stat.c,v 1.6 2003/12/17 22:13:05 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -551,6 +551,6 @@ register_tap_listener_gtkansi_a_stat(void)
void
register_tap_menu_gtkansi_a_stat(void)
{
register_tap_menu_item("Statistics/ANSI A-Interface/BSMAP", ansi_a_stat_gtk_bsmap_cb, NULL, NULL);
register_tap_menu_item("Statistics/ANSI A-Interface/DTAP", ansi_a_stat_gtk_dtap_cb, NULL, NULL);
register_tap_menu_item("Statistics/ANSI A-Interface/BSMAP", ansi_a_stat_gtk_bsmap_cb, NULL, NULL ,NULL);
register_tap_menu_item("Statistics/ANSI A-Interface/DTAP", ansi_a_stat_gtk_dtap_cb, NULL, NULL ,NULL);
}

View File

@ -5,7 +5,7 @@
*
* MUCH code modified from service_response_time_table.c.
*
* $Id: ansi_map_stat.c,v 1.4 2003/12/16 18:43:33 oabad Exp $
* $Id: ansi_map_stat.c,v 1.5 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -481,5 +481,5 @@ register_tap_listener_gtkansi_map_stat(void)
void
register_tap_menu_gtkansi_map_stat(void)
{
register_tap_menu_item("Statistics/ANSI MAP Operation", ansi_map_stat_gtk_cb, NULL, NULL);
register_tap_menu_item("Statistics/ANSI MAP Operation", ansi_map_stat_gtk_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* bootp_stat.c
* boop_stat 2003 Jean-Michel FAYARD
*
* $Id: bootp_stat.c,v 1.8 2003/12/16 18:43:33 oabad Exp $
* $Id: bootp_stat.c,v 1.9 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -376,5 +376,5 @@ void
register_tap_menu_gtkdhcpstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/BOOTP-DHCP...",
gtk_dhcpstat_cb, NULL, NULL);
gtk_dhcpstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* dcerpc_stat.c
* dcerpc_stat 2002 Ronnie Sahlberg
*
* $Id: dcerpc_stat.c,v 1.35 2003/12/16 18:43:33 oabad Exp $
* $Id: dcerpc_stat.c,v 1.36 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -678,5 +678,5 @@ void
register_tap_menu_gtkdcerpcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/DCE-RPC...",
gtk_dcerpcstat_cb, NULL, NULL);
gtk_dcerpcstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_eth.c
* endpoint_talkers_eth 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_eth.c,v 1.18 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_eth.c,v 1.19 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_eth_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/Ethernet",
gtk_eth_endpoints_cb, NULL, NULL);
gtk_eth_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_fc.c
* endpoint_talkers_fc 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_fc.c,v 1.18 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_fc.c,v 1.19 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_fc_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/Fibre Channel",
gtk_fc_endpoints_cb, NULL, NULL);
gtk_fc_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_fddi.c
* endpoint_talkers_fddi 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_fddi.c,v 1.13 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_fddi.c,v 1.14 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_fddi_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/FDDI",
gtk_fddi_endpoints_cb, NULL, NULL);
gtk_fddi_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_ip.c
* endpoint_talkers_ip 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_ip.c,v 1.19 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_ip.c,v 1.20 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -80,7 +80,7 @@ void
register_tap_menu_ip_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/IPv4",
gtk_ip_endpoints_cb, NULL, NULL);
gtk_ip_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_ipx.c
* endpoint_talkers_ipx 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_ipx.c,v 1.17 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_ipx.c,v 1.18 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_ipx_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/IPX",
gtk_ipx_endpoints_cb, NULL, NULL);
gtk_ipx_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_tcpip.c
* endpoint_talkers_tcpip 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_tcpip.c,v 1.20 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_tcpip.c,v 1.21 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_tcpip_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/TCP (IPv4 IPv6)",
gtk_tcpip_endpoints_cb, NULL, NULL);
gtk_tcpip_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_tr.c
* endpoint_talkers_tr 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_tr.c,v 1.19 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_tr.c,v 1.20 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_tr_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/Token Ring",
gtk_tr_endpoints_cb, NULL, NULL);
gtk_tr_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* endpoint_talkers_udpip.c
* endpoint_talkers_udpip 2003 Ronnie Sahlberg
*
* $Id: endpoint_talkers_udpip.c,v 1.20 2003/09/24 02:36:34 guy Exp $
* $Id: endpoint_talkers_udpip.c,v 1.21 2003/12/17 22:13:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -82,7 +82,7 @@ void
register_tap_menu_udpip_talkers(void)
{
register_tap_menu_item("Statistics/Conversation List/UDP (IPv4 IPv6)",
gtk_udpip_endpoints_cb, NULL, NULL);
gtk_udpip_endpoints_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* fc_stat.c
* fc_stat 2003 Ronnie Sahlberg
*
* $Id: fc_stat.c,v 1.15 2003/12/16 18:43:33 oabad Exp $
* $Id: fc_stat.c,v 1.16 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -329,5 +329,5 @@ void
register_tap_menu_gtkfcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/Fibre Channel...",
gtk_fcstat_cb, NULL, NULL);
gtk_fcstat_cb, NULL, NULL, NULL);
}

View File

@ -5,7 +5,7 @@
*
* MUCH code modified from service_response_time_table.c.
*
* $Id: gsm_a_stat.c,v 1.5 2003/12/16 18:43:33 oabad Exp $
* $Id: gsm_a_stat.c,v 1.6 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -708,26 +708,26 @@ void
register_tap_menu_gtkgsm_a_stat(void)
{
register_tap_menu_item("Statistics/GSM A-Interface/BSSMAP",
gsm_a_stat_gtk_bssmap_cb, NULL, NULL);
gsm_a_stat_gtk_bssmap_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/Mobility Management",
gsm_a_stat_gtk_dtap_mm_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_mm_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/Radio Resource Management",
gsm_a_stat_gtk_dtap_rr_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_rr_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/Call Control",
gsm_a_stat_gtk_dtap_cc_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_cc_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/GPRS Mobility Management",
gsm_a_stat_gtk_dtap_gmm_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_gmm_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/Short Message Service",
gsm_a_stat_gtk_dtap_sms_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_sms_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/GPRS Session Management",
gsm_a_stat_gtk_dtap_sm_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_sm_cb, NULL, NULL, NULL);
register_tap_menu_item("Statistics/GSM A-Interface/DTAP/Supplementary Services",
gsm_a_stat_gtk_dtap_ss_cb, NULL, NULL);
gsm_a_stat_gtk_dtap_ss_cb, NULL, NULL, NULL);
}

View File

@ -2,7 +2,7 @@
* h225 message counter for ethereal
* Copyright 2003 Lars Roland
*
* $Id: h225_counter.c,v 1.4 2003/12/16 18:43:34 oabad Exp $
* $Id: h225_counter.c,v 1.5 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -48,11 +48,13 @@
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
#include "tap_dfilter_dlg.h"
extern GtkWidget *main_display_filter_widget;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
void gtk_h225counter_init(char *optarg);
tap_dfilter_dlg h225_counter_dlg = {"H.225 Messages and Message Reasons", "h225,counter", gtk_h225counter_init, -1};
/* following values represent the size of their valuestring arrays */
@ -509,127 +511,6 @@ gtk_h225counter_init(char *optarg)
redissect_packets(&cfile);
}
static void
dlg_destroy_cb(void)
{
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
h225counter_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
char *filter;
char str[256];
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_h225counter_init("h225,counter");
} else {
sprintf(str,"h225,counter,%s", filter);
gtk_h225counter_init(str);
}
}
static void
gtk_h225counter_cb(GtkWidget *w _U_, gpointer d _U_)
{
const char *filter;
char *title;
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
title = g_strdup_printf("Ethereal: H.225 Messages and Message Reasons: %s", cf_get_display_name(&cfile));
dlg=dlg_window_new(title);
g_free(title);
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* Filter label */
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
/* Filter entry */
filter_entry=gtk_entry_new();
WIDGET_SET_SIZE(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
}
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
h225counter_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* Catch the "activate" signal on the filter text entry, so that
if the user types Return there, we act as if the "Create Stat"
button had been selected, as happens if Return is typed if
some widget that *doesn't* handle the Return key has the input
focus. */
dlg_set_activate(filter_entry, start_button);
/* Catch the "key_press_event" signal in the window, so that we can
catch the ESC key being pressed and act as if the "Cancel" button
had been selected. */
dlg_set_cancel(dlg, cancel_button);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
void
register_tap_listener_gtk_h225counter(void)
{
@ -640,5 +521,5 @@ void
register_tap_menu_gtk_h225counter(void)
{
register_tap_menu_item("Statistics/Watch protocol/ITU-T H.225...",
gtk_h225counter_cb, NULL, NULL);
gtk_tap_dfilter_dlg_cb, NULL, NULL, &(h225_counter_dlg));
}

View File

@ -2,7 +2,7 @@
* h225 RAS Service Response Time statistics for ethereal
* Copyright 2003 Lars Roland
*
* $Id: h225_ras_srt.c,v 1.3 2003/12/16 18:43:34 oabad Exp $
* $Id: h225_ras_srt.c,v 1.4 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -49,11 +49,13 @@
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
#include "tap_dfilter_dlg.h"
extern GtkWidget *main_display_filter_widget;
static GtkWidget *dlg=NULL;
static GtkWidget *filter_entry;
void gtk_h225rassrt_init(char *optarg);
tap_dfilter_dlg h225_rassrt_dlg = {"H.225 RAS Service Response Time", "h225,srt", gtk_h225rassrt_init, -1};
/* following values represent the size of their valuestring arrays */
#define NUM_RAS_STATS 7
@ -306,127 +308,6 @@ gtk_h225rassrt_init(char *optarg)
redissect_packets(&cfile);
}
static void
dlg_destroy_cb(void)
{
dlg=NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
h225rassrt_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
char *filter;
char str[256];
filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]==0){
gtk_h225rassrt_init("h225,srt");
} else {
sprintf(str,"h225,srt,%s", filter);
gtk_h225rassrt_init(str);
}
}
static void
gtk_h225rassrt_cb(GtkWidget *w _U_, gpointer d _U_)
{
const char *filter;
char *title;
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
/* if the window is already open, bring it to front */
if(dlg){
gdk_window_raise(dlg->window);
return;
}
title = g_strdup_printf("Ethereal: H.225 RAS Service Response Time: %s", cf_get_display_name(&cfile));
dlg=dlg_window_new(title);
g_free(title);
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* Filter label */
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
/* Filter entry */
filter_entry=gtk_entry_new();
WIDGET_SET_SIZE(filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
}
gtk_widget_show(filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
h225rassrt_start_button_clicked, NULL);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* Catch the "activate" signal on the filter text entry, so that
if the user types Return there, we act as if the "Create Stat"
button had been selected, as happens if Return is typed if
some widget that *doesn't* handle the Return key has the input
focus. */
dlg_set_activate(filter_entry, start_button);
/* Catch the "key_press_event" signal in the window, so that we can
catch the ESC key being pressed and act as if the "Cancel" button
had been selected. */
dlg_set_cancel(dlg, cancel_button);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(filter_entry);
gtk_widget_show_all(dlg);
}
void
register_tap_listener_gtk_h225rassrt(void)
{
@ -437,5 +318,5 @@ void
register_tap_menu_gtk_h225rassrt(void)
{
register_tap_menu_item("Statistics/Service Response Time/ITU-T H.225 RAS ...",
gtk_h225rassrt_cb, NULL, NULL);
gtk_tap_dfilter_dlg_cb, NULL, NULL, &(h225_rassrt_dlg));
}

View File

@ -1,7 +1,7 @@
/* http_stat.c
* http_stat 2003 Jean-Michel FAYARD
*
* $Id: http_stat.c,v 1.10 2003/12/16 18:43:34 oabad Exp $
* $Id: http_stat.c,v 1.11 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -621,5 +621,5 @@ void
register_tap_menu_gtkhttpstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/HTTP...",
gtk_httpstat_cb, NULL, NULL);
gtk_httpstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* io_stat.c
* io_stat 2002 Ronnie Sahlberg
*
* $Id: io_stat.c,v 1.50 2003/12/16 18:43:34 oabad Exp $
* $Id: io_stat.c,v 1.51 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1832,5 +1832,5 @@ void
register_tap_menu_gtkiostat(void)
{
register_tap_menu_item("Statistics/IO/IO-Stat", gtk_iostat_cb, NULL,
NULL);
NULL, NULL);
}

View File

@ -5,7 +5,7 @@
*
* MUCH code modified from service_response_time_table.c.
*
* $Id: isup_stat.c,v 1.4 2003/12/16 18:43:34 oabad Exp $
* $Id: isup_stat.c,v 1.5 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -485,5 +485,5 @@ register_tap_listener_gtkisup_stat(void)
void
register_tap_menu_gtkisup_stat(void)
{
register_tap_menu_item("Statistics/ISUP Message Type", isup_stat_gtk_cb, NULL, NULL);
register_tap_menu_item("Statistics/ISUP Message Type", isup_stat_gtk_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* ldap_stat.c
* ldap_stat 2003 Ronnie Sahlberg
*
* $Id: ldap_stat.c,v 1.3 2003/12/16 18:43:34 oabad Exp $
* $Id: ldap_stat.c,v 1.4 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -364,5 +364,5 @@ void
register_tap_menu_gtkldapstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/LDAP...",
gtk_ldapstat_cb, NULL, NULL);
gtk_ldapstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
* $Id: menu.c,v 1.127 2003/12/17 20:28:49 ulfl Exp $
* $Id: menu.c,v 1.128 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -494,7 +494,8 @@ static menu_item_t tap_menu_tree_root;
void
register_tap_menu_item(char *name, GtkItemFactoryCallback callback,
gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *),
gboolean (*selected_tree_row_enabled)(field_info *))
gboolean (*selected_tree_row_enabled)(field_info *),
gpointer callback_data)
{
static const char toolspath[] = "/Analyze/";
char *p;
@ -589,7 +590,7 @@ register_tap_menu_item(char *name, GtkItemFactoryCallback callback,
entry = g_malloc0(sizeof (GtkItemFactoryEntry));
entry->path = menupath;
entry->callback = callback;
gtk_item_factory_create_item(main_menu_factory, entry, NULL, 2);
gtk_item_factory_create_item(main_menu_factory, entry, callback_data, 2);
set_menu_sensitivity(main_menu_factory, menupath, FALSE); /* no capture file yet */
child = g_malloc(sizeof (menu_item_t));
child->name = menupath;

View File

@ -1,7 +1,7 @@
/* menu.h
* Menu definitions
*
* $Id: menu.h,v 1.12 2003/12/13 18:01:30 ulfl Exp $
* $Id: menu.h,v 1.13 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -61,7 +61,8 @@ gint popup_menu_handler(GtkWidget *widget, GdkEvent *event, gpointer data);
*/
extern void register_tap_menu_item(char *name, GtkItemFactoryCallback callback,
gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *),
gboolean (*selected_tree_row_enabled)(field_info *));
gboolean (*selected_tree_row_enabled)(field_info *),
gpointer callback_data);
extern GtkWidget *popup_menu_object;

View File

@ -2,7 +2,7 @@
* mgcp-statistics for ethereal
* Copyright 2003 Lars Roland
*
* $Id: mgcp_stat.c,v 1.19 2003/12/16 18:43:34 oabad Exp $
* $Id: mgcp_stat.c,v 1.20 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -442,6 +442,6 @@ register_tap_menu_gtkmgcpstat(void)
{
if (find_tap_id("mgcp"))
register_tap_menu_item("Statistics/Service Response Time/MGCP...",
gtk_mgcpstat_cb, NULL, NULL);
gtk_mgcpstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rpc_progs.c
* rpc_progs 2002 Ronnie Sahlberg
*
* $Id: rpc_progs.c,v 1.14 2003/12/13 22:23:18 guy Exp $
* $Id: rpc_progs.c,v 1.15 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -411,6 +411,6 @@ void
register_tap_menu_gtkrpcprogs(void)
{
register_tap_menu_item("Statistics/ONC-RPC/Programs", gtk_rpcprogs_cb,
NULL, NULL);
NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rpc_stat.c
* rpc_stat 2002 Ronnie Sahlberg
*
* $Id: rpc_stat.c,v 1.28 2003/12/16 18:43:35 oabad Exp $
* $Id: rpc_stat.c,v 1.29 2003/12/17 22:13:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -540,5 +540,5 @@ void
register_tap_menu_gtkrpcstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/ONC-RPC...",
gtk_rpcstat_cb, NULL, NULL);
gtk_rpcstat_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rtp_analysis.c
* RTP analysis addition for ethereal
*
* $Id: rtp_analysis.c,v 1.14 2003/12/16 18:43:35 oabad Exp $
* $Id: rtp_analysis.c,v 1.15 2003/12/17 22:13:07 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -2049,5 +2049,5 @@ void
register_tap_menu_rtp_analysis(void)
{
register_tap_menu_item("Statistics/RTP Streams/Analyse...",
rtp_analysis_cb, NULL, NULL);
rtp_analysis_cb, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* rtp_stream_dlg.c
* RTP streams summary addition for ethereal
*
* $Id: rtp_stream_dlg.c,v 1.6 2003/12/16 18:43:35 oabad Exp $
* $Id: rtp_stream_dlg.c,v 1.7 2003/12/17 22:13:08 guy Exp $
*
* Copyright 2003, Alcatel Business Systems
* By Lars Ruoff <lars.ruoff@gmx.net>
@ -764,5 +764,5 @@ void
register_tap_menu_rtp_stream(void)
{
register_tap_menu_item("Statistics/RTP Streams/Show All...",
rtpstream_launch, NULL, NULL);
rtpstream_launch, NULL, NULL, NULL);
}

View File

@ -1,7 +1,7 @@
/* smb_stat.c
* smb_stat 2003 Ronnie Sahlberg
*
* $Id: smb_stat.c,v 1.26 2003/12/16 18:43:35 oabad Exp $
* $Id: smb_stat.c,v 1.27 2003/12/17 22:13:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -369,5 +369,5 @@ void
register_tap_menu_gtksmbstat(void)
{
register_tap_menu_item("Statistics/Service Response Time/SMB...",
gtk_smbstat_cb, NULL, NULL);
gtk_smbstat_cb, NULL, NULL, NULL);
}

217
gtk/tap_dfilter_dlg.c Normal file
View File

@ -0,0 +1,217 @@
/* tap_dfilter_dlg.c
* Routines for display filter dialog used by gui taps
* Copyright 2003 Lars Roland
*
* $Id: tap_dfilter_dlg.c,v 1.1 2003/12/17 22:13:08 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <gtk/gtk.h>
#include <string.h>
#include "compat_macros.h"
#include "../simple_dialog.h"
#include "dlg_utils.h"
#include "../file.h"
#include "../globals.h"
#include "tap_dfilter_dlg.h"
extern GtkWidget *main_display_filter_widget;
typedef struct _tap_dfilter_dlg_list_item {
GtkWidget *dlg;
GtkWidget *filter_entry;
tap_dfilter_dlg cont;
struct _tap_dfilter_dlg_list_item *next;
} tap_dfilter_dlg_list_item;
tap_dfilter_dlg_list_item *start_dlg_list=NULL;
tap_dfilter_dlg_list_item *end_dlg_list=NULL;
tap_dfilter_dlg_list_item *current_dlg = NULL;
static void
dlg_destroy_cb(GtkWidget *item _U_, gpointer dialog_data)
{
tap_dfilter_dlg_list_item *dlg_data = (tap_dfilter_dlg_list_item *) dialog_data;
dlg_data->dlg = NULL;
}
static void
dlg_cancel_cb(GtkWidget *cancel_bt _U_, gpointer parent_w)
{
gtk_widget_destroy(GTK_WIDGET(parent_w));
}
static void
tap_dfilter_dlg_start_button_clicked(GtkWidget *item _U_, gpointer dialog_data)
{
char *filter;
char str[256];
tap_dfilter_dlg_list_item *dlg_data = (tap_dfilter_dlg_list_item *) dialog_data;
filter=(char *)gtk_entry_get_text(GTK_ENTRY(dlg_data->filter_entry));
if(filter[0]==0){
sprintf(str,"%s", dlg_data->cont.init_string);
} else {
sprintf(str,"%s,%s", dlg_data->cont.init_string, filter);
}
(dlg_data->cont.tap_init_cb)(str);
}
void
gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
{
const char *filter;
char *title;
GtkWidget *dlg_box;
GtkWidget *filter_box, *filter_label;
GtkWidget *bbox, *start_button, *cancel_button;
tap_dfilter_dlg *dlg_data = (tap_dfilter_dlg *) data;
if(dlg_data==NULL)
return;
if(dlg_data->index==-1) {
/* Dialog is not registered */
if(start_dlg_list==NULL) {
start_dlg_list = (tap_dfilter_dlg_list_item *) g_malloc(sizeof (tap_dfilter_dlg_list_item));
end_dlg_list = start_dlg_list;
end_dlg_list->cont.index = 0; /* first entry in list -> index = 0 */
} else {
end_dlg_list->next = (tap_dfilter_dlg_list_item *) g_malloc(sizeof (tap_dfilter_dlg_list_item));
end_dlg_list->next->cont.index = end_dlg_list->cont.index + 1;
end_dlg_list = end_dlg_list->next;
}
end_dlg_list->dlg = NULL;
end_dlg_list->filter_entry = NULL;
end_dlg_list->cont.win_title = dlg_data->win_title;
end_dlg_list->cont.init_string = dlg_data->init_string;
end_dlg_list->cont.tap_init_cb = dlg_data->tap_init_cb;
end_dlg_list->next = NULL;
dlg_data->index = end_dlg_list->cont.index;
current_dlg = end_dlg_list;
} else {
/* Dialog is registered, find it */
current_dlg = start_dlg_list;
while(dlg_data->index != current_dlg->cont.index)
{
if(current_dlg->next == NULL) {
/* could not find any dialog */
return;
}
current_dlg = current_dlg->next;
}
}
/* if the window is already open, bring it to front */
if(current_dlg->dlg){
gdk_window_raise(current_dlg->dlg->window);
return;
}
title = g_strdup_printf("Ethereal: %s: %s", current_dlg->cont.win_title , cf_get_display_name(&cfile));
current_dlg->dlg=dlg_window_new(title);
g_free(title);
SIGNAL_CONNECT(current_dlg->dlg, "destroy", dlg_destroy_cb, current_dlg);
dlg_box=gtk_vbox_new(FALSE, 10);
gtk_container_border_width(GTK_CONTAINER(dlg_box), 10);
gtk_container_add(GTK_CONTAINER(current_dlg->dlg), dlg_box);
gtk_widget_show(dlg_box);
/* Filter box */
filter_box=gtk_hbox_new(FALSE, 3);
/* Filter label */
filter_label=gtk_label_new("Filter:");
gtk_box_pack_start(GTK_BOX(filter_box), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
/* Filter entry */
current_dlg->filter_entry=gtk_entry_new();
WIDGET_SET_SIZE(current_dlg->filter_entry, 300, -2);
gtk_box_pack_start(GTK_BOX(filter_box), current_dlg->filter_entry, TRUE, TRUE, 0);
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
if(filter){
gtk_entry_set_text(GTK_ENTRY(current_dlg->filter_entry), filter);
}
gtk_widget_show(current_dlg->filter_entry);
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
/* button box */
bbox = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_DEFAULT_STYLE);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
gtk_widget_show(bbox);
/* the start button */
start_button=gtk_button_new_with_label("Create Stat");
SIGNAL_CONNECT(start_button, "clicked",
tap_dfilter_dlg_start_button_clicked, current_dlg);
gtk_box_pack_start(GTK_BOX(bbox), start_button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS(start_button, GTK_CAN_DEFAULT);
gtk_widget_grab_default(start_button);
gtk_widget_show(start_button);
#if GTK_MAJOR_VERSION < 2
cancel_button=gtk_button_new_with_label("Cancel");
#else
cancel_button=gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#endif
SIGNAL_CONNECT(cancel_button, "clicked", dlg_cancel_cb, current_dlg->dlg);
GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0);
gtk_widget_show(cancel_button);
/* Catch the "activate" signal on the filter text entry, so that
if the user types Return there, we act as if the "Create Stat"
button had been selected, as happens if Return is typed if
some widget that *doesn't* handle the Return key has the input
focus. */
dlg_set_activate(current_dlg->filter_entry, start_button);
/* Catch the "key_press_event" signal in the window, so that we can
catch the ESC key being pressed and act as if the "Cancel" button
had been selected. */
dlg_set_cancel(current_dlg->dlg, cancel_button);
/* Give the initial focus to the "Filter" entry box. */
gtk_widget_grab_focus(current_dlg->filter_entry);
gtk_widget_show_all(current_dlg->dlg);
}

61
gtk/tap_dfilter_dlg.h Normal file
View File

@ -0,0 +1,61 @@
/* tap_dfilter_dlg.h
* Header file for display filter dialog used by gui taps
* Copyright 2003 Lars Roland
*
* $Id: tap_dfilter_dlg.h,v 1.1 2003/12/17 22:13:08 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.
*/
/*
* You can easily add a display filter dialog for your gui tap by using
* the following infrastructure:
*
* Define a global structure of tap_dfilter_dlg within your tap source file.
* Initiate it with:
* 1) a title string for the Dialog Window
* 2) the init string, which is the same as the string after "-z" option without
* the filter string and without the seperating comma.
* 3) a pointer to the init function of the tap, which will be called when you click
* on the start button in the display filter dialog.
* 4) the index with "-1"
*
* Within register_tap_menu_yourtap(void), call register_tap_menu_item() with gtk_tap_dfilter_dlg_cb as callback and a pointer
* to the global tap_dfilter_dlg structure .
*
* Usage:
*
* tap_dfilter_dlg my_tap_dfilter_dlg = {"My Title", "myproto,mytap", gtk_mytap_init, -1};
*
* register_tap_menu_mytap(void) {
* register_tap_menu_item(char *menu_string, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(my_tap_dfilter_dlg));
* }
*
* See also: h225_ras_srt.c or h225_counter.c
*
*/
typedef struct _tap_dfilter_dlg {
char *win_title; /* title */
char *init_string; /* the string to call the tap without a filter via "-z" option */
void (* tap_init_cb)(char *); /* callback to init function of the tap */
gint index; /* initiate this value always with "-1" */
} tap_dfilter_dlg;
void gtk_tap_dfilter_dlg_cb(GtkWidget *w, gpointer data);

View File

@ -1,7 +1,7 @@
/* wsp_stat.c
* wsp_stat 2003 Jean-Michel FAYARD
*
* $Id: wsp_stat.c,v 1.8 2003/12/16 18:43:35 oabad Exp $
* $Id: wsp_stat.c,v 1.9 2003/12/17 22:13:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -525,5 +525,5 @@ void
register_tap_menu_gtkwspstat(void)
{
register_tap_menu_item("Statistics/Watch protocol/WAP-WSP...",
gtk_wspstat_cb, NULL, NULL);
gtk_wspstat_cb, NULL, NULL, NULL);
}