2002-10-25 01:08:49 +00:00
|
|
|
/* dcerpc_stat.c
|
|
|
|
* dcerpc_stat 2002 Ronnie Sahlberg
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-10-25 01:08:49 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2008-08-05 17:33:14 +00:00
|
|
|
*
|
2002-10-25 01:08:49 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-08-05 17:33:14 +00:00
|
|
|
*
|
2002-10-25 01:08:49 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2008-08-05 17:33:14 +00:00
|
|
|
*
|
2002-10-25 01:08:49 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-10-25 01:08:49 +00:00
|
|
|
*/
|
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
/* This module provides rpc call/reply SRT statistics to Wireshark,
|
2003-04-23 08:20:06 +00:00
|
|
|
* and displays them graphically.
|
2006-05-31 17:38:42 +00:00
|
|
|
* It is only used by Wireshark and not tshark
|
2002-10-25 01:08:49 +00:00
|
|
|
*
|
|
|
|
* It serves as an example on how to use the tap api.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2013-11-10 15:59:37 +00:00
|
|
|
#include <stdlib.h>
|
2003-12-13 22:23:18 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2004-02-13 00:53:37 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include <epan/packet_info.h>
|
2014-11-14 18:51:40 +00:00
|
|
|
#include <epan/stat_tap_ui.h>
|
2004-09-29 00:06:36 +00:00
|
|
|
#include <epan/tap.h>
|
2004-07-18 18:06:47 +00:00
|
|
|
#include <epan/dissectors/packet-dcerpc.h>
|
2008-04-13 01:54:20 +00:00
|
|
|
|
2012-01-16 01:07:52 +00:00
|
|
|
|
|
|
|
#include "ui/simple_dialog.h"
|
2008-04-13 01:54:20 +00:00
|
|
|
|
2015-01-26 07:45:36 +00:00
|
|
|
#include "ui/gtk/gui_stat_menu.h"
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/dlg_utils.h"
|
|
|
|
#include "ui/gtk/gui_utils.h"
|
|
|
|
#include "ui/gtk/filter_dlg.h"
|
|
|
|
#include "ui/gtk/stock_icons.h"
|
|
|
|
#include "ui/gtk/service_response_time_table.h"
|
|
|
|
#include "ui/gtk/gtkglobals.h"
|
|
|
|
#include "ui/gtk/main.h"
|
|
|
|
#include "ui/gtk/filter_autocomplete.h"
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2011-07-21 20:12:08 +00:00
|
|
|
|
2014-01-17 19:35:57 +00:00
|
|
|
void register_tap_listener_gtkdcerpcstat(void);
|
|
|
|
|
2002-10-25 01:08:49 +00:00
|
|
|
/* used to keep track of the statistics for an entire program interface */
|
2010-07-13 13:51:25 +00:00
|
|
|
typedef struct _dcerpcstat_t {
|
2002-10-25 01:08:49 +00:00
|
|
|
GtkWidget *win;
|
2003-06-21 01:42:46 +00:00
|
|
|
srt_stat_table srt_table;
|
2005-07-24 19:01:28 +00:00
|
|
|
const char *prog;
|
2015-03-03 10:47:53 +00:00
|
|
|
e_guid_t uuid;
|
2002-10-25 01:08:49 +00:00
|
|
|
guint16 ver;
|
2003-06-21 01:42:46 +00:00
|
|
|
int num_procedures;
|
2010-07-13 13:51:25 +00:00
|
|
|
} dcerpcstat_t;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
static gboolean
|
2015-03-03 10:47:53 +00:00
|
|
|
uuid_equal(e_guid_t *uuid1, e_guid_t *uuid2)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2015-03-03 10:47:53 +00:00
|
|
|
if( (uuid1->data1 != uuid2->data1)
|
|
|
|
||(uuid1->data2 != uuid2->data2)
|
|
|
|
||(uuid1->data3 != uuid2->data3)
|
|
|
|
||(uuid1->data4[0] != uuid2->data4[0])
|
|
|
|
||(uuid1->data4[1] != uuid2->data4[1])
|
|
|
|
||(uuid1->data4[2] != uuid2->data4[2])
|
|
|
|
||(uuid1->data4[3] != uuid2->data4[3])
|
|
|
|
||(uuid1->data4[4] != uuid2->data4[4])
|
|
|
|
||(uuid1->data4[5] != uuid2->data4[5])
|
|
|
|
||(uuid1->data4[6] != uuid2->data4[6])
|
|
|
|
||(uuid1->data4[7] != uuid2->data4[7]) ){
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
2010-07-13 13:51:25 +00:00
|
|
|
return TRUE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
2003-09-26 02:09:44 +00:00
|
|
|
|
2003-10-10 11:24:24 +00:00
|
|
|
static char *
|
2010-07-13 13:51:25 +00:00
|
|
|
dcerpcstat_gen_title(dcerpcstat_t *rs)
|
2003-10-10 11:24:24 +00:00
|
|
|
{
|
|
|
|
char *title;
|
2012-06-03 22:03:05 +00:00
|
|
|
char *display_name;
|
2003-10-10 11:24:24 +00:00
|
|
|
|
2012-06-03 22:03:05 +00:00
|
|
|
display_name = cf_get_display_name(&cfile);
|
|
|
|
title = g_strdup_printf("DCE-RPC Service Response Time statistics for %s major version %u: %s", rs->prog, rs->ver, display_name);
|
|
|
|
g_free(display_name);
|
2003-10-10 11:24:24 +00:00
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2003-09-26 02:09:44 +00:00
|
|
|
static void
|
2010-07-13 13:51:25 +00:00
|
|
|
dcerpcstat_set_title(dcerpcstat_t *rs)
|
2003-09-26 02:09:44 +00:00
|
|
|
{
|
|
|
|
char *title;
|
|
|
|
|
2003-10-10 11:24:24 +00:00
|
|
|
title = dcerpcstat_gen_title(rs);
|
2003-09-26 02:09:44 +00:00
|
|
|
gtk_window_set_title(GTK_WINDOW(rs->win), title);
|
|
|
|
g_free(title);
|
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
static void
|
2004-01-19 23:00:12 +00:00
|
|
|
dcerpcstat_reset(void *rs_arg)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2013-03-21 02:58:59 +00:00
|
|
|
dcerpcstat_t *rs = (dcerpcstat_t *)rs_arg;
|
2004-01-19 23:00:12 +00:00
|
|
|
|
2003-06-21 01:42:46 +00:00
|
|
|
reset_srt_table_data(&rs->srt_table);
|
2003-09-26 02:09:44 +00:00
|
|
|
dcerpcstat_set_title(rs);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
static gboolean
|
2005-01-01 02:57:02 +00:00
|
|
|
dcerpcstat_packet(void *rs_arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *ri_arg)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2013-03-21 02:58:59 +00:00
|
|
|
dcerpcstat_t *rs = (dcerpcstat_t *)rs_arg;
|
|
|
|
const dcerpc_info *ri = (dcerpc_info *)ri_arg;
|
2004-01-19 23:00:12 +00:00
|
|
|
|
2002-10-25 01:08:49 +00:00
|
|
|
if(!ri->call_data){
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
if(!ri->call_data->req_frame){
|
2010-07-20 14:34:00 +00:00
|
|
|
/* we have not seen the request so we don't know the delta*/
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
if(ri->call_data->opnum >= rs->num_procedures){
|
2013-02-25 23:35:13 +00:00
|
|
|
/* don't handle this since it's outside of known table */
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we are only interested in reply packets */
|
2004-05-07 11:25:15 +00:00
|
|
|
if(ri->ptype != PDU_RESP){
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we are only interested in certain program/versions */
|
|
|
|
if( (!uuid_equal( (&ri->call_data->uuid), (&rs->uuid)))
|
2010-07-20 14:34:00 +00:00
|
|
|
||(ri->call_data->ver != rs->ver)){
|
2010-07-13 13:51:25 +00:00
|
|
|
return FALSE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-21 01:42:46 +00:00
|
|
|
add_srt_table_data(&rs->srt_table, ri->call_data->opnum, &ri->call_data->req_time, pinfo);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
return TRUE;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-01-19 23:00:12 +00:00
|
|
|
dcerpcstat_draw(void *rs_arg)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2013-03-21 02:58:59 +00:00
|
|
|
dcerpcstat_t *rs = (dcerpcstat_t *)rs_arg;
|
2004-01-19 23:00:12 +00:00
|
|
|
|
2003-06-21 01:42:46 +00:00
|
|
|
draw_srt_table_data(&rs->srt_table);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
win_destroy_cb(GtkWindow *win _U_, gpointer data)
|
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpcstat_t *rs = (dcerpcstat_t *)data;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
remove_tap_listener(rs);
|
|
|
|
|
2003-06-21 01:42:46 +00:00
|
|
|
free_srt_table_data(&rs->srt_table);
|
2002-10-25 01:08:49 +00:00
|
|
|
g_free(rs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* When called, this function will create a new instance of gtk-dcerpcstat.
|
|
|
|
*/
|
2002-11-06 10:53:36 +00:00
|
|
|
static void
|
2012-12-05 15:56:36 +00:00
|
|
|
gtk_dcerpcstat_init(const char *opt_arg, void* userdata _U_)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-13 13:51:25 +00:00
|
|
|
dcerpcstat_t *rs;
|
2002-10-25 01:08:49 +00:00
|
|
|
guint32 i, max_procs;
|
2003-10-10 11:24:24 +00:00
|
|
|
char *title_string;
|
2007-11-28 03:04:09 +00:00
|
|
|
char *filter_string;
|
2002-10-25 01:08:49 +00:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *stat_label;
|
|
|
|
GtkWidget *filter_label;
|
2005-07-24 19:01:28 +00:00
|
|
|
GtkWidget *bbox;
|
|
|
|
GtkWidget *close_bt;
|
2002-10-25 01:08:49 +00:00
|
|
|
dcerpc_sub_dissector *procs;
|
2015-03-03 10:47:53 +00:00
|
|
|
e_guid_t uuid;
|
2004-01-19 18:23:01 +00:00
|
|
|
guint d1,d2,d3,d40,d41,d42,d43,d44,d45,d46,d47;
|
2002-11-06 10:53:36 +00:00
|
|
|
int major, minor;
|
2003-12-15 20:15:03 +00:00
|
|
|
guint16 ver;
|
2010-07-20 14:34:00 +00:00
|
|
|
int pos = 0;
|
|
|
|
const char *filter = NULL;
|
2010-07-13 13:51:25 +00:00
|
|
|
GString *error_string;
|
2003-10-10 11:11:37 +00:00
|
|
|
int hf_opnum;
|
2002-11-06 10:53:36 +00:00
|
|
|
|
2004-01-19 23:43:29 +00:00
|
|
|
/*
|
|
|
|
* XXX - DCE RPC statistics are maintained only by major version,
|
|
|
|
* not by major and minor version, so the minor version number is
|
|
|
|
* ignored.
|
|
|
|
*
|
|
|
|
* Should we just stop supporting minor version numbers here?
|
|
|
|
* Or should we allow it to be omitted? Or should we keep
|
|
|
|
* separate statistics for different minor version numbers,
|
|
|
|
* and allow the minor version number to be omitted, and
|
|
|
|
* report aggregate statistics for all minor version numbers
|
|
|
|
* if it's omitted?
|
|
|
|
*/
|
2010-07-20 14:34:00 +00:00
|
|
|
if(sscanf(
|
2012-12-05 15:56:36 +00:00
|
|
|
opt_arg,
|
2010-07-20 14:34:00 +00:00
|
|
|
"dcerpc,srt,%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d,%n",
|
|
|
|
&d1,&d2,&d3,&d40,&d41,&d42,&d43,&d44,&d45,&d46,&d47,&major,&minor,&pos)
|
|
|
|
== 13) {
|
2015-03-03 10:47:53 +00:00
|
|
|
uuid.data1 = d1;
|
|
|
|
uuid.data2 = d2;
|
|
|
|
uuid.data3 = d3;
|
|
|
|
uuid.data4[0] = d40;
|
|
|
|
uuid.data4[1] = d41;
|
|
|
|
uuid.data4[2] = d42;
|
|
|
|
uuid.data4[3] = d43;
|
|
|
|
uuid.data4[4] = d44;
|
|
|
|
uuid.data4[5] = d45;
|
|
|
|
uuid.data4[6] = d46;
|
|
|
|
uuid.data4[7] = d47;
|
2010-07-20 14:34:00 +00:00
|
|
|
if(pos) {
|
2012-12-05 15:56:36 +00:00
|
|
|
filter = opt_arg+pos;
|
2002-11-06 10:53:36 +00:00
|
|
|
} else {
|
2010-07-20 14:34:00 +00:00
|
|
|
filter = NULL;
|
2002-11-06 10:53:36 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-05-28 17:19:08 +00:00
|
|
|
fprintf(stderr, "wireshark: invalid \"-z dcerpc,srt,<uuid>,<major version>.<minor version>[,<filter>]\" argument\n");
|
2002-11-06 10:53:36 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
if ((major < 0) || (major > 65535)) {
|
2006-05-28 17:19:08 +00:00
|
|
|
fprintf(stderr,"wireshark: dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535\n", major);
|
2003-12-15 20:15:03 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
if ((minor < 0) || (minor > 65535)) {
|
2006-05-28 17:19:08 +00:00
|
|
|
fprintf(stderr,"wireshark: dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535\n", minor);
|
2003-12-15 20:15:03 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2004-01-19 23:43:29 +00:00
|
|
|
ver = major;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
rs = (dcerpcstat_t *)g_malloc(sizeof(dcerpcstat_t));
|
2010-07-20 14:34:00 +00:00
|
|
|
rs->prog = dcerpc_get_proto_name(&uuid, ver);
|
2002-10-25 01:08:49 +00:00
|
|
|
if(!rs->prog){
|
|
|
|
g_free(rs);
|
2010-07-20 14:34:00 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"wireshark: dcerpcstat_init() Protocol with uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x v%u not supported\n",
|
2015-03-03 10:47:53 +00:00
|
|
|
uuid.data1,uuid.data2,uuid.data3,uuid.data4[0],uuid.data4[1],uuid.data4[2],uuid.data4[3],uuid.data4[4],uuid.data4[5],uuid.data4[6],uuid.data4[7],ver);
|
2002-10-25 01:08:49 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
hf_opnum = dcerpc_get_proto_hf_opnum(&uuid, ver);
|
|
|
|
procs = dcerpc_get_proto_sub_dissector(&uuid, ver);
|
|
|
|
rs->uuid = uuid;
|
|
|
|
rs->ver = ver;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
rs->win = dlg_window_new("dcerpc-stat"); /* transient_for top_level */
|
|
|
|
gtk_window_set_destroy_with_parent(GTK_WINDOW(rs->win), TRUE);
|
2009-06-21 20:42:07 +00:00
|
|
|
|
2003-09-26 02:09:44 +00:00
|
|
|
dcerpcstat_set_title(rs);
|
Add a "Sum" column to the Service Response Time (SRT) window.
The Service Response Time (SRT) window currently provides the
columns: Index, Procedure, Calls, Min SRT, Max SRT, and Avg SRT.
A Sum column has been found useful in some customer situations
to understand the total time spent doing a set of procedures.
For example, in one case we were trying to isolate whether most
time was being spent on a client thread or in the act of making
outbound calls. We knew the start and end time of the client call,
so with the "Sum" of time spent in that period, we could isolate
a particular set of procedures driving the slow down.
Additional changes made in this patch:
* Add " (s)" to Min, Max, Avg, and Sum columns to make it clear
that times are in seconds.
* Refactor out width and height constants used in calls to
gtk_window_set_default_size in most of the SRT users into
#define SRT_PREFERRED_WIDTH and SRT_PREFERRED_HEIGHT. Also
increase the common width of 550 to 650 to account for the
additional column.
Change-Id: I20f152eecbcd0bbf69f71c6c6b9f9463e8867e23
Reviewed-on: https://code.wireshark.org/review/7047
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-10 01:20:38 +00:00
|
|
|
gtk_window_set_default_size(GTK_WINDOW(rs->win), SRT_PREFERRED_WIDTH, SRT_PREFERRED_HEIGHT);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2012-04-21 16:40:14 +00:00
|
|
|
vbox =ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE);
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(rs->win), vbox);
|
2004-04-12 08:53:02 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
title_string = dcerpcstat_gen_title(rs);
|
|
|
|
stat_label = gtk_label_new(title_string);
|
2003-10-10 11:24:24 +00:00
|
|
|
g_free(title_string);
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0);
|
|
|
|
|
2007-11-28 03:04:09 +00:00
|
|
|
filter_string = g_strdup_printf("Filter: %s",filter ? filter : "");
|
2010-07-20 14:34:00 +00:00
|
|
|
filter_label = gtk_label_new(filter_string);
|
2007-11-28 03:04:09 +00:00
|
|
|
g_free(filter_string);
|
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(filter_label), TRUE);
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
for(i=0,max_procs=0;procs[i].name;i++){
|
|
|
|
if(procs[i].num>max_procs){
|
2010-07-20 14:34:00 +00:00
|
|
|
max_procs = procs[i].num;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
rs->num_procedures = max_procs+1;
|
2003-06-22 04:00:21 +00:00
|
|
|
|
|
|
|
/* We must display TOP LEVEL Widget before calling init_srt_table() */
|
2004-04-12 08:53:02 +00:00
|
|
|
gtk_widget_show_all(rs->win);
|
2003-06-22 04:00:21 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
if(hf_opnum != -1){
|
2003-10-10 11:11:37 +00:00
|
|
|
init_srt_table(&rs->srt_table, max_procs+1, vbox, proto_registrar_get_nth(hf_opnum)->abbrev);
|
|
|
|
} else {
|
|
|
|
init_srt_table(&rs->srt_table, max_procs+1, vbox, NULL);
|
|
|
|
}
|
2003-06-21 01:42:46 +00:00
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
for(i=0;i<(max_procs+1);i++){
|
2002-10-25 01:08:49 +00:00
|
|
|
int j;
|
2005-07-24 19:01:28 +00:00
|
|
|
const char *proc_name;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
proc_name = "unknown";
|
2002-10-25 01:08:49 +00:00
|
|
|
for(j=0;procs[j].name;j++){
|
2010-07-20 14:34:00 +00:00
|
|
|
if (procs[j].num == i){
|
|
|
|
proc_name = procs[j].name;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-21 01:42:46 +00:00
|
|
|
init_srt_table_row(&rs->srt_table, i, proc_name);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
error_string = register_tap_listener("dcerpc", rs, filter, 0, dcerpcstat_reset, dcerpcstat_packet, dcerpcstat_draw);
|
2003-04-23 08:20:06 +00:00
|
|
|
if(error_string){
|
2002-10-25 01:08:49 +00:00
|
|
|
/* error, we failed to attach to the tap. clean up */
|
2008-10-31 09:53:56 +00:00
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
|
2003-04-23 08:20:06 +00:00
|
|
|
g_string_free(error_string, TRUE);
|
2003-06-21 01:42:46 +00:00
|
|
|
free_srt_table_data(&rs->srt_table);
|
2002-10-25 01:08:49 +00:00
|
|
|
g_free(rs);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-04-12 08:53:02 +00:00
|
|
|
/* Button row. */
|
|
|
|
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
|
|
|
|
gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
close_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
|
2005-08-06 03:44:55 +00:00
|
|
|
window_set_cancel_button(rs->win, close_bt, window_cancel_button_cb);
|
2004-05-23 23:24:07 +00:00
|
|
|
|
2008-04-11 21:20:51 +00:00
|
|
|
g_signal_connect(rs->win, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
2010-07-20 14:34:00 +00:00
|
|
|
g_signal_connect(rs->win, "destroy", G_CALLBACK(win_destroy_cb), rs);
|
2004-04-12 08:53:02 +00:00
|
|
|
|
2005-08-06 03:44:55 +00:00
|
|
|
gtk_widget_show_all(rs->win);
|
|
|
|
window_present(rs->win);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2009-06-05 22:42:47 +00:00
|
|
|
cf_retap_packets(&cfile);
|
2011-07-21 20:12:08 +00:00
|
|
|
gdk_window_raise(gtk_widget_get_window(rs->win));
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 10:47:53 +00:00
|
|
|
static e_guid_t *dcerpc_uuid_program;
|
2010-07-20 14:34:00 +00:00
|
|
|
static guint16 dcerpc_version;
|
|
|
|
static GtkWidget *dlg = NULL;
|
|
|
|
static GtkWidget *filter_entry;
|
|
|
|
static dcerpc_uuid_key *current_uuid_key;
|
|
|
|
static dcerpc_uuid_value *current_uuid_value;
|
|
|
|
static dcerpc_uuid_key *new_uuid_key;
|
|
|
|
static dcerpc_uuid_value *new_uuid_value;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dcerpcstat_start_button_clicked(GtkWidget *item _U_, gpointer data _U_)
|
|
|
|
{
|
2003-09-26 02:09:44 +00:00
|
|
|
GString *str;
|
"gtk_entry_get_text()" returns a "const char *" - assign the result to
one.
"get_basename()" doesn't modify its argument, and its callers don't
modify the substring pointed to by the result, so make it take a "const
char *" as an argument and return a "const char *".
"find_last_pathname_separator()" doesn't modify its argument, so make it
a "const char *" - but some of its callers pass a non-"const" "char *"
and modify the result, so don't make its return value a "const char *".
And, as none of its callers are outside "filesystem.c", make it static.
In "about_folders_page_new()", have separate variables for pathnames
returned as "const char *" (which are cached by the routine that returns
them, so you can't modify them - and can't free them, so get rid of the
commented-out "g_free()" calls for them) and pathnames returned as "char
*" (which are allocated anew for each call, and can be modified, but
have to be freed).
Clean up white space.
svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
|
|
|
const char *filter;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
if (dcerpc_uuid_program == NULL) {
|
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Please select a program");
|
|
|
|
return;
|
|
|
|
}
|
2003-09-26 02:09:44 +00:00
|
|
|
str = g_string_new("dcerpc,srt");
|
2008-05-06 05:50:31 +00:00
|
|
|
g_string_append_printf(str,
|
2003-12-15 20:15:03 +00:00
|
|
|
",%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%u.%u",
|
2015-03-03 10:47:53 +00:00
|
|
|
dcerpc_uuid_program->data1, dcerpc_uuid_program->data2,
|
|
|
|
dcerpc_uuid_program->data3,
|
|
|
|
dcerpc_uuid_program->data4[0], dcerpc_uuid_program->data4[1],
|
|
|
|
dcerpc_uuid_program->data4[2], dcerpc_uuid_program->data4[3],
|
|
|
|
dcerpc_uuid_program->data4[4], dcerpc_uuid_program->data4[5],
|
|
|
|
dcerpc_uuid_program->data4[6], dcerpc_uuid_program->data4[7],
|
2004-01-19 23:43:29 +00:00
|
|
|
dcerpc_version, 0);
|
2010-07-20 14:34:00 +00:00
|
|
|
filter = gtk_entry_get_text(GTK_ENTRY(filter_entry));
|
|
|
|
if(filter[0] != 0){
|
2008-05-06 05:50:31 +00:00
|
|
|
g_string_append_printf(str, ",%s", filter);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
2002-11-06 10:53:36 +00:00
|
|
|
|
2006-02-11 13:05:24 +00:00
|
|
|
gtk_dcerpcstat_init(str->str,NULL);
|
2003-09-26 02:09:44 +00:00
|
|
|
g_string_free(str, TRUE);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpcstat_version_select(GtkWidget *vers_combo_box, gpointer user_data _U_)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_uuid_key *k;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
if (! ws_combo_box_get_active_pointer(GTK_COMBO_BOX(vers_combo_box), (gpointer *)&k)) {
|
2010-07-20 14:34:00 +00:00
|
|
|
g_assert_not_reached(); /* Programming error: somehow no active item */
|
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_version = k->ver;
|
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
static void
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpcstat_find_vers(gpointer *key, gpointer *value _U_, gpointer user_data)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_uuid_key *k = (dcerpc_uuid_key *)key;
|
2013-03-21 02:58:59 +00:00
|
|
|
GtkWidget *vers_combo_box = (GtkWidget *)user_data;
|
2002-10-25 01:08:49 +00:00
|
|
|
char vs[5];
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
if(!uuid_equal(&(k->uuid), dcerpc_uuid_program)){
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
g_snprintf(vs, sizeof(vs), "%u", k->ver);
|
|
|
|
ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(vers_combo_box), vs, k);
|
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
static void
|
|
|
|
dcerpcstat_program_select(GtkWidget *prog_combo_box, gpointer user_data)
|
|
|
|
{
|
|
|
|
dcerpc_uuid_key *k;
|
|
|
|
GtkWidget *vers_combo_box;
|
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
vers_combo_box = (GtkWidget *)user_data;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
if (! ws_combo_box_get_active_pointer(GTK_COMBO_BOX(prog_combo_box), (gpointer *)&k)) {
|
2010-07-20 14:34:00 +00:00
|
|
|
g_assert_not_reached(); /* Programming error: somehow no active item */
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
g_signal_handlers_disconnect_by_func(vers_combo_box, G_CALLBACK(dcerpcstat_version_select), NULL );
|
|
|
|
ws_combo_box_clear_text_and_pointer(GTK_COMBO_BOX(vers_combo_box));
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2012-09-05 01:44:09 +00:00
|
|
|
/* dcerpc_stat: invalid selection... somehow selected top level ?? */
|
|
|
|
g_assert(k != NULL);
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_uuid_program = &(k->uuid);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
/* re-create version menu */
|
|
|
|
g_signal_handlers_disconnect_by_func(vers_combo_box, G_CALLBACK(dcerpcstat_version_select), NULL );
|
|
|
|
ws_combo_box_clear_text_and_pointer(GTK_COMBO_BOX(vers_combo_box));
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
g_hash_table_foreach(dcerpc_uuids, (GHFunc)dcerpcstat_find_vers, vers_combo_box);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
g_signal_connect(vers_combo_box, "changed", G_CALLBACK(dcerpcstat_version_select), NULL);
|
|
|
|
ws_combo_box_set_active(GTK_COMBO_BOX(vers_combo_box), 0); /* default: triggers dcerpcstat_version_select callback */
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
static GtkTreeIter
|
|
|
|
dcerpcstat_add_program_to_menu(dcerpc_uuid_key *k, dcerpc_uuid_value *v, GtkWidget *prog_combo_box, int program_item_index)
|
2003-09-05 00:48:58 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
static GtkTreeIter iter;
|
2003-11-10 07:44:47 +00:00
|
|
|
char str[64];
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
switch(program_item_index%15){
|
2003-11-10 07:44:47 +00:00
|
|
|
case 0:
|
2009-03-19 17:49:11 +00:00
|
|
|
g_snprintf(str,sizeof(str),"%s ...",v->name);
|
2010-07-20 14:34:00 +00:00
|
|
|
iter = ws_combo_box_append_text_and_pointer_full(
|
|
|
|
GTK_COMBO_BOX(prog_combo_box), NULL, str, NULL, FALSE); /* top-level entries are insensitive */
|
2003-11-10 07:44:47 +00:00
|
|
|
break;
|
2003-09-05 00:48:58 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
default:
|
|
|
|
break;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
return ws_combo_box_append_text_and_pointer_full(
|
|
|
|
GTK_COMBO_BOX(prog_combo_box), &iter, v->name, k, TRUE);
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
static void
|
2003-09-05 00:48:58 +00:00
|
|
|
dcerpcstat_find_next_program(gpointer *key, gpointer *value, gpointer *user_data _U_)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_uuid_key *k = (dcerpc_uuid_key *)key;
|
|
|
|
dcerpc_uuid_value *v = (dcerpc_uuid_value *)value;
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2003-09-05 00:48:58 +00:00
|
|
|
/* first time called, just set new_uuid to this one */
|
2010-07-20 14:34:00 +00:00
|
|
|
if((current_uuid_key==NULL) && (new_uuid_key==NULL)){
|
|
|
|
new_uuid_key = k;
|
|
|
|
new_uuid_value = v;
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
/* if we haven't got a current one yet, just check the new
|
2003-09-05 00:48:58 +00:00
|
|
|
and scan for the first one alphabetically */
|
|
|
|
if(current_uuid_key==NULL){
|
|
|
|
if(strcmp(new_uuid_value->name, v->name)>0){
|
2010-07-20 14:34:00 +00:00
|
|
|
new_uuid_key = k;
|
|
|
|
new_uuid_value = v;
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2003-09-05 00:48:58 +00:00
|
|
|
/* searching for the next one we are only interested in those
|
|
|
|
that sorts alphabetically after the current one */
|
2010-07-20 14:34:00 +00:00
|
|
|
if(strcmp(current_uuid_value->name, v->name) >= 0){
|
2013-12-23 15:53:13 +00:00
|
|
|
/* this one doesn't so just skip it */
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* is it the first potential new entry? */
|
|
|
|
if(new_uuid_key==NULL){
|
2010-07-20 14:34:00 +00:00
|
|
|
new_uuid_key = k;
|
|
|
|
new_uuid_value = v;
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* does it sort before the current new one? */
|
2010-07-20 14:34:00 +00:00
|
|
|
if(strcmp(new_uuid_value->name, v->name) > 0){
|
|
|
|
new_uuid_key = k;
|
|
|
|
new_uuid_value = v;
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
return;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2010-08-23 19:29:08 +00:00
|
|
|
dlg_destroy_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
dlg = NULL;
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-22 08:09:09 +00:00
|
|
|
void gtk_dcerpcstat_cb(GtkAction *action _U_, gpointer user_data _U_)
|
2002-10-25 01:08:49 +00:00
|
|
|
{
|
2010-07-20 14:34:00 +00:00
|
|
|
GtkWidget *dlg_box;
|
|
|
|
GtkWidget *prog_box, *prog_label, *prog_combo_box;
|
|
|
|
GtkWidget *vers_label, *vers_combo_box;
|
|
|
|
GtkWidget *filter_box, *filter_bt;
|
|
|
|
GtkWidget *bbox, *start_button, *cancel_button;
|
2015-02-15 18:58:39 +00:00
|
|
|
GtkCellRenderer *cell_renderer;
|
2011-06-07 22:50:49 +00:00
|
|
|
#if 0
|
2010-07-20 14:34:00 +00:00
|
|
|
GtkTreeIter program_first_item_iter;
|
2011-06-07 22:50:49 +00:00
|
|
|
#endif
|
2010-07-20 14:34:00 +00:00
|
|
|
const char *filter;
|
|
|
|
int program_item_index = 0;
|
|
|
|
|
2003-10-27 01:35:53 +00:00
|
|
|
static construct_args_t args = {
|
|
|
|
"Service Response Time Statistics Filter",
|
2004-01-25 18:39:55 +00:00
|
|
|
FALSE,
|
2005-12-31 17:09:27 +00:00
|
|
|
FALSE,
|
2010-07-13 13:51:25 +00:00
|
|
|
FALSE
|
2003-10-27 01:35:53 +00:00
|
|
|
};
|
2003-04-24 23:17:43 +00:00
|
|
|
|
|
|
|
/* if the window is already open, bring it to front and
|
|
|
|
un-minimize it, as necessary */
|
2002-10-25 01:08:49 +00:00
|
|
|
if(dlg){
|
2003-04-24 23:17:43 +00:00
|
|
|
reactivate_window(dlg);
|
2002-10-25 01:08:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
dlg = dlg_window_new("Wireshark: Compute DCE-RPC SRT statistics");
|
2004-05-27 19:59:50 +00:00
|
|
|
gtk_window_set_default_size(GTK_WINDOW(dlg), 400, -1);
|
2003-09-26 02:09:44 +00:00
|
|
|
|
2012-04-21 16:40:14 +00:00
|
|
|
dlg_box = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 10, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(dlg_box), 10);
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(dlg), dlg_box);
|
|
|
|
gtk_widget_show(dlg_box);
|
|
|
|
|
2003-09-26 02:09:44 +00:00
|
|
|
/* Program box */
|
2012-04-21 16:40:14 +00:00
|
|
|
prog_box = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
/* Program label */
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(prog_box), 10);
|
2010-07-20 14:34:00 +00:00
|
|
|
prog_label = gtk_label_new("Program:");
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(prog_box), prog_label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(prog_label);
|
|
|
|
|
|
|
|
/* Program menu */
|
2010-07-20 14:34:00 +00:00
|
|
|
dcerpc_uuid_program = NULL; /* default: no program selected */
|
|
|
|
|
|
|
|
/* The "program combo box" is implemented with a two-level tree.
|
|
|
|
Each top-level of the tree has (up to) 15 selectable "program name"
|
|
|
|
children and shows the name of the first child of that entry
|
|
|
|
as "child_name ...". Each of the top-level entries can be expanded
|
|
|
|
(to show the children) but is "insensitive": ie: cannot be selected.
|
|
|
|
(dcerpcstat_add_program_to_menu() does the actual work to add entries
|
|
|
|
to the combo box).
|
2015-02-15 18:58:39 +00:00
|
|
|
XXX: A simpler alternative might be to just do away with all the two-level
|
|
|
|
complexity and just use a standard ws_combo_box... even though the
|
|
|
|
list of "program names" is quite large.
|
|
|
|
XXX: The gtkrc file distributed with Windows Wireshark has the
|
|
|
|
"appears-as-list" GtkComboBox style property set to 1 and thus
|
|
|
|
on Windows the entries for this combo box will appear as a tree-view.
|
|
|
|
The default is 0(FALSE). In this case the the combo box entries will
|
|
|
|
display as a menu with sub-menus.
|
|
|
|
A possibility would be to set "appears-as-list" to 0 just for this
|
|
|
|
particular combo box on Windows so that the entries will appear as a
|
|
|
|
menu even on Windows).
|
2010-07-20 14:34:00 +00:00
|
|
|
*/
|
|
|
|
prog_combo_box = ws_combo_box_new_text_and_pointer_full(&cell_renderer);
|
|
|
|
{
|
|
|
|
/* XXX: Hack So that the top-level insensitive entries don't show
|
|
|
|
as "grayed out"; The "foreground normal" color is used instead.
|
|
|
|
This may not really be necessary but seems better to me.
|
|
|
|
*/
|
2011-08-18 08:58:29 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
|
|
|
GtkStyleContext *context;
|
|
|
|
GdkRGBA *new_rgba_fg_color;
|
2011-08-18 10:54:55 +00:00
|
|
|
context = gtk_widget_get_style_context (prog_combo_box);
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL,
|
2011-08-18 13:44:27 +00:00
|
|
|
"color", &new_rgba_fg_color,
|
2011-08-18 08:58:29 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_object_set(cell_renderer,
|
|
|
|
"foreground-rgba", &new_rgba_fg_color,
|
|
|
|
"foreground-set", TRUE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
#else
|
2010-07-20 14:34:00 +00:00
|
|
|
GtkStyle *s;
|
|
|
|
s = gtk_widget_get_style(prog_combo_box);
|
2010-08-30 16:10:01 +00:00
|
|
|
g_object_set(cell_renderer,
|
|
|
|
"foreground-gdk", &(s->fg[GTK_STATE_NORMAL]),
|
2010-07-20 14:34:00 +00:00
|
|
|
"foreground-set", TRUE,
|
|
|
|
NULL);
|
2011-08-18 08:58:29 +00:00
|
|
|
#endif
|
2010-07-20 14:34:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
current_uuid_key = NULL;
|
|
|
|
current_uuid_value = NULL;
|
2003-09-05 00:48:58 +00:00
|
|
|
do {
|
2010-07-20 14:34:00 +00:00
|
|
|
new_uuid_key = NULL;
|
|
|
|
new_uuid_value = NULL;
|
2003-09-05 00:48:58 +00:00
|
|
|
g_hash_table_foreach(dcerpc_uuids, (GHFunc)dcerpcstat_find_next_program, NULL);
|
|
|
|
if(new_uuid_key){
|
2011-07-08 07:52:31 +00:00
|
|
|
#if 0
|
2010-07-20 14:34:00 +00:00
|
|
|
GtkTreeIter tmp_iter;
|
|
|
|
tmp_iter = dcerpcstat_add_program_to_menu(new_uuid_key, new_uuid_value,
|
|
|
|
prog_combo_box, program_item_index);
|
|
|
|
if (program_item_index == 0)
|
|
|
|
program_first_item_iter = tmp_iter;
|
2011-07-08 07:52:31 +00:00
|
|
|
#else
|
|
|
|
dcerpcstat_add_program_to_menu(new_uuid_key, new_uuid_value,
|
|
|
|
prog_combo_box, program_item_index);
|
2011-06-07 22:50:49 +00:00
|
|
|
#endif
|
2010-07-20 14:34:00 +00:00
|
|
|
program_item_index += 1;
|
2003-09-05 00:48:58 +00:00
|
|
|
}
|
2010-07-20 14:34:00 +00:00
|
|
|
current_uuid_key = new_uuid_key;
|
|
|
|
current_uuid_value = new_uuid_value;
|
|
|
|
} while(new_uuid_key != NULL);
|
|
|
|
gtk_box_pack_start(GTK_BOX(prog_box), prog_combo_box, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(prog_combo_box);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
/* Version label */
|
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(prog_box), 10);
|
2010-07-20 14:34:00 +00:00
|
|
|
vers_label = gtk_label_new("Version:");
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(prog_box), vers_label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(vers_label);
|
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
/* Version combo-box */
|
|
|
|
/* Note: version combo box rows set when dcerpcstat_program_select() callback invoked */
|
|
|
|
vers_combo_box = ws_combo_box_new_text_and_pointer();
|
|
|
|
gtk_box_pack_start(GTK_BOX(prog_box), vers_combo_box, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(vers_combo_box);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2010-07-20 14:34:00 +00:00
|
|
|
g_signal_connect(prog_combo_box, "changed", G_CALLBACK(dcerpcstat_program_select), vers_combo_box);
|
|
|
|
#if 0 /* Don't select an active entry given the way the drop down treeview appears if a default (active) entry is set */
|
|
|
|
ws_combo_box_set_active_iter(GTK_COMBO_BOX(prog_combo_box), &program_first_item_iter); /* triggers callback */
|
|
|
|
#endif
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(dlg_box), prog_box, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(prog_box);
|
|
|
|
|
2003-09-26 02:09:44 +00:00
|
|
|
/* Filter box */
|
2012-04-21 16:40:14 +00:00
|
|
|
filter_box = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
|
|
|
/* Filter label */
|
2014-02-21 13:09:52 +00:00
|
|
|
filter_bt = ws_gtk_button_new_from_stock(WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY);
|
2008-04-11 21:20:51 +00:00
|
|
|
g_signal_connect(filter_bt, "clicked", G_CALLBACK(display_filter_construct_cb), &args);
|
2003-10-27 01:35:53 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(filter_box), filter_bt, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(filter_bt);
|
|
|
|
|
|
|
|
/* Filter entry */
|
2010-07-20 14:34:00 +00:00
|
|
|
filter_entry = gtk_entry_new();
|
2008-04-11 21:39:16 +00:00
|
|
|
g_signal_connect(filter_entry, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL);
|
2008-10-19 13:40:52 +00:00
|
|
|
g_object_set_data(G_OBJECT(filter_box), E_FILT_AUTOCOMP_PTR_KEY, NULL);
|
|
|
|
g_signal_connect(filter_entry, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL);
|
|
|
|
g_signal_connect(dlg, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL);
|
2003-09-26 02:09:44 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, TRUE, TRUE, 0);
|
2010-07-20 14:34:00 +00:00
|
|
|
filter = gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
|
2003-08-19 10:09:20 +00:00
|
|
|
if(filter){
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
|
2008-10-11 14:32:46 +00:00
|
|
|
} else {
|
|
|
|
colorize_filter_te_as_empty(filter_entry);
|
2003-08-19 10:09:20 +00:00
|
|
|
}
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_widget_show(filter_entry);
|
2008-08-05 17:33:14 +00:00
|
|
|
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(filter_box);
|
|
|
|
|
2008-04-11 16:44:31 +00:00
|
|
|
g_object_set_data(G_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, filter_entry);
|
2004-01-25 18:39:55 +00:00
|
|
|
|
2003-09-26 02:09:44 +00:00
|
|
|
/* button box */
|
2010-07-13 13:51:25 +00:00
|
|
|
bbox = dlg_button_row_new(WIRESHARK_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
|
2003-09-26 02:09:44 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
|
2010-07-13 13:51:25 +00:00
|
|
|
gtk_widget_show(bbox);
|
2003-04-24 23:17:43 +00:00
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
start_button = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_CREATE_STAT);
|
2008-08-05 17:33:14 +00:00
|
|
|
g_signal_connect_swapped(start_button, "clicked",
|
2010-07-13 13:51:25 +00:00
|
|
|
G_CALLBACK(dcerpcstat_start_button_clicked), NULL);
|
2002-10-25 01:08:49 +00:00
|
|
|
|
2013-03-21 02:58:59 +00:00
|
|
|
cancel_button = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
|
2010-07-13 13:51:25 +00:00
|
|
|
window_set_cancel_button(dlg, cancel_button, window_cancel_button_cb);
|
2004-05-23 23:24:07 +00:00
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
g_signal_connect(dlg, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
2010-08-23 19:29:08 +00:00
|
|
|
g_signal_connect(dlg, "destroy", G_CALLBACK(dlg_destroy_cb), NULL);
|
2003-04-24 23:17:43 +00:00
|
|
|
|
|
|
|
/* Catch the "activate" signal on the filter text entry, so that
|
|
|
|
if the user types Return there, we act as if the "Create Stat"
|
|
|
|
button had been selected, as happens if Return is typed if some
|
|
|
|
widget that *doesn't* handle the Return key has the input
|
|
|
|
focus. */
|
|
|
|
dlg_set_activate(filter_entry, start_button);
|
|
|
|
|
2010-07-13 13:51:25 +00:00
|
|
|
gtk_widget_grab_default(start_button );
|
2003-04-24 23:17:43 +00:00
|
|
|
|
|
|
|
/* Give the initial focus to the "Filter" entry box. */
|
|
|
|
gtk_widget_grab_focus(filter_entry);
|
|
|
|
|
2002-10-25 01:08:49 +00:00
|
|
|
gtk_widget_show_all(dlg);
|
2010-07-13 13:51:25 +00:00
|
|
|
window_present(dlg);
|
2002-10-25 01:08:49 +00:00
|
|
|
}
|
|
|
|
|
2014-11-14 18:42:26 +00:00
|
|
|
static stat_tap_ui dcerpcstat_ui = {
|
2014-11-14 18:31:04 +00:00
|
|
|
REGISTER_STAT_GROUP_GENERIC,
|
|
|
|
NULL,
|
2014-11-14 20:05:31 +00:00
|
|
|
"dcerpc,srt",
|
2014-11-14 18:31:04 +00:00
|
|
|
gtk_dcerpcstat_init,
|
|
|
|
0,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2002-11-06 10:53:36 +00:00
|
|
|
void
|
|
|
|
register_tap_listener_gtkdcerpcstat(void)
|
|
|
|
{
|
2014-11-14 18:42:26 +00:00
|
|
|
register_stat_tap_ui(&dcerpcstat_ui, NULL);
|
2003-04-23 05:37:23 +00:00
|
|
|
}
|
2015-02-15 18:58:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|