1999-12-10 04:21:04 +00:00
|
|
|
/* summary_dlg.c
|
|
|
|
* Routines for capture file summary window
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-12-10 04:21:04 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-12-10 04:21:04 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2007-08-30 00:24:40 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
2004-02-02 22:51:30 +00:00
|
|
|
#include <string.h>
|
2008-04-13 03:32:24 +00:00
|
|
|
#include <time.h>
|
2004-02-02 22:51:30 +00:00
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2008-04-13 03:32:24 +00:00
|
|
|
#include <epan/strutil.h>
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2008-04-13 03:32:24 +00:00
|
|
|
#include <wiretap/wtap.h>
|
|
|
|
|
|
|
|
#include "../globals.h"
|
|
|
|
#include "../file.h"
|
|
|
|
#include "../summary.h"
|
2005-02-06 21:20:35 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2008-04-13 03:32:24 +00:00
|
|
|
#include "../capture.h"
|
|
|
|
#include "gtk/main.h"
|
2008-06-24 03:38:15 +00:00
|
|
|
#include "gtk/capture_globals.h"
|
2005-02-06 21:20:35 +00:00
|
|
|
#endif
|
2008-04-13 03:32:24 +00:00
|
|
|
|
|
|
|
#include "gtk/summary_dlg.h"
|
|
|
|
#include "gtk/dlg_utils.h"
|
|
|
|
#include "gtk/gui_utils.h"
|
|
|
|
#include "gtk/help_dlg.h"
|
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
#define SUM_STR_MAX 1024
|
|
|
|
#define FILTER_SNIP_LEN 50
|
1999-12-10 04:21:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2007-05-25 19:13:49 +00:00
|
|
|
add_string_to_table_sensitive(GtkWidget *list, guint *row, const gchar *title, const gchar *value, gboolean sensitive)
|
1999-12-10 04:21:04 +00:00
|
|
|
{
|
2004-05-20 23:01:53 +00:00
|
|
|
GtkWidget *label;
|
|
|
|
gchar *indent;
|
|
|
|
|
|
|
|
if(strlen(value) != 0) {
|
|
|
|
indent = g_strdup_printf(" %s", title);
|
|
|
|
} else {
|
|
|
|
indent = g_strdup(title);
|
|
|
|
}
|
|
|
|
label = gtk_label_new(indent);
|
|
|
|
g_free(indent);
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
|
|
|
gtk_widget_set_sensitive(label, sensitive);
|
|
|
|
gtk_table_attach_defaults(GTK_TABLE(list), label, 0, 1, *row, *row+1);
|
|
|
|
|
|
|
|
label = gtk_label_new(value);
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
|
|
|
gtk_widget_set_sensitive(label, sensitive);
|
|
|
|
gtk_table_attach_defaults(GTK_TABLE(list), label, 1, 2, *row, *row+1);
|
|
|
|
|
|
|
|
*row = *row + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_string_to_table(GtkWidget *list, guint *row, gchar *title, gchar *value)
|
|
|
|
{
|
|
|
|
add_string_to_table_sensitive(list, row, title, value, TRUE);
|
1999-12-10 04:21:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
static void
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(GtkWidget *list, gchar *title, gchar *captured, gchar *displayed, gchar *marked)
|
2004-05-20 23:01:53 +00:00
|
|
|
{
|
2007-11-30 13:28:12 +00:00
|
|
|
simple_list_append(list, 0, title, 1, captured, 2, displayed, 3, marked, -1);
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
void
|
2002-03-05 11:56:00 +00:00
|
|
|
summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
|
1999-12-10 04:21:04 +00:00
|
|
|
{
|
|
|
|
summary_tally summary;
|
|
|
|
GtkWidget *sum_open_w,
|
2005-01-20 23:17:23 +00:00
|
|
|
*main_vb, *bbox, *close_bt, *help_bt;
|
2004-05-20 23:01:53 +00:00
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *list;
|
2007-11-30 13:28:12 +00:00
|
|
|
static const char *titles[] = { "Traffic", "Captured", "Displayed", "Marked" };
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-02-01 13:13:33 +00:00
|
|
|
gchar string_buff[SUM_STR_MAX];
|
2007-11-30 13:28:12 +00:00
|
|
|
gchar string_buff2[SUM_STR_MAX];
|
|
|
|
gchar string_buff3[SUM_STR_MAX];
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-02-01 13:13:33 +00:00
|
|
|
double seconds;
|
2004-05-20 23:01:53 +00:00
|
|
|
double disp_seconds;
|
2007-11-28 01:09:02 +00:00
|
|
|
double marked_seconds;
|
2004-02-01 13:13:33 +00:00
|
|
|
guint offset;
|
2004-05-20 23:01:53 +00:00
|
|
|
guint snip;
|
|
|
|
guint row;
|
2004-02-01 13:13:33 +00:00
|
|
|
gchar *str_dup;
|
|
|
|
gchar *str_work;
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-06-18 14:11:09 +00:00
|
|
|
time_t ti_time;
|
|
|
|
struct tm *ti_tm;
|
2004-06-18 20:23:10 +00:00
|
|
|
unsigned int elapsed_time;
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-02-01 13:13:33 +00:00
|
|
|
/* initial computations */
|
2005-02-04 19:29:27 +00:00
|
|
|
summary_fill_in(&cfile, &summary);
|
2005-02-06 21:20:35 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2008-06-24 03:38:15 +00:00
|
|
|
summary_fill_in_capture(&global_capture_opts, &summary);
|
2005-02-06 21:20:35 +00:00
|
|
|
#endif
|
1999-12-10 04:21:04 +00:00
|
|
|
seconds = summary.stop_time - summary.start_time;
|
2004-05-20 23:01:53 +00:00
|
|
|
disp_seconds = summary.filtered_stop - summary.filtered_start;
|
2007-11-28 01:09:02 +00:00
|
|
|
marked_seconds = summary.marked_stop - summary.marked_start;
|
2004-05-20 23:01:53 +00:00
|
|
|
|
2006-05-22 07:29:40 +00:00
|
|
|
sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "Wireshark: Summary");
|
1999-12-10 04:21:04 +00:00
|
|
|
|
|
|
|
/* Container for each row of widgets */
|
2004-05-20 23:01:53 +00:00
|
|
|
main_vb = gtk_vbox_new(FALSE, 12);
|
|
|
|
gtk_container_border_width(GTK_CONTAINER(main_vb), 12);
|
1999-12-10 04:21:04 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(sum_open_w), main_vb);
|
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* table */
|
|
|
|
table = gtk_table_new(1, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(table), 6);
|
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(table), 3);
|
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), table);
|
|
|
|
row = 0;
|
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* File */
|
|
|
|
add_string_to_table(table, &row, "File", "");
|
1999-12-10 04:21:04 +00:00
|
|
|
|
|
|
|
/* filename */
|
2004-05-20 23:01:53 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%s", summary.filename);
|
|
|
|
add_string_to_table(table, &row, "Name:", string_buff);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
|
|
|
/* length */
|
2007-05-29 06:56:07 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%" G_GINT64_MODIFIER "d bytes", summary.file_length);
|
2004-05-20 23:01:53 +00:00
|
|
|
add_string_to_table(table, &row, "Length:", string_buff);
|
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
/* format */
|
2004-05-20 23:01:53 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%s", wtap_file_type_string(summary.encap_type));
|
|
|
|
add_string_to_table(table, &row, "Format:", string_buff);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file. Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).
If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.
Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").
Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping. Also add units to the capture count option.
Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.
Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.
svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00
|
|
|
if (summary.has_snap) {
|
|
|
|
/* snapshot length */
|
2004-05-20 23:01:53 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%u bytes", summary.snap);
|
|
|
|
add_string_to_table(table, &row, "Packet size limit:", string_buff);
|
Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file. Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).
If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.
Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").
Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping. Also add units to the capture count option.
Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.
Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.
svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00
|
|
|
}
|
1999-12-10 04:21:04 +00:00
|
|
|
|
|
|
|
|
2004-06-18 14:11:09 +00:00
|
|
|
/* Time */
|
|
|
|
add_string_to_table(table, &row, "", "");
|
|
|
|
add_string_to_table(table, &row, "Time", "");
|
|
|
|
|
|
|
|
/* start time */
|
2004-06-18 20:23:10 +00:00
|
|
|
ti_time = (time_t)summary.start_time;
|
|
|
|
ti_tm = localtime(&ti_time);
|
2004-06-18 14:11:09 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX,
|
|
|
|
"%04d-%02d-%02d %02d:%02d:%02d",
|
|
|
|
ti_tm->tm_year + 1900,
|
|
|
|
ti_tm->tm_mon + 1,
|
|
|
|
ti_tm->tm_mday,
|
|
|
|
ti_tm->tm_hour,
|
|
|
|
ti_tm->tm_min,
|
|
|
|
ti_tm->tm_sec);
|
|
|
|
add_string_to_table(table, &row, "First packet:", string_buff);
|
|
|
|
|
|
|
|
/* stop time */
|
2004-06-18 20:23:10 +00:00
|
|
|
ti_time = (time_t)summary.stop_time;
|
|
|
|
ti_tm = localtime(&ti_time);
|
2004-06-18 14:11:09 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX,
|
|
|
|
"%04d-%02d-%02d %02d:%02d:%02d",
|
|
|
|
ti_tm->tm_year + 1900,
|
|
|
|
ti_tm->tm_mon + 1,
|
|
|
|
ti_tm->tm_mday,
|
|
|
|
ti_tm->tm_hour,
|
|
|
|
ti_tm->tm_min,
|
|
|
|
ti_tm->tm_sec);
|
|
|
|
add_string_to_table(table, &row, "Last packet:", string_buff);
|
|
|
|
|
|
|
|
/* elapsed seconds */
|
2004-06-18 20:23:10 +00:00
|
|
|
elapsed_time = (unsigned int)summary.elapsed_time;
|
2004-06-18 14:11:09 +00:00
|
|
|
if(elapsed_time/86400) {
|
2007-08-30 00:24:40 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%02u days %02u:%02u:%02u",
|
2004-06-18 14:11:09 +00:00
|
|
|
elapsed_time/86400, elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
|
|
|
|
} else {
|
2007-08-30 00:24:40 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%02u:%02u:%02u",
|
2004-06-18 14:11:09 +00:00
|
|
|
elapsed_time%86400/3600, elapsed_time%3600/60, elapsed_time%60);
|
|
|
|
}
|
|
|
|
add_string_to_table(table, &row, "Elapsed:", string_buff);
|
|
|
|
|
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Capture */
|
|
|
|
add_string_to_table(table, &row, "", "");
|
2005-01-01 23:19:11 +00:00
|
|
|
add_string_to_table_sensitive(table, &row, "Capture", "", (summary.iface != NULL));
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* interface */
|
|
|
|
if (summary.iface) {
|
2005-02-06 21:20:35 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%s", summary.iface_descr);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
|
2003-12-21 22:32:07 +00:00
|
|
|
}
|
2005-01-01 23:19:11 +00:00
|
|
|
add_string_to_table_sensitive(table, &row, "Interface:", string_buff, (summary.iface) != NULL);
|
2003-03-07 20:27:02 +00:00
|
|
|
|
1999-12-10 04:21:04 +00:00
|
|
|
/* Dropped count */
|
2001-02-11 09:28:17 +00:00
|
|
|
if (summary.drops_known) {
|
2007-05-29 18:52:42 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.drops);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
|
2001-02-11 09:28:17 +00:00
|
|
|
}
|
2005-01-01 23:19:11 +00:00
|
|
|
add_string_to_table_sensitive(table, &row, "Dropped packets:", string_buff, (summary.iface != NULL));
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
/* Capture filter */
|
|
|
|
if (summary.cfilter && summary.cfilter[0] != '\0') {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%s", summary.cfilter);
|
|
|
|
} else {
|
2004-06-18 14:11:09 +00:00
|
|
|
if(summary.iface) {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "none");
|
|
|
|
} else {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
|
|
|
|
}
|
1999-12-10 04:21:04 +00:00
|
|
|
}
|
2005-01-01 23:19:11 +00:00
|
|
|
add_string_to_table_sensitive(table, &row, "Capture filter:", string_buff, (summary.iface != NULL));
|
2004-05-20 23:01:53 +00:00
|
|
|
#endif
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Data */
|
|
|
|
add_string_to_table(table, &row, "", "");
|
|
|
|
add_string_to_table(table, &row, "Display", "");
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2003-12-20 12:03:35 +00:00
|
|
|
if (summary.dfilter) {
|
|
|
|
/* Display filter */
|
2004-02-01 13:13:33 +00:00
|
|
|
/* limit each row to some reasonable length */
|
2004-05-20 23:01:53 +00:00
|
|
|
str_dup = g_strdup_printf("%s", summary.dfilter);
|
2004-02-01 13:13:33 +00:00
|
|
|
str_work = g_strdup(str_dup);
|
|
|
|
offset = 0;
|
2004-05-20 23:01:53 +00:00
|
|
|
snip = 0;
|
|
|
|
while(strlen(str_work) > FILTER_SNIP_LEN) {
|
|
|
|
str_work[FILTER_SNIP_LEN] = '\0';
|
|
|
|
add_string_to_table(table, &row, (snip == 0) ? "Display filter:" : "", str_work);
|
2004-02-01 13:13:33 +00:00
|
|
|
g_free(str_work);
|
2004-05-20 23:01:53 +00:00
|
|
|
offset+=FILTER_SNIP_LEN;
|
2004-02-01 13:13:33 +00:00
|
|
|
str_work = g_strdup(&str_dup[offset]);
|
2004-05-20 23:01:53 +00:00
|
|
|
snip++;
|
2004-02-01 13:13:33 +00:00
|
|
|
}
|
2007-08-30 00:24:40 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
add_string_to_table(table, &row, (snip == 0) ? "Display filter:" : "", str_work);
|
2004-02-01 13:13:33 +00:00
|
|
|
g_free(str_work);
|
|
|
|
g_free(str_dup);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
|
|
|
/* Display filter */
|
|
|
|
add_string_to_table(table, &row, "Display filter:", "none");
|
|
|
|
}
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Traffic */
|
2007-11-30 13:28:12 +00:00
|
|
|
list = simple_list_new(4, titles);
|
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), list);
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2007-11-30 13:28:12 +00:00
|
|
|
/* Packet count */
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%i", summary.packet_count);
|
2007-11-28 01:09:02 +00:00
|
|
|
if (summary.dfilter) {
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%i", summary.filtered_count);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
g_strlcpy(string_buff2, string_buff, SUM_STR_MAX);
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%i", summary.marked_count);
|
|
|
|
add_string_to_list(list, "Packets", string_buff, string_buff2, string_buff3);
|
2007-11-28 01:09:02 +00:00
|
|
|
|
|
|
|
/* Time between first and last */
|
2007-11-30 13:28:12 +00:00
|
|
|
if (seconds > 0) {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%.3f sec", seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.dfilter && disp_seconds > 0) {
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f sec", disp_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.marked_count && marked_seconds > 0) {
|
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f sec", marked_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Between first and last packet", string_buff, string_buff2, string_buff3);
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Packets per second */
|
2007-11-28 01:09:02 +00:00
|
|
|
if (seconds > 0) {
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.packet_count/seconds);
|
2003-12-20 12:03:35 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if(summary.dfilter && disp_seconds > 0) {
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", summary.filtered_count/disp_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
2003-09-02 22:10:32 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if(summary.marked_count && marked_seconds > 0) {
|
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", summary.marked_count/marked_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Avg. packets/sec", string_buff, string_buff2, string_buff3);
|
2003-09-02 22:10:32 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Packet size */
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.packet_count > 1) {
|
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%.3f bytes",
|
2007-11-28 01:09:02 +00:00
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
(float) ((gint64) summary.bytes)/summary.packet_count);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.dfilter && summary.filtered_count > 1) {
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f bytes",
|
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
(float) ((gint64) summary.filtered_bytes)/summary.filtered_count);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.marked_count > 1) {
|
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f bytes",
|
2007-11-28 01:09:02 +00:00
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
(float) ((gint64) summary.marked_bytes)/summary.marked_count);
|
2007-11-30 13:28:12 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Avg. packet size", string_buff, string_buff2, string_buff3);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Byte count */
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.bytes);
|
|
|
|
if (summary.dfilter && summary.filtered_count > 0) {
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.filtered_bytes);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-28 01:09:02 +00:00
|
|
|
if (summary.marked_count) {
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.marked_bytes);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Bytes", string_buff, string_buff2, string_buff3);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* Bytes per second */
|
|
|
|
if (seconds > 0){
|
2005-07-09 11:28:13 +00:00
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds);
|
2004-05-20 23:01:53 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.dfilter && disp_seconds > 0) {
|
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
1999-12-10 04:21:04 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.marked_count && marked_seconds > 0) {
|
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", ((gint64) summary.marked_bytes)/marked_seconds);
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Avg. bytes/sec", string_buff, string_buff2, string_buff3);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
/* MBit per second */
|
2007-11-28 01:09:02 +00:00
|
|
|
if (seconds > 0) {
|
2007-11-30 13:28:12 +00:00
|
|
|
g_snprintf(string_buff, SUM_STR_MAX, "%.3f",
|
2007-11-28 01:09:02 +00:00
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
((gint64) summary.bytes) * 8.0 / (seconds * 1000.0 * 1000.0));
|
1999-12-10 04:21:04 +00:00
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff[0] = '\0';
|
1999-12-10 04:21:04 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.dfilter && disp_seconds > 0) {
|
|
|
|
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f",
|
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff2[0] = '\0';
|
2007-11-28 01:09:02 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
if (summary.marked_count && marked_seconds > 0) {
|
|
|
|
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f",
|
|
|
|
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
|
|
|
|
((gint64) summary.marked_bytes) * 8.0 / (marked_seconds * 1000.0 * 1000.0));
|
|
|
|
} else {
|
2008-02-29 13:33:37 +00:00
|
|
|
string_buff3[0] = '\0';
|
2004-05-20 23:01:53 +00:00
|
|
|
}
|
2007-11-30 13:28:12 +00:00
|
|
|
add_string_to_list(list, "Avg. MBit/sec", string_buff, string_buff2, string_buff3);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2007-08-30 00:24:40 +00:00
|
|
|
|
2004-01-21 21:19:34 +00:00
|
|
|
/* Button row. */
|
2008-06-21 13:36:31 +00:00
|
|
|
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_HELP, NULL);
|
2000-07-05 06:19:27 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(main_vb), bbox);
|
|
|
|
|
2008-04-11 17:26:09 +00:00
|
|
|
close_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLOSE);
|
2004-05-23 23:24:07 +00:00
|
|
|
window_set_cancel_button(sum_open_w, close_bt, window_cancel_button_cb);
|
|
|
|
|
2008-06-21 13:36:31 +00:00
|
|
|
help_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP);
|
|
|
|
g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_STATS_SUMMARY_DIALOG);
|
2005-01-20 23:17:23 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
gtk_widget_grab_focus(close_bt);
|
2000-05-03 07:44:12 +00:00
|
|
|
|
2008-04-11 23:16:06 +00:00
|
|
|
g_signal_connect(sum_open_w, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
1999-12-10 04:21:04 +00:00
|
|
|
|
2004-05-20 23:01:53 +00:00
|
|
|
gtk_widget_show_all(sum_open_w);
|
2004-05-23 23:24:07 +00:00
|
|
|
window_present(sum_open_w);
|
1999-12-10 04:21:04 +00:00
|
|
|
}
|