diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-27 11:07:16 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-09-27 11:07:16 +0000 |
commit | c0b84c028f41e71d8fb3cb11bb376684bc9cd841 (patch) | |
tree | f4e7c7221b6e38e315fb513a8f585ede74834b29 | |
parent | 3f72fbbb25b39334248efd595697609d154f7ea0 (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.
svn path=/trunk/; revision=6343
-rw-r--r-- | doc/ethereal.pod.template | 21 | ||||
-rw-r--r-- | gtk/main.c | 15 | ||||
-rw-r--r-- | gtk/rpc_stat.c | 57 | ||||
-rw-r--r-- | gtk/rpc_stat.h | 4 | ||||
-rw-r--r-- | gtk2/main.c | 15 | ||||
-rw-r--r-- | gtk2/rpc_stat.c | 57 | ||||
-rw-r--r-- | gtk2/rpc_stat.h | 4 | ||||
-rw-r--r-- | tap-rpcstat.c | 12 | ||||
-rw-r--r-- | tethereal.c | 6 |
9 files changed, 147 insertions, 44 deletions
diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index 2fa0351790..f4e0f646c1 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -272,13 +272,18 @@ Get B<Ethereal> to collect various types of statistics and display the result in a window that updates in semi-real time. Currently implemented statistics are: -B<-z> rpc,rtt,I<program>,I<version> +B<-z> rpc,rtt,I<program>,I<version>[,<filter>] Collect call/reply RTT data for I<program>/I<version>. Data collected is number of calls for each procedure, MinRTT, MaxRTT and AvgRTT. Example: use B<-z rpc,rtt,100003,3> to collect data for NFS v3. This option can be used multiple times on the command line. +If the optional filter string is provided, the stats will only be calculated +on those calls that match that filter. +Example: use B<-z rpc,rtt,100003,3,nfs.fh.hash==0x12345678> to collect NFS v3 +RTT statistics for a specific file. + B<-z> rpc,programs Collect call/reply RTT data for all known ONC-RPC programs/versions. @@ -541,7 +546,19 @@ and display B<Procedure>, B<Number of Calls>, B<Minimum RTT>, B<Maximum RTT> and These windows opened will update in semi-real time to reflect changes when doing live captures or when reading new capture files into B<Ethereal>. -This feature is only availabe for the Gtk2 version of B<Ethereal>. +This dialog will also allow an optional filter string to be used. +If an optional filter string is used only such ONC-RPC request/response pairs +that match that filter will be used to calculate the statistics. If no filter +string is specified all request/response pairs will be used. + +Before the statistics are recalculated you must reread the capture file or start a new capture. You can also regenerate the statistics by just applying an empty display filter causing ethereal to reread the packet list. + +=item Tools:Statistics:ONC-RPC:Programs + +This dialog will open a window showing aggregated RTT statistics for all +ONC-RPC Programs/versions that exist in the capture file. + +Before the statistics are recalculated you must reread the capture file or start a new capture. You can also regenerate the statistics by just applying an empty display filter causing ethereal to reread the packet list. =head2 WINDOWS diff --git a/gtk/main.c b/gtk/main.c index 05ae377df0..763058f306 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.264 2002/09/23 19:09:49 oabad Exp $ + * $Id: main.c,v 1.265 2002/09/27 11:07:10 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1643,17 +1643,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/gtk/rpc_stat.c b/gtk/rpc_stat.c index 3acb07a634..789202c65c 100644 --- a/gtk/rpc_stat.c +++ b/gtk/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 10:02:32 sahlberg Exp $ + * $Id: rpc_stat.c,v 1.2 2002/09/27 11:07:10 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,24 +381,20 @@ 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); -} - - @@ -398,10 +402,25 @@ 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) { int vers=(int)key; @@ -535,6 +554,22 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_) 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"); gtk_signal_connect_object(GTK_OBJECT(start_button), "clicked", diff --git a/gtk/rpc_stat.h b/gtk/rpc_stat.h index 06e9ac4275..529d6f7c1c 100644 --- a/gtk/rpc_stat.h +++ b/gtk/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 10:02:32 sahlberg Exp $ + * $Id: rpc_stat.h,v 1.2 2002/09/27 11:07:10 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 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 diff --git a/tap-rpcstat.c b/tap-rpcstat.c index fd54089f29..373afbe090 100644 --- a/tap-rpcstat.c +++ b/tap-rpcstat.c @@ -1,7 +1,7 @@ /* tap-rpcstat.c * rpcstat 2002 Ronnie Sahlberg * - * $Id: tap-rpcstat.c,v 1.2 2002/09/26 01:13:02 sahlberg Exp $ + * $Id: tap-rpcstat.c,v 1.3 2002/09/27 11:06:59 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -57,6 +57,7 @@ typedef struct _rpc_procedure_t { /* used to keep track of the statistics for an entire program interface */ typedef struct _rpcstat_t { char *prog; + char *filter; guint32 program; guint32 version; guint32 num_procedures; @@ -211,6 +212,7 @@ rpcstat_draw(rpcstat_t *rs) printf("\n"); printf("===================================================================\n"); printf("%s Version %d RTT Statistics:\n", rs->prog, rs->version); + printf("Filter: %s\n",rs->filter?rs->filter:""); printf("Procedure Calls Min RTT Max RTT Avg RTT\n"); for(i=0;i<rs->num_procedures;i++){ /* scale it to units of 10us.*/ @@ -282,7 +284,12 @@ rpcstat_init(guint32 program, guint32 version, char *filter) rs->prog=rpc_prog_name(program); rs->program=program; rs->version=version; - + if(filter){ + rs->filter=g_malloc(strlen(filter)+1); + strcpy(rs->filter, filter); + } else { + rs->filter=NULL; + } rpc_program=program; rpc_version=version; rpc_min_proc=-1; @@ -321,6 +328,7 @@ rpcstat_init(guint32 program, guint32 version, char *filter) if(register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw)){ /* error, we failed to attach to the tap. clean up */ g_free(rs->procedures); + g_free(rs->filter); g_free(rs); fprintf(stderr,"tethereal: rpcstat_init() failed to attach to tap.\n"); diff --git a/tethereal.c b/tethereal.c index 4e64b96344..a7060bf94a 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.158 2002/09/26 01:13:02 sahlberg Exp $ + * $Id: tethereal.c,v 1.159 2002/09/27 11:06:59 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -642,14 +642,14 @@ main(int argc, char *argv[]) rpcstat_init(rpcprogram,rpcversion,NULL); } } else { - fprintf(stderr, "tethereal: invalid \"-z rpc,rtt,<program>,<version>[,<filterstring>]\" argument\n"); + fprintf(stderr, "tethereal: invalid \"-z rpc,rtt,<program>,<version>[,<filter>]\" argument\n"); exit(1); } } else if(!strncmp(optarg,"rpc,programs",12)){ rpcprogs_init(); } else { fprintf(stderr, "tethereal: 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); } |