*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
#include <epan/packet_info.h>
#include <epan/epan.h>
-#include "tap_menu.h"
+#include <epan/stat_cmd_args.h>
+#include "stat_menu.h"
+#include "gui_stat_menu.h"
#include "simple_dialog.h"
-#include "ui_util.h"
+#include "gui_utils.h"
#include "dlg_utils.h"
-#include "tap.h"
-#include "../register.h"
+#include <epan/tap.h>
+#include "register.h"
#include <epan/dissectors/packet-rpc.h>
-#include "../globals.h"
-#include "filter_prefs.h"
+#include "main.h"
+#include "globals.h"
+#include "filter_dlg.h"
#include "compat_macros.h"
#include "service_response_time_table.h"
#include "gtkglobals.h"
typedef struct _rpcstat_t {
GtkWidget *win;
srt_stat_table srt_table;
- char *prog;
+ const char *prog;
guint32 program;
guint32 version;
guint32 num_procedures;
}
static void
-rpcstat_reset(rpcstat_t *rs)
+rpcstat_reset(void *arg)
{
+ rpcstat_t *rs = arg;
+
reset_srt_table_data(&rs->srt_table);
rpcstat_set_title(rs);
}
static int
-rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_call_info_value *ri)
+rpcstat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2)
{
+ rpcstat_t *rs = arg;
+ const rpc_call_info_value *ri = arg2;
+
/* we are only interested in reply packets */
if(ri->request){
return 0;
}
static void
-rpcstat_draw(rpcstat_t *rs)
+rpcstat_draw(void *arg)
{
+ rpcstat_t *rs = arg;
+
draw_srt_table_data(&rs->srt_table);
}
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
/* When called, this function will create a new instance of gtk2-rpcstat.
*/
static void
-gtk_rpcstat_init(char *optarg)
+gtk_rpcstat_init(const char *optarg, void* userdata _U_)
{
rpcstat_t *rs;
guint32 i;
GtkWidget *vbox;
GtkWidget *stat_label;
GtkWidget *filter_label;
- GtkWidget *bbox;
- GtkWidget *close_bt;
+ GtkWidget *bbox;
+ GtkWidget *close_bt;
int program, version, pos;
- char *filter=NULL;
+ const char *filter=NULL;
GString *error_string;
int hf_index;
header_field_info *hfi;
gtk_container_add(GTK_CONTAINER(rs->win), vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
- title_string = rpcstat_gen_title(rs);
+ title_string = rpcstat_gen_title(rs);
stat_label=gtk_label_new(title_string);
g_free(title_string);
gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0);
}
- error_string=register_tap_listener("rpc", rs, filter, (void*)rpcstat_reset, (void*)rpcstat_packet, (void*)rpcstat_draw);
+ error_string=register_tap_listener("rpc", rs, filter, rpcstat_reset, rpcstat_packet, rpcstat_draw);
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
g_string_free(error_string, TRUE);
gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE);
- window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb);
+ window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb);
- SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL);
+ SIGNAL_CONNECT(rs->win, "delete_event", window_delete_event_cb, NULL);
SIGNAL_CONNECT(rs->win, "destroy", win_destroy_cb, rs);
- gtk_widget_show_all(rs->win);
- window_present(rs->win);
+ gtk_widget_show_all(rs->win);
+ window_present(rs->win);
- retap_packets(&cfile);
+ cf_retap_packets(&cfile, FALSE);
}
rpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
{
GString *str;
- char *filter;
+ const char *filter;
str = g_string_new("rpc,srt");
g_string_sprintfa(str, ",%d,%d", rpc_program, rpc_version);
- filter=(char *)gtk_entry_get_text(GTK_ENTRY(filter_entry));
+ filter=gtk_entry_get_text(GTK_ENTRY(filter_entry));
if(filter[0]!=0){
g_string_sprintfa(str, ",%s", filter);
}
- gtk_rpcstat_init(str->str);
+ gtk_rpcstat_init(str->str,NULL);
g_string_free(str, TRUE);
}
static construct_args_t args = {
"Service Response Time Statistics Filter",
TRUE,
- FALSE
+ FALSE,
+ FALSE
};
/* if the window is already open, bring it to front */
void
register_tap_listener_gtkrpcstat(void)
{
- register_ethereal_tap("rpc,srt,", gtk_rpcstat_init);
+ register_stat_cmd_arg("rpc,srt,", gtk_rpcstat_init, NULL);
- register_tap_menu_item("ONC-RPC...", REGISTER_TAP_GROUP_RESPONSE_TIME,
+ register_stat_menu_item("ONC-RPC...", REGISTER_STAT_GROUP_RESPONSE_TIME,
gtk_rpcstat_cb, NULL, NULL, NULL);
}
-