forked from osmocom/wireshark
"gtk_tap_dfilter_dlg_cb()" is no longer used outside
gtk/tap_dfilter_dlg.c; don't export it. That means that gtk/tap_dfilter_dlg.h is no longer useful; get rid of it. Rename "gtk_tap_dfilter_dlg_cb()" to "tap_dfilter_dlg_cb()", as it's inside GTK+-specific code, so there's no need to distinguish it from non-GTK+ callbacks. Update some comments to reflect the name change and the new API for registering tap_dfilter_dlg stats. Make the AFP and SMB stats use the gtk/tap_dfilter_dlg.c stuff. svn path=/trunk/; revision=15496
This commit is contained in:
parent
195c549d1a
commit
b3562ac040
|
@ -95,7 +95,6 @@ noinst_HEADERS = \
|
|||
stream_prefs.h \
|
||||
summary_dlg.h \
|
||||
supported_protos_dlg.h \
|
||||
tap_dfilter_dlg.h \
|
||||
text_page.h \
|
||||
toolbar.h \
|
||||
voip_calls.h \
|
||||
|
|
127
gtk/afp_stat.c
127
gtk/afp_stat.c
|
@ -39,9 +39,6 @@
|
|||
#include <epan/epan.h>
|
||||
#include <epan/value_string.h>
|
||||
|
||||
#include <epan/stat_cmd_args.h>
|
||||
#include "../stat_menu.h"
|
||||
#include "gtk_stat_menu.h"
|
||||
#include <epan/tap.h>
|
||||
#include <epan/dissectors/packet-afp.h>
|
||||
#include "../register.h"
|
||||
|
@ -54,6 +51,8 @@
|
|||
#include "../globals.h"
|
||||
#include "filter_dlg.h"
|
||||
#include "service_response_time_table.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "gtkglobals.h"
|
||||
|
||||
|
||||
|
@ -198,122 +197,16 @@ gtk_afpstat_init(const char *optarg)
|
|||
cf_retap_packets(&cfile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GtkWidget *dlg=NULL;
|
||||
static GtkWidget *filter_entry;
|
||||
|
||||
static void
|
||||
dlg_destroy_cb(void)
|
||||
{
|
||||
dlg=NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
afpstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
|
||||
{
|
||||
GString *str;
|
||||
const char *filter;
|
||||
|
||||
str = g_string_new("afp,srt");
|
||||
filter=gtk_entry_get_text(GTK_ENTRY(filter_entry));
|
||||
if(filter[0]!=0){
|
||||
g_string_sprintfa(str,",%s", filter);
|
||||
}
|
||||
gtk_afpstat_init(str->str);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_afpstat_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||
{
|
||||
GtkWidget *dlg_box;
|
||||
GtkWidget *filter_box, *filter_bt;
|
||||
GtkWidget *bbox, *start_button, *cancel_button;
|
||||
const char *filter;
|
||||
static construct_args_t args = {
|
||||
"Service Response Time Statistics Filter",
|
||||
TRUE,
|
||||
FALSE
|
||||
};
|
||||
|
||||
/* if the window is already open, bring it to front */
|
||||
if(dlg){
|
||||
gdk_window_raise(dlg->window);
|
||||
return;
|
||||
}
|
||||
|
||||
dlg=dlg_window_new("Ethereal: Compute AFP SRT statistics");
|
||||
gtk_window_set_default_size(GTK_WINDOW(dlg), 300, -1);
|
||||
|
||||
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 button */
|
||||
filter_bt=BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
|
||||
SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
|
||||
gtk_box_pack_start(GTK_BOX(filter_box), filter_bt, FALSE, TRUE, 0);
|
||||
gtk_widget_show(filter_bt);
|
||||
|
||||
/* Filter entry */
|
||||
filter_entry=gtk_entry_new();
|
||||
SIGNAL_CONNECT(filter_entry, "changed", filter_te_syntax_check_cb, NULL);
|
||||
|
||||
/* filter prefs dialog */
|
||||
OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_entry);
|
||||
/* filter prefs dialog */
|
||||
|
||||
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 = dlg_button_row_new(ETHEREAL_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
|
||||
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show(bbox);
|
||||
|
||||
start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT);
|
||||
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
|
||||
afpstat_start_button_clicked, NULL);
|
||||
|
||||
cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
|
||||
window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb);
|
||||
|
||||
/* 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);
|
||||
|
||||
gtk_widget_grab_default(start_button );
|
||||
|
||||
/* Give the initial focus to the "Filter" entry box. */
|
||||
gtk_widget_grab_focus(filter_entry);
|
||||
|
||||
SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL);
|
||||
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
|
||||
|
||||
gtk_widget_show_all(dlg);
|
||||
window_present(dlg);
|
||||
}
|
||||
static tap_dfilter_dlg afp_stat_dlg = {
|
||||
"AFP SRT Statistics",
|
||||
"afp,srt",
|
||||
gtk_afpstat_init,
|
||||
-1
|
||||
};
|
||||
|
||||
void
|
||||
register_tap_listener_gtkafpstat(void)
|
||||
{
|
||||
register_stat_cmd_arg("afp,srt", gtk_afpstat_init);
|
||||
|
||||
register_stat_menu_item("AFP...", REGISTER_STAT_GROUP_RESPONSE_TIME,
|
||||
gtk_afpstat_cb, NULL, NULL, NULL);
|
||||
register_dfilter_stat(&afp_stat_dlg, "AFP",
|
||||
REGISTER_STAT_GROUP_RESPONSE_TIME);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "compat_macros.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
|
||||
typedef const char* bootp_info_value_t;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
* - "RTP Streams" rtpstream_dlg_create()
|
||||
* - "Simple Dialog" display_simple_dialog()
|
||||
* - "Compute SMB SRT statistics" gtk_smbstat_cb()
|
||||
* - "Compute ..." gtk_tap_dfilter_dlg_cb()
|
||||
* - "Compute ..." tap_dfilter_dlg_cb()
|
||||
* - "Tcp Graph" create_drawing_area()
|
||||
* - "Tcp Graph Control" control_panel_create()
|
||||
* - "Help for TCP graphing" callback_create_help()
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "../globals.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "../globals.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "../globals.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "../globals.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "compat_macros.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
|
||||
#define SUM_STR_MAX 1024
|
||||
|
||||
|
|
127
gtk/smb_stat.c
127
gtk/smb_stat.c
|
@ -38,9 +38,6 @@
|
|||
#include <epan/epan.h>
|
||||
#include <epan/value_string.h>
|
||||
|
||||
#include <epan/stat_cmd_args.h>
|
||||
#include "../stat_menu.h"
|
||||
#include "gtk_stat_menu.h"
|
||||
#include <epan/tap.h>
|
||||
#include "../smb.h"
|
||||
#include "../register.h"
|
||||
|
@ -53,6 +50,8 @@
|
|||
#include "../globals.h"
|
||||
#include "filter_dlg.h"
|
||||
#include "service_response_time_table.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "gtkglobals.h"
|
||||
|
||||
|
||||
|
@ -239,122 +238,16 @@ gtk_smbstat_init(const char *optarg)
|
|||
cf_retap_packets(&cfile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GtkWidget *dlg=NULL;
|
||||
static GtkWidget *filter_entry;
|
||||
|
||||
static void
|
||||
dlg_destroy_cb(void)
|
||||
{
|
||||
dlg=NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
smbstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
|
||||
{
|
||||
GString *str;
|
||||
const char *filter;
|
||||
|
||||
str = g_string_new("smb,srt");
|
||||
filter=gtk_entry_get_text(GTK_ENTRY(filter_entry));
|
||||
if(filter[0]!=0){
|
||||
g_string_sprintfa(str,",%s", filter);
|
||||
}
|
||||
gtk_smbstat_init(str->str);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_smbstat_cb(GtkWidget *w _U_, gpointer d _U_)
|
||||
{
|
||||
GtkWidget *dlg_box;
|
||||
GtkWidget *filter_box, *filter_bt;
|
||||
GtkWidget *bbox, *start_button, *cancel_button;
|
||||
const char *filter;
|
||||
static construct_args_t args = {
|
||||
"Service Response Time Statistics Filter",
|
||||
TRUE,
|
||||
FALSE
|
||||
};
|
||||
|
||||
/* if the window is already open, bring it to front */
|
||||
if(dlg){
|
||||
gdk_window_raise(dlg->window);
|
||||
return;
|
||||
}
|
||||
|
||||
dlg=dlg_window_new("Ethereal: Compute SMB SRT statistics");
|
||||
gtk_window_set_default_size(GTK_WINDOW(dlg), 300, -1);
|
||||
|
||||
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 button */
|
||||
filter_bt=BUTTON_NEW_FROM_STOCK(ETHEREAL_STOCK_DISPLAY_FILTER_ENTRY);
|
||||
SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
|
||||
gtk_box_pack_start(GTK_BOX(filter_box), filter_bt, FALSE, TRUE, 0);
|
||||
gtk_widget_show(filter_bt);
|
||||
|
||||
/* Filter entry */
|
||||
filter_entry=gtk_entry_new();
|
||||
SIGNAL_CONNECT(filter_entry, "changed", filter_te_syntax_check_cb, NULL);
|
||||
|
||||
/* filter prefs dialog */
|
||||
OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_entry);
|
||||
/* filter prefs dialog */
|
||||
|
||||
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 = dlg_button_row_new(ETHEREAL_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
|
||||
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show(bbox);
|
||||
|
||||
start_button = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CREATE_STAT);
|
||||
SIGNAL_CONNECT_OBJECT(start_button, "clicked",
|
||||
smbstat_start_button_clicked, NULL);
|
||||
|
||||
cancel_button = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL);
|
||||
window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb);
|
||||
|
||||
/* 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);
|
||||
|
||||
gtk_widget_grab_default(start_button );
|
||||
|
||||
/* Give the initial focus to the "Filter" entry box. */
|
||||
gtk_widget_grab_focus(filter_entry);
|
||||
|
||||
SIGNAL_CONNECT(dlg, "delete_event", window_delete_event_cb, NULL);
|
||||
SIGNAL_CONNECT(dlg, "destroy", dlg_destroy_cb, NULL);
|
||||
|
||||
gtk_widget_show_all(dlg);
|
||||
window_present(dlg);
|
||||
}
|
||||
static tap_dfilter_dlg smb_stat_dlg = {
|
||||
"SMB SRT Statistics",
|
||||
"smb,srt",
|
||||
gtk_smbstat_init,
|
||||
-1
|
||||
};
|
||||
|
||||
void
|
||||
register_tap_listener_gtksmbstat(void)
|
||||
{
|
||||
register_stat_cmd_arg("smb,srt", gtk_smbstat_init);
|
||||
|
||||
register_stat_menu_item("SMB...", REGISTER_STAT_GROUP_RESPONSE_TIME,
|
||||
gtk_smbstat_cb, NULL, NULL, NULL);
|
||||
register_dfilter_stat(&smb_stat_dlg, "SMB",
|
||||
REGISTER_STAT_GROUP_RESPONSE_TIME);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "dlg_utils.h"
|
||||
#include "compat_macros.h"
|
||||
#include "../stat_menu.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
|
||||
struct _st_node_pres {
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "../stat_menu.h"
|
||||
#include "gtk_stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
#include "gtkglobals.h"
|
||||
|
||||
|
@ -63,6 +62,9 @@ static tap_dfilter_dlg_list_item *start_dlg_list=NULL;
|
|||
static tap_dfilter_dlg_list_item *end_dlg_list=NULL;
|
||||
static tap_dfilter_dlg_list_item *current_dlg = NULL;
|
||||
|
||||
static void
|
||||
tap_dfilter_dlg_cb(GtkWidget *w, gpointer data);
|
||||
|
||||
/*
|
||||
* Register a stat that has a display filter dialog.
|
||||
* We register it both as a command-line stat and a menu item stat.
|
||||
|
@ -80,7 +82,7 @@ register_dfilter_stat(tap_dfilter_dlg *info, const char *name,
|
|||
* to it.
|
||||
*/
|
||||
full_name = g_strdup_printf("%s...", name);
|
||||
register_stat_menu_item(full_name, group, gtk_tap_dfilter_dlg_cb, NULL,
|
||||
register_stat_menu_item(full_name, group, tap_dfilter_dlg_cb, NULL,
|
||||
NULL, info);
|
||||
g_free(full_name);
|
||||
}
|
||||
|
@ -125,8 +127,8 @@ tap_dfilter_dlg_start_button_clicked(GtkWidget *item _U_, gpointer dialog_data)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
gtk_tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
|
||||
static void
|
||||
tap_dfilter_dlg_cb(GtkWidget *w _U_, gpointer data)
|
||||
{
|
||||
const char *filter;
|
||||
char *title;
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* tap_dfilter_dlg.h
|
||||
* Header file for display filter dialog used by GTK gui taps
|
||||
* Copyright 2003 Lars Roland
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Display filter dialog box used by GTK gui taps.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create the filter dialog box.
|
||||
*
|
||||
* @param widget parent widget (unused)
|
||||
* @param data the dfilter tap dialog
|
||||
*/
|
||||
void gtk_tap_dfilter_dlg_cb(GtkWidget *widget, gpointer data);
|
|
@ -44,7 +44,6 @@
|
|||
#include <epan/dissectors/packet-wsp.h>
|
||||
#include "../stat_menu.h"
|
||||
#include "../tap_dfilter_dlg.h"
|
||||
#include "tap_dfilter_dlg.h"
|
||||
|
||||
/* used to keep track of the stats for a specific PDU type*/
|
||||
typedef struct _wsp_pdu_t {
|
||||
|
|
|
@ -31,20 +31,24 @@
|
|||
* 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.
|
||||
* the filter string and without the separating 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_stat_menu_item() with gtk_tap_dfilter_dlg_cb as callback and a pointer
|
||||
* to the global tap_dfilter_dlg structure .
|
||||
* Within register_tap_menu_yourtap(void), call register_dfilter_stat()
|
||||
* with a pointer to the tap_dfilter_dlg structure, a string for the
|
||||
* menu item (don't put "..." at the end, register_dfilter_stat() will
|
||||
* add it for you), and the REGISTER_STAT_GROUP_ value for the stat
|
||||
* group to which your stat should belong.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* tap_dfilter_dlg my_tap_dfilter_dlg = {"My Title", "myproto,mytap", gtk_mytap_init, -1};
|
||||
*
|
||||
* register_tap_menu_mytap(void) {
|
||||
* register_stat_menu_item(char *menu_string, gtk_tap_dfilter_dlg_cb, NULL, NULL, &(my_tap_dfilter_dlg));
|
||||
* register_dfilter_stat(&my_tap_dfilter_dlg, "My Menu Item",
|
||||
* REGISTER_STAT_GROUP_my_group);
|
||||
* }
|
||||
*
|
||||
* See also: h225_ras_srt.c or h225_counter.c
|
||||
|
|
Loading…
Reference in New Issue