name change
[obnox/wireshark/wip.git] / gtk / rpc_stat.c
index 6ff5750fe256271800741ff17a8ad0624358b5fd..42c57c7fc3032d95e2d0f749786afe0b8ef740c5 100644 (file)
@@ -3,8 +3,8 @@
  *
  * $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"
@@ -55,7 +58,7 @@
 typedef struct _rpcstat_t {
        GtkWidget *win;
        srt_stat_table srt_table;
-       char *prog;
+       const char *prog;
        guint32 program;
        guint32 version;
        guint32 num_procedures;
@@ -82,16 +85,21 @@ rpcstat_set_title(rpcstat_t *rs)
 }
 
 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;
@@ -123,8 +131,10 @@ rpcstat_packet(rpcstat_t *rs, packet_info *pinfo, epan_dissect_t *edt _U_, rpc_c
 }
 
 static void
-rpcstat_draw(rpcstat_t *rs)
+rpcstat_draw(void *arg)
 {
+       rpcstat_t *rs = arg;
+
        draw_srt_table_data(&rs->srt_table);
 }
 
@@ -190,8 +200,6 @@ rpcstat_find_vers(gpointer *key, gpointer *value _U_, gpointer *user_data _U_)
  *
  * 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)
 {
@@ -208,7 +216,7 @@ 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;
@@ -217,10 +225,10 @@ gtk_rpcstat_init(char *optarg)
        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;
@@ -254,7 +262,7 @@ gtk_rpcstat_init(char *optarg)
        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);
@@ -278,7 +286,7 @@ gtk_rpcstat_init(char *optarg)
        }
 
 
-       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);
@@ -292,15 +300,15 @@ gtk_rpcstat_init(char *optarg)
        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);
 }
 
 
@@ -316,16 +324,16 @@ static void
 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);
 }
 
@@ -409,7 +417,8 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
        static construct_args_t args = {
          "Service Response Time Statistics Filter",
          TRUE,
-         FALSE
+         FALSE,
+      FALSE
        };
 
        /* if the window is already open, bring it to front */
@@ -529,9 +538,8 @@ gtk_rpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
 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);
 }
-