diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-09-27 11:07:16 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-09-27 11:07:16 +0000 |
commit | 6d92d90db56f6ac8781592048c28e43e675cb32c (patch) | |
tree | f4e7c7221b6e38e315fb513a8f585ede74834b29 /gtk2 | |
parent | 84a53b35f19ec41f3bab2b9d73ccb61282c5fc64 (diff) |
Update tethereal to put the filter string in the statistics table for RPC_STAT.
Update gtk and gtk2 versions of RPC_STAT to allow a filter string to be specified on both the command line as well as the GUI.
Update the documentation for ethereal to reflect this.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6343 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk2')
-rw-r--r-- | gtk2/main.c | 15 | ||||
-rw-r--r-- | gtk2/rpc_stat.c | 57 | ||||
-rw-r--r-- | gtk2/rpc_stat.h | 4 |
3 files changed, 57 insertions, 19 deletions
diff --git a/gtk2/main.c b/gtk2/main.c index 8d36805fa2..11318ef49f 100644 --- a/gtk2/main.c +++ b/gtk2/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.12 2002/09/23 19:09:52 oabad Exp $ + * $Id: main.c,v 1.13 2002/09/27 11:07:15 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1703,17 +1703,22 @@ main(int argc, char *argv[]) if(!strncmp(optarg,"rpc,",4)){ if(!strncmp(optarg,"rpc,rtt,",8)){ int rpcprogram, rpcversion; - if(sscanf(optarg,"rpc,rtt,%d,%d",&rpcprogram,&rpcversion)==2){ - gtk_rpcstat_init(rpcprogram,rpcversion); + int pos=0; + if(sscanf(optarg,"rpc,rtt,%d,%d,%n",&rpcprogram,&rpcversion,&pos)==2){ + if(pos){ + gtk_rpcstat_init(rpcprogram,rpcversion,optarg+pos); + } else { + gtk_rpcstat_init(rpcprogram,rpcversion,NULL); + } } else { - fprintf(stderr, "ethereal: invalid \"-z rpc,rtt,<program>,<version>\" argument\n"); + fprintf(stderr, "ethereal: invalid \"-z rpc,rtt,<program>,<version>[,<filter>]\" argument\n"); exit(1); } } else if(!strncmp(optarg,"rpc,programs",12)){ gtk_rpcprogs_init(); } else { fprintf(stderr, "ethereal: invalid -z argument. Argument must be one of:\n"); - fprintf(stderr, " \"-z rpc,rtt,<program>,<version>\"\n"); + fprintf(stderr, " \"-z rpc,rtt,<program>,<version>[,<filter>]\"\n"); fprintf(stderr, " \"-z rpc,programs\"\n"); exit(1); } diff --git a/gtk2/rpc_stat.c b/gtk2/rpc_stat.c index bb0218d96b..c1c6c471ea 100644 --- a/gtk2/rpc_stat.c +++ b/gtk2/rpc_stat.c @@ -1,7 +1,7 @@ /* rpc_stat.c * rpc_stat 2002 Ronnie Sahlberg * - * $Id: rpc_stat.c,v 1.1 2002/09/07 09:28:05 sahlberg Exp $ + * $Id: rpc_stat.c,v 1.2 2002/09/27 11:07:16 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -34,6 +34,7 @@ #include <gtk/gtk.h> #include "epan/packet_info.h" +#include "simple_dialog.h" #include "tap.h" #include "rpc_stat.h" #include "packet-rpc.h" @@ -268,13 +269,15 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) /* When called, this function will create a new instance of gtk2-rpcstat. */ void -gtk_rpcstat_init(guint32 program, guint32 version) +gtk_rpcstat_init(guint32 program, guint32 version, char *filter) { rpcstat_t *rs; guint32 i; char title_string[60]; + char filter_string[256]; GtkWidget *vbox; GtkWidget *stat_label; + GtkWidget *filter_label; GtkWidget *tmp; rpc_program=program; @@ -298,6 +301,11 @@ gtk_rpcstat_init(guint32 program, guint32 version) gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); gtk_widget_show(stat_label); + snprintf(filter_string,255,"Filter:%s",filter?filter:""); + filter_label=gtk_label_new(filter_string); + gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0); + gtk_widget_show(filter_label); + rpc_min_proc=-1; rpc_max_proc=-1; @@ -373,34 +381,44 @@ gtk_rpcstat_init(guint32 program, guint32 version) gtk_widget_show(rs->table); - if(register_tap_listener("rpc", rs, NULL, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw)){ + if(register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw)){ + char str[256]; /* error, we failed to attach to the tap. clean up */ + snprintf(str,255,"Could not attach to tap using filter:%s",filter?filter:""); + simple_dialog(ESD_TYPE_WARN, NULL, str); g_free(rs->procedures); g_free(rs); - /* XXX print some error string */ + return; } gtk_widget_show_all(rs->win); } -static void -rpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_) -{ - gtk_rpcstat_init(rpc_program, rpc_version); -} - - - static GtkWidget *dlg=NULL, *dlg_box; static GtkWidget *prog_box; static GtkWidget *prog_label, *prog_opt, *prog_menu; static GtkWidget *vers_label, *vers_opt, *vers_menu; +static GtkWidget *filter_box; +static GtkWidget *filter_label, *filter_entry; static GtkWidget *start_button; + +static void +rpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_) +{ + char *filter; + + filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry)); + if(filter[0]==0){ + filter=NULL; + } + gtk_rpcstat_init(rpc_program, rpc_version, filter); +} + static void rpcstat_version_select(GtkWidget *item _U_, gpointer key) { @@ -534,6 +552,21 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(dlg_box), prog_box, TRUE, TRUE, 0); gtk_widget_show(prog_box); + /* filter box */ + filter_box=gtk_hbox_new(FALSE, 10); + /* Filter label */ + gtk_container_set_border_width(GTK_CONTAINER(filter_box), 10); + 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=gtk_entry_new_with_max_length(250); + gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0); + gtk_widget_show(filter_entry); + + gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0); + gtk_widget_show(filter_box); + /* the start button */ start_button=gtk_button_new_with_label("Create Stat"); diff --git a/gtk2/rpc_stat.h b/gtk2/rpc_stat.h index cc69bb4543..9ff4590afb 100644 --- a/gtk2/rpc_stat.h +++ b/gtk2/rpc_stat.h @@ -1,7 +1,7 @@ /* rpc_stat.h * rpc_stat 2002 Ronnie Sahlberg * - * $Id: rpc_stat.h,v 1.1 2002/09/07 09:28:05 sahlberg Exp $ + * $Id: rpc_stat.h,v 1.2 2002/09/27 11:07:16 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -25,7 +25,7 @@ #ifndef __RPCSTAT_H__ #define __RPCSTAT_H__ -void gtk_rpcstat_init(guint32 program, guint32 version); +void gtk_rpcstat_init(guint32 program, guint32 version, char *filter); void gtk_rpcstat_cb(GtkWidget *w, gpointer d); #endif |