aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/rpc_stat.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-11-06 10:53:36 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-11-06 10:53:36 +0000
commitb3e0a56390fdce140228692d9ad3389bfa71c876 (patch)
tree15aec5df6848a3bc189cae2e8a4ef9fc354f49f0 /gtk/rpc_stat.c
parentd4e632c5ea3e69eeb958582246ec185fb7832efc (diff)
First step in creating an API to register TAPs for use with ethereal instead of hardcoding them in main.c/menu.c
This adds functions to register the command line arguments to use the API in the same way as is done for tethereal. Later it may be extended to also register the GUI/Menu entry point to ethereal using this api but that iwll be later since the changes required to menu.c are not as intrusive as the main.c command line parsing ones were. Some of the latest changes (before this checkin) has made ethereal to produce lots of GTK errors when starting up the extension windows. They were there before this checking but will be investigated. svn path=/trunk/; revision=6566
Diffstat (limited to 'gtk/rpc_stat.c')
-rw-r--r--gtk/rpc_stat.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/gtk/rpc_stat.c b/gtk/rpc_stat.c
index 5b756a0245..b91ea14c13 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.4 2002/10/23 23:17:11 guy Exp $
+ * $Id: rpc_stat.c,v 1.5 2002/11/06 10:53:36 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -36,6 +36,7 @@
#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"
@@ -268,8 +269,8 @@ 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, char *filter)
+static void
+gtk_rpcstat_init(char *optarg)
{
rpcstat_t *rs;
guint32 i;
@@ -279,6 +280,20 @@ gtk_rpcstat_init(guint32 program, guint32 version, char *filter)
GtkWidget *stat_label;
GtkWidget *filter_label;
GtkWidget *tmp;
+ int program, version, pos;
+ char *filter=NULL;
+
+ pos=0;
+ if(sscanf(optarg,"rpc,rtt,%d,%d,%n",&program,&version,&pos)==2){
+ if(pos){
+ filter=optarg+pos;
+ } else {
+ filter=NULL;
+ }
+ } else {
+ fprintf(stderr, "ethereal: invalid \"-z rpc,rtt,<program>,<version>[,<filter>]\" argument\n");
+ exit(1);
+ }
rpc_program=program;
rpc_version=version;
@@ -412,12 +427,16 @@ static void
rpcstat_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){
- filter=NULL;
+ sprintf(str, "rpc,rtt,%d,%d", rpc_program, rpc_version);
+ filter="";
+ } else {
+ sprintf(str, "rpc,rtt,%d,%d,%s", rpc_program, rpc_version, filter);
}
- gtk_rpcstat_init(rpc_program, rpc_version, filter);
+ gtk_rpcstat_init(str);
}
@@ -583,3 +602,8 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
}
+void
+register_tap_listener_gtkrpcstat(void)
+{
+ register_ethereal_tap("rpc,rtt,", gtk_rpcstat_init, NULL, NULL);
+}