Move GTK code out of summary.c and into gtk/summary_dlg.c
summary.c now provides a struct of info (see summary.h) Changed the name of the summary dialogue callback (hence the change in menu.c), and added a close button to the dialogue. Moved #include <gtk/gtk.h> out of print.c and into prefs.h where it was needed for GdkColor. svn path=/trunk/; revision=1273
This commit is contained in:
parent
9bd3c4224b
commit
71b7cd5031
6
file.h
6
file.h
|
@ -1,7 +1,7 @@
|
|||
/* file.h
|
||||
* Definitions for file structures and routines
|
||||
*
|
||||
* $Id: file.h,v 1.60 1999/12/04 11:32:25 guy Exp $
|
||||
* $Id: file.h,v 1.61 1999/12/10 04:20:53 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -48,6 +48,10 @@
|
|||
#include "colors.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PRINT_H__
|
||||
#include "print.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.am
|
||||
# Automake file for the GTK interface routines for Ethereal
|
||||
#
|
||||
# $Id: Makefile.am,v 1.14 1999/12/09 20:41:40 oabad Exp $
|
||||
# $Id: Makefile.am,v 1.15 1999/12/10 04:21:02 gram Exp $
|
||||
#
|
||||
# Ethereal - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@zing.org>
|
||||
|
@ -58,4 +58,6 @@ libui_a_SOURCES = \
|
|||
proto_draw.h \
|
||||
stream_prefs.c \
|
||||
stream_prefs.h \
|
||||
summary_dlg.c \
|
||||
summary_dlg.h \
|
||||
ui_util.c
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* menu.c
|
||||
* Menu routines
|
||||
*
|
||||
* $Id: menu.c,v 1.9 1999/12/09 20:41:41 oabad Exp $
|
||||
* $Id: menu.c,v 1.10 1999/12/10 04:21:03 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -42,7 +42,7 @@
|
|||
#include "capture_dlg.h"
|
||||
#include "find_dlg.h"
|
||||
#include "goto_dlg.h"
|
||||
#include "summary.h"
|
||||
#include "summary_dlg.h"
|
||||
#include "display_opts.h"
|
||||
#include "prefs_dlg.h"
|
||||
#include "print.h"
|
||||
|
@ -113,7 +113,7 @@ static GtkItemFactoryEntry menu_items[] =
|
|||
#endif
|
||||
{"/Tools/_Follow TCP Stream", NULL, GTK_MENU_FUNC(follow_stream_cb), 0, NULL},
|
||||
/* {"/Tools/Graph", NULL, NULL, 0, NULL}, future use */
|
||||
{"/Tools/_Summary", NULL, GTK_MENU_FUNC(summary_prep_cb), 0, NULL},
|
||||
{"/Tools/_Summary", NULL, GTK_MENU_FUNC(summary_open_cb), 0, NULL},
|
||||
{"/_Help", NULL, NULL, 0, "<LastBranch>" },
|
||||
{"/Help/_About Ethereal...", NULL, GTK_MENU_FUNC(about_ethereal), 0, NULL}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,216 @@
|
|||
/* summary_dlg.c
|
||||
* Routines for capture file summary window
|
||||
*
|
||||
* $Id: summary_dlg.c,v 1.1 1999/12/10 04:21:04 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* 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
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wtap.h>
|
||||
|
||||
#ifdef NEED_SNPRINTF_H
|
||||
# ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
# else
|
||||
# include <varargs.h>
|
||||
# endif
|
||||
# include "snprintf.h"
|
||||
#endif
|
||||
|
||||
#include "summary.h"
|
||||
#include "summary_dlg.h"
|
||||
|
||||
#define SUM_STR_MAX 1024
|
||||
|
||||
|
||||
static void
|
||||
add_string_to_box(gchar *str, GtkWidget *box)
|
||||
{
|
||||
GtkWidget *lb;
|
||||
lb = gtk_label_new(str);
|
||||
gtk_misc_set_alignment(GTK_MISC(lb), 0.0, 0.5);
|
||||
gtk_box_pack_start(GTK_BOX(box), lb,FALSE,FALSE, 0);
|
||||
gtk_widget_show(lb);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
summary_open_cb(GtkWidget *w, gpointer d)
|
||||
{
|
||||
summary_tally summary;
|
||||
GtkWidget *sum_open_w,
|
||||
*main_vb, *file_fr, *data_fr, *capture_fr, *file_box,
|
||||
*data_box, *capture_box, *close_bt;
|
||||
|
||||
gchar string_buff[SUM_STR_MAX];
|
||||
|
||||
double seconds;
|
||||
|
||||
/* initialize the tally */
|
||||
summary_fill_in(&summary);
|
||||
|
||||
/* initial compututations */
|
||||
seconds = summary.stop_time - summary.start_time;
|
||||
sum_open_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(sum_open_w), "Ethereal: Summary");
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(sum_open_w), "delete_event",
|
||||
GTK_SIGNAL_FUNC(summary_destroy_cb), NULL);
|
||||
gtk_signal_connect( GTK_OBJECT(sum_open_w), "destroy",
|
||||
GTK_SIGNAL_FUNC(summary_destroy_cb), NULL);
|
||||
|
||||
/* Container for each row of widgets */
|
||||
main_vb = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
|
||||
gtk_container_add(GTK_CONTAINER(sum_open_w), main_vb);
|
||||
gtk_widget_show(main_vb);
|
||||
|
||||
/* File frame */
|
||||
file_fr = gtk_frame_new("File");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), file_fr);
|
||||
gtk_widget_show(file_fr);
|
||||
|
||||
file_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(file_fr), file_box);
|
||||
gtk_widget_show(file_box);
|
||||
|
||||
/* filename */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Name: %s", summary.filename);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* length */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Length: %lu", summary.file_length);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* format */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Format: %s", wtap_file_type_string(summary.encap_type));
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* snapshot length */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Snapshot length: %u", summary.snap);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* Data frame */
|
||||
data_fr = gtk_frame_new("Data");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), data_fr);
|
||||
gtk_widget_show(data_fr);
|
||||
|
||||
data_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(data_fr), data_box);
|
||||
gtk_widget_show(data_box);
|
||||
|
||||
/* seconds */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Elapsed time: %.3f seconds", summary.elapsed_time);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
snprintf(string_buff, SUM_STR_MAX, "Between first and last packet: %.3f seconds", seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Packet count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Packet count: %i", summary.packet_count);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Filtered Packet count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Filtered packet count: %i", summary.filtered_count);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Packets per second */
|
||||
if (seconds > 0){
|
||||
snprintf(string_buff, SUM_STR_MAX, "Avg. packets/sec: %.3f", summary.packet_count/seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
}
|
||||
|
||||
/* Dropped count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Dropped packets: %i", summary.drops);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Byte count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Bytes of traffic: %d", summary.bytes);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Bytes per second */
|
||||
if (seconds > 0){
|
||||
snprintf(string_buff, SUM_STR_MAX, "Avg. bytes/sec: %.3f", summary.bytes/seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
}
|
||||
|
||||
/* Capture frame */
|
||||
capture_fr = gtk_frame_new("Capture");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), capture_fr);
|
||||
gtk_widget_show(capture_fr);
|
||||
|
||||
capture_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(capture_fr), capture_box);
|
||||
gtk_widget_show(capture_box);
|
||||
|
||||
|
||||
/* interface */
|
||||
if (summary.iface) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Interface: %s", summary.iface);
|
||||
} else {
|
||||
sprintf(string_buff, "Interface: unknown");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
|
||||
/* Display filter */
|
||||
if (summary.dfilter) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Display filter: %s", summary.dfilter);
|
||||
} else {
|
||||
sprintf(string_buff, "Display filter: none");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
/* Capture filter */
|
||||
if (summary.cfilter) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Capture filter: %s", summary.cfilter);
|
||||
} else {
|
||||
sprintf(string_buff, "Capture filter: none");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
#endif
|
||||
|
||||
/* Create Close Button */
|
||||
close_bt = gtk_button_new_with_label("Close");
|
||||
gtk_signal_connect_object(GTK_OBJECT(close_bt), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroy),
|
||||
GTK_OBJECT(sum_open_w));
|
||||
gtk_box_pack_start(GTK_BOX(main_vb), close_bt, FALSE,FALSE, 0);
|
||||
gtk_widget_show( close_bt );
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(sum_open_w), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show(sum_open_w);
|
||||
}
|
||||
|
||||
void
|
||||
summary_destroy_cb(GtkWidget *win, gpointer data)
|
||||
{
|
||||
gtk_grab_remove(GTK_WIDGET(win));
|
||||
gtk_widget_destroy(GTK_WIDGET(win));
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* summary_dlg.h
|
||||
* Routines for capture file summary window
|
||||
*
|
||||
* $Id: summary_dlg.h,v 1.1 1999/12/10 04:21:04 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __SUMMARY_DLG_H__
|
||||
#define __SUMMARY_DLG_H__
|
||||
|
||||
void summary_open_cb(GtkWidget *w, gpointer d);
|
||||
void summary_destroy_cb(GtkWidget *w, gpointer d);
|
||||
|
||||
#endif /* __SUMMARY_DLG_H__ */
|
6
prefs.h
6
prefs.h
|
@ -1,7 +1,7 @@
|
|||
/* prefs.h
|
||||
* Definitions for preference handling routines
|
||||
*
|
||||
* $Id: prefs.h,v 1.9 1999/12/02 04:30:03 gerald Exp $
|
||||
* $Id: prefs.h,v 1.10 1999/12/10 04:20:53 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -32,6 +32,10 @@
|
|||
#define PR_DEST_CMD 0
|
||||
#define PR_DEST_FILE 1
|
||||
|
||||
#ifndef __GTK_H__
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
typedef struct _e_prefs {
|
||||
gint pr_format;
|
||||
gint pr_dest;
|
||||
|
|
3
print.c
3
print.c
|
@ -1,7 +1,7 @@
|
|||
/* print.c
|
||||
* Routines for printing packet analysis trees.
|
||||
*
|
||||
* $Id: print.c,v 1.24 1999/11/22 08:03:31 guy Exp $
|
||||
* $Id: print.c,v 1.25 1999/12/10 04:20:53 gram Exp $
|
||||
*
|
||||
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
*
|
||||
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
|
|
248
summary.c
248
summary.c
|
@ -1,7 +1,7 @@
|
|||
/* summary.c
|
||||
* Routines for capture file summary window
|
||||
* Routines for capture file summary info
|
||||
*
|
||||
* $Id: summary.c,v 1.14 1999/12/04 08:59:12 guy Exp $
|
||||
* $Id: summary.c,v 1.15 1999/12/10 04:20:53 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -28,253 +28,73 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SNPRINTF_H
|
||||
# ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
# else
|
||||
# include <varargs.h>
|
||||
# endif
|
||||
# include "snprintf.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
#endif
|
||||
|
||||
#include "gtk/main.h"
|
||||
#include "packet.h"
|
||||
#include "file.h"
|
||||
#include "globals.h"
|
||||
#include "summary.h"
|
||||
#include "capture.h"
|
||||
#include "util.h"
|
||||
#include "prefs.h"
|
||||
|
||||
extern capture_file cf;
|
||||
|
||||
/* File selection data keys */
|
||||
#define E_SUM_PREP_FS_KEY "sum_prep_fs"
|
||||
#define E_SUM_PREP_TE_KEY "sum_prep_te"
|
||||
|
||||
/* Summary callback data keys */
|
||||
#define E_SUM_IFACE_KEY "sum_iface"
|
||||
#define E_SUM_FILT_KEY "sum_filter"
|
||||
#define E_SUM_COUNT_KEY "sum_count"
|
||||
#define E_SUM_OPEN_KEY "sum_open"
|
||||
#define E_SUM_SNAP_KEY "sum_snap"
|
||||
|
||||
#define SUM_STR_MAX 1024
|
||||
|
||||
/* Summary filter key */
|
||||
#define E_SUM_FILT_TE_KEY "sum_filt_te"
|
||||
|
||||
double
|
||||
secs_usecs( guint32 s, guint32 us) {
|
||||
static double
|
||||
secs_usecs( guint32 s, guint32 us)
|
||||
{
|
||||
return (us / 1000000.0) + (double)s;
|
||||
}
|
||||
|
||||
void
|
||||
tally_frame_data(gpointer cf, gpointer st) {
|
||||
static void
|
||||
tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
|
||||
{
|
||||
double cur_time;
|
||||
summary_tally * sum_tally = (summary_tally *)st;
|
||||
frame_data *cur_frame = (frame_data *)cf;
|
||||
|
||||
cur_time = secs_usecs(cur_frame->abs_secs, cur_frame->abs_usecs);
|
||||
|
||||
if (cur_time < sum_tally->start_time) {
|
||||
sum_tally->start_time = cur_time;
|
||||
}
|
||||
if (cur_time > sum_tally->stop_time){
|
||||
sum_tally->stop_time = cur_time;
|
||||
}
|
||||
sum_tally->bytes += cur_frame->pkt_len;
|
||||
if (cur_frame->passed_dfilter)
|
||||
sum_tally->stop_time = cur_time;
|
||||
}
|
||||
sum_tally->bytes += cur_frame->pkt_len;
|
||||
if (cur_frame->passed_dfilter)
|
||||
sum_tally->filtered_count++;
|
||||
}
|
||||
|
||||
void
|
||||
add_string_to_box(gchar *str, GtkWidget *box) {
|
||||
GtkWidget *lb;
|
||||
lb = gtk_label_new(str);
|
||||
gtk_misc_set_alignment(GTK_MISC(lb), 0.0, 0.5);
|
||||
gtk_box_pack_start(GTK_BOX(box), lb,FALSE,FALSE, 0);
|
||||
gtk_widget_show(lb);
|
||||
}
|
||||
summary_fill_in(summary_tally *st)
|
||||
{
|
||||
|
||||
void
|
||||
summary_prep_cb(GtkWidget *w, gpointer d) {
|
||||
frame_data *first_frame, *cur_frame;
|
||||
summary_tally *st;
|
||||
GtkWidget *sum_open_w,
|
||||
*main_vb, *file_fr, *data_fr, *capture_fr, *file_box,
|
||||
*data_box,
|
||||
*capture_box;
|
||||
|
||||
gchar string_buff[SUM_STR_MAX];
|
||||
|
||||
guint32 traffic_bytes, i;
|
||||
double seconds;
|
||||
frame_data *cur_glist;
|
||||
int i;
|
||||
frame_data *cur_glist;
|
||||
|
||||
/* initialize the tally */
|
||||
first_frame = cf.plist;
|
||||
st = (summary_tally *)g_malloc(sizeof(summary_tally));
|
||||
st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs)
|
||||
;
|
||||
st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs)
|
||||
;
|
||||
st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) ;
|
||||
st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs) ;
|
||||
st->bytes = 0;
|
||||
st->filtered_count = 0;
|
||||
cur_glist = cf.plist;
|
||||
|
||||
for (i = 0; i < cf.count; i++){
|
||||
for (i = 0; i < cf.count; i++) {
|
||||
cur_frame = cur_glist;
|
||||
tally_frame_data(cur_frame, st);
|
||||
cur_glist = cur_glist->next;
|
||||
}
|
||||
|
||||
/* traffic_bytes will be computed here */
|
||||
traffic_bytes = st->bytes;
|
||||
seconds = st->stop_time - st->start_time;
|
||||
sum_open_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(sum_open_w), "Ethereal: Summary");
|
||||
|
||||
/* Container for each row of widgets */
|
||||
main_vb = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
|
||||
gtk_container_add(GTK_CONTAINER(sum_open_w), main_vb);
|
||||
gtk_widget_show(main_vb);
|
||||
|
||||
/* File frame */
|
||||
file_fr = gtk_frame_new("File");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), file_fr);
|
||||
gtk_widget_show(file_fr);
|
||||
|
||||
file_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(file_fr), file_box);
|
||||
gtk_widget_show(file_box);
|
||||
|
||||
/* filename */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Name: %s", cf.filename);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* length */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Length: %lu", cf.f_len);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* format */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Format: %s",
|
||||
wtap_file_type_string(cf.cd_t));
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* snapshot length */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Snapshot length: %u", cf.snap);
|
||||
add_string_to_box(string_buff, file_box);
|
||||
|
||||
/* Data frame */
|
||||
data_fr = gtk_frame_new("Data");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), data_fr);
|
||||
gtk_widget_show(data_fr);
|
||||
|
||||
data_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(data_fr), data_box);
|
||||
gtk_widget_show(data_box);
|
||||
|
||||
/* seconds */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Elapsed time: %.3f seconds",
|
||||
secs_usecs(cf.esec,cf.eusec));
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
snprintf(string_buff, SUM_STR_MAX, "Between first and last packet: %.3f seconds", seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Packet count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Packet count: %i", cf.count);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Filtered Packet count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Filtered packet count: %i", st->filtered_count);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Packets per second */
|
||||
if (seconds > 0){
|
||||
snprintf(string_buff, SUM_STR_MAX, "Avg. packets/sec: %.3f",
|
||||
cf.count/seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
}
|
||||
|
||||
/* Dropped count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Dropped packets: %i", cf.drops);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Byte count */
|
||||
snprintf(string_buff, SUM_STR_MAX, "Bytes of traffic: %d",
|
||||
traffic_bytes);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
|
||||
/* Bytes per second */
|
||||
if (seconds > 0){
|
||||
snprintf(string_buff, SUM_STR_MAX, "Avg. bytes/sec: %.3f",
|
||||
traffic_bytes/seconds);
|
||||
add_string_to_box(string_buff, data_box);
|
||||
}
|
||||
|
||||
/* Capture frame */
|
||||
capture_fr = gtk_frame_new("Capture");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), capture_fr);
|
||||
gtk_widget_show(capture_fr);
|
||||
|
||||
capture_box = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_add(GTK_CONTAINER(capture_fr), capture_box);
|
||||
gtk_widget_show(capture_box);
|
||||
|
||||
|
||||
/* interface */
|
||||
if (cf.iface) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Interface: %s", cf.iface);
|
||||
} else {
|
||||
sprintf(string_buff, "Interface: unknown");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
|
||||
/* Display filter */
|
||||
if (cf.dfilter) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Display filter: %s", cf.dfilter);
|
||||
} else {
|
||||
sprintf(string_buff, "Display filter: none");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
st->filename = cf.filename;
|
||||
st->file_length = cf.f_len;
|
||||
st->encap_type = cf.cd_t;
|
||||
st->snap = cf.snap;
|
||||
st->elapsed_time = secs_usecs(cf.esec, cf.eusec);
|
||||
st->packet_count = cf.count;
|
||||
st->drops = cf.drops;
|
||||
st->iface = cf.iface;
|
||||
st->dfilter = cf.dfilter;
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
/* Capture filter */
|
||||
if (cf.cfilter) {
|
||||
snprintf(string_buff, SUM_STR_MAX, "Capture filter: %s", cf.cfilter);
|
||||
} else {
|
||||
sprintf(string_buff, "Capture filter: none");
|
||||
}
|
||||
add_string_to_box(string_buff, capture_box);
|
||||
st->cfilter = cf.cfilter;
|
||||
#else
|
||||
st->cfilter = NULL;
|
||||
#endif
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(sum_open_w), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show(sum_open_w);
|
||||
|
||||
}
|
||||
|
||||
/* this is never called
|
||||
void
|
||||
summary_prep_close_cb(GtkWidget *w, gpointer win) {
|
||||
|
||||
gtk_grab_remove(GTK_WIDGET(win));
|
||||
gtk_widget_destroy(GTK_WIDGET(win));
|
||||
} */
|
||||
|
|
29
summary.h
29
summary.h
|
@ -1,7 +1,7 @@
|
|||
/* summary.h
|
||||
* Definitions for capture file summary windows
|
||||
* Definitions for capture file summary data
|
||||
*
|
||||
* $Id: summary.h,v 1.3 1999/07/13 03:08:06 gram Exp $
|
||||
* $Id: summary.h,v 1.4 1999/12/10 04:20:54 gram Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -27,16 +27,25 @@
|
|||
#define __SUMMARY_H__
|
||||
|
||||
typedef struct _summary_tally {
|
||||
guint32 bytes;
|
||||
double start_time;
|
||||
double stop_time;
|
||||
guint32 filtered_count;
|
||||
guint32 bytes; /* total bytes */
|
||||
double start_time; /* seconds, with msec resolution */
|
||||
double stop_time; /* seconds, with msec resolution */
|
||||
double elapsed_time; /* seconds, with msec resolution,
|
||||
includes time before first packet
|
||||
and after last packet */
|
||||
int filtered_count; /* number of filtered packets */
|
||||
int packet_count; /* total number of packets in trace */
|
||||
const char *filename;
|
||||
long file_length; /* file length in bytes */
|
||||
int encap_type; /* wiretap encapsulation type */
|
||||
int snap; /* snapshot length */
|
||||
int drops; /* number of packet drops */
|
||||
const char *iface; /* interface name */
|
||||
const char *dfilter; /* display filter */
|
||||
const char *cfilter; /* capture filter */
|
||||
} summary_tally;
|
||||
|
||||
|
||||
|
||||
void summary_prep_cb(GtkWidget *, gpointer);
|
||||
/*void summary_prep_close_cb(GtkWidget *, gpointer);*/
|
||||
void summary_fill_in(summary_tally *st);
|
||||
|
||||
#endif /* summary.h */
|
||||
|
||||
|
|
Loading…
Reference in New Issue