aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-08 10:07:41 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-08 10:07:41 +0000
commit89a4acb4389e07e335aa8fbe791c223b533c0de1 (patch)
tree6822a5170f6f9aea4ad4516e9dff63725bda89c6
parentad1ce4a43d656ac7ef4a418317417fe503162636 (diff)
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
-rw-r--r--capture.c27
-rw-r--r--capture.h4
-rw-r--r--doc/ethereal.pod.template82
-rw-r--r--editcap.c8
-rw-r--r--file.c8
-rw-r--r--file.h5
-rw-r--r--gtk/capture_dlg.c510
-rw-r--r--gtk/main.c19
-rw-r--r--gtk/summary_dlg.c10
-rw-r--r--mergecap.c12
-rw-r--r--summary.c3
-rw-r--r--summary.h5
-rw-r--r--tethereal.c30
-rw-r--r--wiretap/csids.c4
-rw-r--r--wiretap/dbs-etherwatch.c11
-rw-r--r--wiretap/etherpeek.c4
-rw-r--r--wiretap/i4btrace.c4
-rw-r--r--wiretap/netmon.c4
-rw-r--r--wiretap/nettl.c4
-rw-r--r--wiretap/netxray.c4
-rw-r--r--wiretap/ngsniffer.c4
-rw-r--r--wiretap/radcom.c4
-rw-r--r--wiretap/snoop.c4
-rw-r--r--wiretap/toshiba.c11
-rw-r--r--wiretap/vms.c4
25 files changed, 509 insertions, 276 deletions
diff --git a/capture.c b/capture.c
index 740dfad242..8a01307559 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.168 2002/01/21 07:36:31 guy Exp $
+ * $Id: capture.c,v 1.169 2002/02/08 10:07:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -169,6 +169,8 @@
#include "capture-wpcap.h"
#endif
+gboolean has_snaplen;
+int snaplen;
int promisc_mode; /* capture in promiscuous mode */
int sync_mode; /* fork a child to do the capture, and sync between them */
static int sync_pipe[2]; /* used to sync father */
@@ -362,9 +364,11 @@ do_capture(char *capfile_name)
sprintf(scount,"%d",cfile.count);
argv = add_arg(argv, &argc, scount);
- argv = add_arg(argv, &argc, "-s");
- sprintf(ssnap,"%d",cfile.snap);
- argv = add_arg(argv, &argc, ssnap);
+ if (has_snaplen) {
+ argv = add_arg(argv, &argc, "-s");
+ sprintf(ssnap,"%d",snaplen);
+ argv = add_arg(argv, &argc, ssnap);
+ }
argv = add_arg(argv, &argc, "-a");
sprintf(sautostop_filesize,"filesize:%d",cfile.autostop_filesize);
@@ -1253,7 +1257,7 @@ capture(gboolean *stats_known, struct pcap_stat *stats)
GtkWidget *cap_w, *main_vb, *stop_bt, *counts_tb;
pcap_t *pch;
int pcap_encap;
- int snaplen;
+ int file_snaplen;
gchar open_err_str[PCAP_ERRBUF_SIZE];
gchar lookup_net_err_str[PCAP_ERRBUF_SIZE];
gchar label_str[64];
@@ -1345,8 +1349,9 @@ capture(gboolean *stats_known, struct pcap_stat *stats)
if they succeed; to tell if that's happened, we have to clear
the error buffer, and check if it's still a null string. */
open_err_str[0] = '\0';
- pch = pcap_open_live(cfile.iface, cfile.snap, promisc_mode,
- CAP_READ_TIMEOUT, open_err_str);
+ pch = pcap_open_live(cfile.iface,
+ has_snaplen ? snaplen : WTAP_MAX_PACKET_SIZE,
+ promisc_mode, CAP_READ_TIMEOUT, open_err_str);
if (pch == NULL) {
#ifdef _WIN32
@@ -1445,12 +1450,12 @@ capture(gboolean *stats_known, struct pcap_stat *stats)
#ifndef _WIN32
if (ld.from_pipe) {
pcap_encap = hdr.network;
- snaplen = hdr.snaplen;
+ file_snaplen = hdr.snaplen;
} else
#endif
{
pcap_encap = get_pcap_linktype(pch, cfile.iface);
- snaplen = pcap_snapshot(pch);
+ file_snaplen = pcap_snapshot(pch);
}
ld.linktype = wtap_pcap_encap_to_wtap_encap(pcap_encap);
if (ld.linktype == WTAP_ENCAP_UNKNOWN) {
@@ -1461,10 +1466,10 @@ capture(gboolean *stats_known, struct pcap_stat *stats)
}
if (cfile.ringbuffer_on) {
ld.pdh = ringbuf_init_wtap_dump_fdopen(WTAP_FILE_PCAP, ld.linktype,
- snaplen, &err);
+ file_snaplen, &err);
} else {
ld.pdh = wtap_dump_fdopen(cfile.save_file_fd, WTAP_FILE_PCAP,
- ld.linktype, snaplen, &err);
+ ld.linktype, file_snaplen, &err);
}
if (ld.pdh == NULL) {
diff --git a/capture.h b/capture.h
index 9b001ae0e1..a079c6132d 100644
--- a/capture.h
+++ b/capture.h
@@ -1,7 +1,7 @@
/* capture.h
* Definitions for packet capture windows
*
- * $Id: capture.h,v 1.28 2002/01/10 11:05:48 guy Exp $
+ * $Id: capture.h,v 1.29 2002/02/08 10:07:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -31,6 +31,8 @@
/* Name we give to the child process when doing a "-S" capture. */
#define CHILD_NAME "ethereal-capture"
+extern gboolean has_snaplen; /* TRUE if maximum capture packet length is specified */
+extern int snaplen; /* Maximum captured packet length */
extern int promisc_mode; /* capture in promiscuous mode */
extern int sync_mode; /* fork a child to do the capture, and sync between them */
extern int sync_pipe[2]; /* used to sync father */
diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template
index a7a5c0e1f7..06e3d63673 100644
--- a/doc/ethereal.pod.template
+++ b/doc/ethereal.pod.template
@@ -822,44 +822,66 @@ string> entry.
The I<Capture Options> dialog lets you specify various parameters for
capturing live packet data.
-The I<Interface:> combo box lets you specify the interface from which to
+The I<Interface:> field lets you specify the interface from which to
capture packet data or a command from which to get the packet data via a
pipe.
-The I<Count:> entry specifies the maximum number of packets to capture.
-0 means Ethereal will not stop capturing at some fixed number of
-captured packets.
-
-The I<File size:> entry specifies the maximum size of a capture file, in
-kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). 0 means
-Ethereal will not stop capturing at some capture file size (although the
-operating system on which Ethereal is running, or the available disk
-space, may still limit the maximum size of a capture file).
+The I<Limit each packet to ... bytes> check box and field lets you
+specify a maximum number of bytes per packet to capture and save; if the
+check box is not checked, the limit will be 65535 bytes.
-The I<Duration:> entry specifies the maximum time over which to capture,
-in seconds. 0 means Ethereal will not stop capturing after some fixed
-time has elapsed.
+The I<Capture packets in promiscuous mode> check box lets you specify
+whether the interface should be put into promiscuous mode when
+capturing.
The I<Filter:> entry lets you specify the capture filter using a
tcpdump-style filter string as described above.
-The I<File:> entry specifies the file to save to, as in the I<Printer
-Options> dialog above.
-
-You can specify the maximum number of bytes to capture per packet with
-the I<Capture length> entry, can specify whether the interface is to be
-put in promiscuous mode or not with the I<Capture packets in promiscuous
-mode> check box, can specify whether Ethereal should run in "ring
-buffer" mode with the I<Use ring buffer> check box and can specify the
-number of files to use with the I<Number of files> spin box, can specify
-that the display should be updated as packets are captured with the
-I<Update list of packets in real time> check box, can specify whether in
-such a capture the packet list pane should scroll to show the most
-recently captured packets with the I<Automatic scrolling in live
-capture> check box, and can specify whether addresses should be
-translated to names in the display with the I<Enable MAC name
-resolution>, I<Enable network name resolution> and I<Enable transport
-name resolution> check boxes.
+The I<File:> entry lets you specify the file into which captured packets
+should be saved, as in the I<Printer Options> dialog above. If not
+specified, the captured packets will be saved in a temporary file; you
+can save those packets to a file with the I<File:Save As> menu item.
+
+The I<Use ring buffer> check box lets you specify that the capture
+should be done in "ring buffer" mode; the I<Number of files> field
+lets you specify the number of files in the ring buffer.
+
+The I<Update list of packets in real time> check box lets you specify
+whether the display should be updated as packets are captured and, if
+you specify that, the I<Automatic scrolling in live capture> check box
+lets you specify the packet list pane should automatically scroll to
+show the most recently captured packets as new packets arrive.
+
+The I<Stop capture after ... packet(s) captured> check box and field let
+you specify that Ethereal should stop capturing after having captured
+some number of packets; if the check box is not checked, Ethereal will
+not stop capturing at some fixed number of captured packets.
+
+If "ring buffer" mode is not specified, the I<Stop capture after ...
+kilobyte(s) captured> check box and field let you specify that Ethereal
+should stop capturing after the the file to which captured packets are
+being saved grows as large as or larger than some specified number of
+kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes). If the
+check box is not checked, Ethereal will not stop capturing at some
+capture file size (although the operating system on which Ethereal is
+running, or the available disk space, may still limit the maximum size
+of a capture file).
+
+If "ring buffer" mode is specified, that field becomes the I<Rotate
+capture file very ... kilobyte(s)> field, and specifies the number
+of kilobytes at which to start writing to a new ring buffer file; the
+check box is forced to be checked, as "ring buffer" mode requires a file
+size to be specified.
+
+The I<Stop capture after ... second(s)> check box and field let you
+specify that Ethereal should stop capturing after it has been capturing
+for some number of seconds; if the check box is not checked, Ethereal
+will not stop capturing after some fixed time has elapsed.
+
+The I<Enable MAC name resolution>, I<Enable network name resolution> and
+I<Enable transport name resolution> check boxes let you specify whether
+MAC addresses, network addresses, and transport-layer port numbers
+should be translated to names.
=item Display Options
diff --git a/editcap.c b/editcap.c
index 42f6d569d1..72b986d28c 100644
--- a/editcap.c
+++ b/editcap.c
@@ -1,7 +1,7 @@
/* Edit capture files. We can delete records, adjust timestamps, or
* simply convert from one format to another format.
*
- * $Id: editcap.c,v 1.18 2001/10/04 08:30:33 guy Exp $
+ * $Id: editcap.c,v 1.19 2002/02/08 10:07:33 guy Exp $
*
* Originally written by Richard Sharpe.
* Improved by Guy Harris.
@@ -316,6 +316,7 @@ int main(int argc, char *argv[])
extern int optind;
char opt;
char *p;
+ int snapshot_length;
/* Process the options first */
@@ -415,6 +416,11 @@ int main(int argc, char *argv[])
if (out_frame_type == -2)
out_frame_type = wtap_file_encap(wth);
+ snapshot_length = wtap_snapshot_length(wth);
+ if (snapshot_length == 0) {
+ /* Snapshot length of input file not known. */
+ snapshot_length = WTAP_MAX_PACKET_SIZE;
+ }
args.pdh = wtap_dump_open(argv[optind + 1], out_file_type,
out_frame_type, wtap_snapshot_length(wth), &err);
if (args.pdh == NULL) {
diff --git a/file.c b/file.c
index 4859ac2972..0c2b64de72 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.259 2002/01/21 07:36:31 guy Exp $
+ * $Id: file.c,v 1.260 2002/02/08 10:07:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -186,6 +186,12 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
cf->esec = 0;
cf->eusec = 0;
cf->snap = wtap_snapshot_length(cf->wth);
+ if (cf->snap == 0) {
+ /* Snapshot length not known. */
+ cf->has_snap = FALSE;
+ cf->snap = WTAP_MAX_PACKET_SIZE;
+ } else
+ cf->has_snap = TRUE;
cf->progbar_quantum = 0;
cf->progbar_nextstep = 0;
firstsec = 0, firstusec = 0;
diff --git a/file.h b/file.h
index 78b21aab0b..9c0425c621 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.89 2002/01/21 07:36:31 guy Exp $
+ * $Id: file.h,v 1.90 2002/02/08 10:07:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -59,7 +59,8 @@ typedef struct _capture_file {
guint32 drops; /* Dropped packets */
guint32 esec; /* Elapsed seconds */
guint32 eusec; /* Elapsed microseconds */
- int snap; /* Captured packet length */
+ gboolean has_snap; /* TRUE if maximum capture packet length is known */
+ int snap; /* Maximum captured packet length */
long progbar_quantum; /* Number of bytes read per progress bar update */
long progbar_nextstep; /* Next point at which to update progress bar */
gchar *iface; /* Interface */
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index 49eabe85e6..c8227ac13a 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -1,7 +1,7 @@
/* capture_dlg.c
* Routines for packet capture windows
*
- * $Id: capture_dlg.c,v 1.57 2002/01/21 07:37:41 guy Exp $
+ * $Id: capture_dlg.c,v 1.58 2002/02/08 10:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -64,21 +64,26 @@
/* Capture callback data keys */
#define E_CAP_IFACE_KEY "cap_iface"
+#define E_CAP_SNAP_CB_KEY "cap_snap_cb"
+#define E_CAP_SNAP_SB_KEY "cap_snap_sb"
+#define E_CAP_PROMISC_KEY "cap_promisc"
#define E_CAP_FILT_KEY "cap_filter_te"
#define E_CAP_FILE_TE_KEY "cap_file_te"
-#define E_CAP_COUNT_KEY "cap_count"
-#define E_CAP_SNAP_KEY "cap_snap"
-#define E_CAP_PROMISC_KEY "cap_promisc"
+#define E_CAP_RING_ON_TB_KEY "cap_ringbuffer_on_tb"
+#define E_CAP_RING_NBF_LB_KEY "cap_ringbuffer_nbf_lb"
+#define E_CAP_RING_NBF_SB_KEY "cap_ringbuffer_nbf_sb"
#define E_CAP_SYNC_KEY "cap_sync"
#define E_CAP_AUTO_SCROLL_KEY "cap_auto_scroll"
+#define E_CAP_COUNT_CB_KEY "cap_count_cb"
+#define E_CAP_COUNT_SB_KEY "cap_count_sb"
+#define E_CAP_FILESIZE_CB_KEY "cap_filesize_cb"
+#define E_CAP_FILESIZE_SB_KEY "cap_filesize_sb"
+#define E_CAP_FILESIZE_LB_KEY "cap_filesize_lb"
+#define E_CAP_DURATION_CB_KEY "cap_duration_cb"
+#define E_CAP_DURATION_SB_KEY "cap_duration_sb"
#define E_CAP_M_RESOLVE_KEY "cap_m_resolve"
#define E_CAP_N_RESOLVE_KEY "cap_n_resolve"
#define E_CAP_T_RESOLVE_KEY "cap_t_resolve"
-#define E_CAP_FILESIZE_KEY "cap_filesize"
-#define E_CAP_DURATION_KEY "cap_duration"
-#define E_CAP_RING_ON_TB_KEY "cap_ringbuffer_on_tb"
-#define E_CAP_RING_NBF_LB_KEY "cap_ringbuffer_nbf_lb"
-#define E_CAP_RING_NBF_SB_KEY "cap_ringbuffer_nbf_sb"
#define E_FS_CALLER_PTR_KEY "fs_caller_ptr"
#define E_FILE_SEL_DIALOG_PTR_KEY "file_sel_dialog_ptr"
@@ -124,23 +129,28 @@ static GtkWidget *cap_open_w;
void
capture_prep_cb(GtkWidget *w, gpointer d)
{
- GtkWidget *if_cb, *if_lb,
- *count_lb, *count_cb, *main_vb,
- *filter_bt, *filter_te,
- *file_bt, *file_te,
- *filesize_lb, *filesize_cb,
- *duration_lb, *duration_cb,
- *caplen_hb, *table,
- *bbox, *ok_bt, *cancel_bt, *snap_lb,
- *snap_sb, *promisc_cb, *sync_cb, *auto_scroll_cb,
+ GtkWidget *main_vb,
+ *capture_fr, *capture_vb,
+ *if_hb, *if_cb, *if_lb,
+ *snap_hb, *snap_cb, *snap_sb, *snap_lb,
+ *promisc_cb,
+ *filter_hb, *filter_bt, *filter_te,
+ *file_fr, *file_vb,
+ *file_hb, *file_bt, *file_te,
+ *ringbuffer_hb, *ringbuffer_on_tb, *ringbuffer_nbf_lb, *ringbuffer_nbf_sb,
+ *display_fr, *display_vb,
+ *sync_cb, *auto_scroll_cb,
+ *limit_fr, *limit_vb,
+ *count_hb, *count_cb, *count_sb, *count_lb,
+ *filesize_hb, *filesize_cb, *filesize_sb, *filesize_lb,
+ *duration_hb, *duration_cb, *duration_sb, *duration_lb,
+ *resolv_fr, *resolv_vb,
*m_resolv_cb, *n_resolv_cb, *t_resolv_cb,
- *ringbuffer_hb, *ringbuffer_on_tb, *ringbuffer_nbf_lb, *ringbuffer_nbf_sb;
+ *bbox, *ok_bt, *cancel_bt;
GtkAccelGroup *accel_group;
- GtkAdjustment *snap_adj, *ringbuffer_nbf_adj;
- GList *if_list, *count_list = NULL, *filesize_list = NULL, *duration_list = NULL;
- gchar *count_item1 = "0 (Infinite)", count_item2[16],
- *filesize_item1 = "0 (Infinite)", filesize_item2[16],
- *duration_item1 = "0 (Infinite)", duration_item2[16];
+ GtkAdjustment *snap_adj, *ringbuffer_nbf_adj,
+ *count_adj, *filesize_adj, *duration_adj;
+ GList *if_list;
int err;
char err_str[PCAP_ERRBUF_SIZE];
@@ -195,17 +205,22 @@ capture_prep_cb(GtkWidget *w, gpointer d)
gtk_container_add(GTK_CONTAINER(cap_open_w), main_vb);
gtk_widget_show(main_vb);
- /* Table : container of the first 6 rows */
- table = gtk_table_new (6, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE (table), 5);
- gtk_table_set_col_spacings(GTK_TABLE (table), 5);
- gtk_container_add(GTK_CONTAINER(main_vb), table);
- gtk_widget_show(table);
+ /* Capture-related options frame */
+ capture_fr = gtk_frame_new("Capture");
+ gtk_container_add(GTK_CONTAINER(main_vb), capture_fr);
+ gtk_widget_show(capture_fr);
+
+ capture_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(capture_fr), capture_vb);
+ gtk_widget_show(capture_vb);
/* Interface row */
-
+ if_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(capture_vb), if_hb);
+ gtk_widget_show(if_hb);
+
if_lb = gtk_label_new("Interface:");
- gtk_table_attach_defaults(GTK_TABLE(table), if_lb, 0, 1, 0, 1);
+ gtk_box_pack_start(GTK_BOX(if_hb), if_lb, FALSE, FALSE, 6);
gtk_widget_show(if_lb);
if_cb = gtk_combo_new();
@@ -221,125 +236,89 @@ capture_prep_cb(GtkWidget *w, gpointer d)
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry), cfile.iface);
else if (if_list != NULL)
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry), if_list->data);
- gtk_table_attach_defaults(GTK_TABLE(table), if_cb, 1, 2, 0, 1);
+ gtk_box_pack_start(GTK_BOX(if_hb), if_cb, TRUE, TRUE, 6);
gtk_widget_show(if_cb);
free_interface_list(if_list);
- /* Count row */
-
- count_lb = gtk_label_new("Count:");
- gtk_table_attach_defaults(GTK_TABLE(table), count_lb, 0, 1, 1, 2);
- gtk_widget_show(count_lb);
-
- count_list = g_list_append(count_list, count_item1);
- if (cfile.count) {
- snprintf(count_item2, 15, "%d", cfile.count);
- count_list = g_list_append(count_list, count_item2);
- }
-
- count_cb = gtk_combo_new();
- gtk_combo_set_popdown_strings(GTK_COMBO(count_cb), count_list);
- gtk_table_attach_defaults(GTK_TABLE(table), count_cb, 1, 2, 1, 2);
- gtk_widget_show(count_cb);
-
- while (count_list)
- count_list = g_list_remove_link(count_list, count_list);
-
- /* Filesize row */
-
- filesize_lb = gtk_label_new("File size:");
- gtk_table_attach_defaults(GTK_TABLE(table), filesize_lb, 0, 1, 2, 3);
- gtk_widget_show(filesize_lb);
-
- filesize_list = g_list_append(filesize_list, filesize_item1);
- if (cfile.autostop_filesize) {
- snprintf(filesize_item2, 15, "%d", cfile.autostop_filesize);
- filesize_list = g_list_append(filesize_list, filesize_item2);
- }
-
- filesize_cb = gtk_combo_new();
- gtk_combo_set_popdown_strings(GTK_COMBO(filesize_cb), filesize_list);
- gtk_table_attach_defaults(GTK_TABLE(table), filesize_cb, 1, 2, 2, 3);
- gtk_widget_show(filesize_cb);
+ /* Capture length row */
+ snap_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(capture_vb), snap_hb);
+ gtk_widget_show(snap_hb);
- while (filesize_list)
- filesize_list = g_list_remove_link(filesize_list, filesize_list);
+ snap_cb = dlg_check_button_new_with_label_with_mnemonic(
+ "_Limit each packet to", accel_group);
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(snap_cb), has_snaplen);
+ gtk_signal_connect(GTK_OBJECT(snap_cb), "toggled",
+ GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w));
+ gtk_box_pack_start(GTK_BOX(snap_hb), snap_cb, FALSE, FALSE, 0);
+ gtk_widget_show(snap_cb);
- /* Duration row */
-
- duration_lb = gtk_label_new("Duration:");
- gtk_table_attach_defaults(GTK_TABLE(table), duration_lb, 0, 1, 3, 4);
- gtk_widget_show(duration_lb);
+ snap_adj = (GtkAdjustment *) gtk_adjustment_new((float) snaplen,
+ MIN_PACKET_SIZE, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ snap_sb = gtk_spin_button_new (snap_adj, 0, 0);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (snap_sb), TRUE);
+ gtk_widget_set_usize (snap_sb, 80, 0);
+ gtk_box_pack_start (GTK_BOX(snap_hb), snap_sb, FALSE, FALSE, 0);
+ gtk_widget_show(snap_sb);
- duration_list = g_list_append(duration_list, duration_item1);
- if (cfile.autostop_duration) {
- snprintf(duration_item2, 15, "%d", cfile.autostop_duration);
- duration_list = g_list_append(duration_list, duration_item2);
- }
-
- duration_cb = gtk_combo_new();
- gtk_combo_set_popdown_strings(GTK_COMBO(duration_cb), duration_list);
- gtk_table_attach_defaults(GTK_TABLE(table), duration_cb, 1, 2, 3, 4);
- gtk_widget_show(duration_cb);
+ snap_lb = gtk_label_new("bytes");
+ gtk_misc_set_alignment(GTK_MISC(snap_lb), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(snap_hb), snap_lb, FALSE, FALSE, 0);
+ gtk_widget_show(snap_lb);
- while (duration_list)
- duration_list = g_list_remove_link(duration_list, duration_list);
+ /* Promiscuous mode row */
+ promisc_cb = dlg_check_button_new_with_label_with_mnemonic(
+ "Capture packets in _promiscuous mode", accel_group);
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(promisc_cb), promisc_mode);
+ gtk_container_add(GTK_CONTAINER(capture_vb), promisc_cb);
+ gtk_widget_show(promisc_cb);
/* Filter row */
-
+ filter_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(capture_vb), filter_hb);
+ gtk_widget_show(filter_hb);
+
filter_bt = gtk_button_new_with_label("Filter:");
gtk_signal_connect(GTK_OBJECT(filter_bt), "clicked",
GTK_SIGNAL_FUNC(capture_filter_construct_cb), NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), filter_bt, 0, 1, 4, 5);
+ gtk_box_pack_start(GTK_BOX(filter_hb), filter_bt, FALSE, FALSE, 3);
gtk_widget_show(filter_bt);
filter_te = gtk_entry_new();
if (cfile.cfilter) gtk_entry_set_text(GTK_ENTRY(filter_te), cfile.cfilter);
gtk_object_set_data(GTK_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, filter_te);
- gtk_table_attach_defaults(GTK_TABLE(table), filter_te, 1, 2, 4, 5);
+ gtk_box_pack_start(GTK_BOX(filter_hb), filter_te, TRUE, TRUE, 3);
gtk_widget_show(filter_te);
+ /* File-related options frame */
+ file_fr = gtk_frame_new("Capture file(s)");
+ gtk_container_add(GTK_CONTAINER(main_vb), file_fr);
+ gtk_widget_show(file_fr);
+
+ file_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(file_fr), file_vb);
+ gtk_widget_show(file_vb);
+
/* File row */
-
+ file_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(file_vb), file_hb);
+ gtk_widget_show(file_hb);
+
file_bt = gtk_button_new_with_label("File:");
- gtk_table_attach_defaults(GTK_TABLE(table), file_bt, 0, 1, 5, 6);
+ gtk_box_pack_start(GTK_BOX(file_hb), file_bt, FALSE, FALSE, 3);
gtk_widget_show(file_bt);
file_te = gtk_entry_new();
- gtk_table_attach_defaults(GTK_TABLE(table), file_te, 1, 2, 5, 6);
+ gtk_box_pack_start(GTK_BOX(file_hb), file_te, TRUE, TRUE, 3);
gtk_widget_show(file_te);
gtk_signal_connect(GTK_OBJECT(file_bt), "clicked",
GTK_SIGNAL_FUNC(capture_prep_file_cb), GTK_OBJECT(file_te));
- /* Misc row: Snap spinbutton */
- caplen_hb = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(main_vb), caplen_hb);
- gtk_widget_show(caplen_hb);
-
- snap_lb = gtk_label_new("Capture length");
- gtk_misc_set_alignment(GTK_MISC(snap_lb), 0, 0.5);
- gtk_box_pack_start(GTK_BOX(caplen_hb), snap_lb, FALSE, FALSE, 6);
- gtk_widget_show(snap_lb);
-
- snap_adj = (GtkAdjustment *) gtk_adjustment_new((float) cfile.snap,
- MIN_PACKET_SIZE, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
- snap_sb = gtk_spin_button_new (snap_adj, 0, 0);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (snap_sb), TRUE);
- gtk_widget_set_usize (snap_sb, 80, 0);
- gtk_box_pack_start (GTK_BOX(caplen_hb), snap_sb, FALSE, FALSE, 3);
- gtk_widget_show(snap_sb);
-
- promisc_cb = dlg_check_button_new_with_label_with_mnemonic(
- "Capture packets in _promiscuous mode", accel_group);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(promisc_cb), promisc_mode);
- gtk_container_add(GTK_CONTAINER(main_vb), promisc_cb);
- gtk_widget_show(promisc_cb);
-
- /* Misc row: Ring buffer toggle button and Ring buffer spinbutton */
+ /* Ring buffer row */
ringbuffer_hb = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(main_vb), ringbuffer_hb);
+ gtk_container_add(GTK_CONTAINER(file_vb), ringbuffer_hb);
gtk_widget_show(ringbuffer_hb);
ringbuffer_on_tb = dlg_check_button_new_with_label_with_mnemonic(
@@ -368,40 +347,143 @@ capture_prep_cb(GtkWidget *w, gpointer d)
gtk_box_pack_start (GTK_BOX(ringbuffer_hb), ringbuffer_nbf_sb, TRUE, TRUE, 0);
gtk_widget_show(ringbuffer_nbf_sb);
- /* Misc row: Capture file checkboxes */
+ /* Display-related options frame */
+ display_fr = gtk_frame_new("Display options");
+ gtk_container_add(GTK_CONTAINER(main_vb), display_fr);
+ gtk_widget_show(display_fr);
+
+ display_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(display_fr), display_vb);
+ gtk_widget_show(display_vb);
+
+ /* "Update display in real time" row */
sync_cb = dlg_check_button_new_with_label_with_mnemonic(
"_Update list of packets in real time", accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sync_cb), sync_mode);
gtk_signal_connect(GTK_OBJECT(sync_cb), "toggled",
GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w));
- gtk_container_add(GTK_CONTAINER(main_vb), sync_cb);
+ gtk_container_add(GTK_CONTAINER(display_vb), sync_cb);
gtk_widget_show(sync_cb);
+ /* "Auto-scroll live update" row */
auto_scroll_cb = dlg_check_button_new_with_label_with_mnemonic(
"_Automatic scrolling in live capture", accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(auto_scroll_cb), auto_scroll_live);
- gtk_container_add(GTK_CONTAINER(main_vb), auto_scroll_cb);
+ gtk_container_add(GTK_CONTAINER(display_vb), auto_scroll_cb);
gtk_widget_show(auto_scroll_cb);
+ /* Capture limits frame */
+ limit_fr = gtk_frame_new("Capture limits");
+ gtk_container_add(GTK_CONTAINER(main_vb), limit_fr);
+ gtk_widget_show(limit_fr);
+
+ limit_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(limit_fr), limit_vb);
+ gtk_widget_show(limit_vb);
+
+ /* Count row */
+ count_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(limit_vb), count_hb);
+ gtk_widget_show(count_hb);
+
+ count_cb = gtk_check_button_new_with_label("Stop capture after");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(count_cb), FALSE);
+ gtk_signal_connect(GTK_OBJECT(count_cb), "toggled",
+ GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w));
+ gtk_box_pack_start(GTK_BOX(count_hb), count_cb, FALSE, FALSE, 0);
+ gtk_widget_show(count_cb);
+
+ count_adj = (GtkAdjustment *) gtk_adjustment_new(1,
+ 1, INT_MAX, 1.0, 10.0, 0.0);
+ count_sb = gtk_spin_button_new (count_adj, 0, 0);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (count_sb), TRUE);
+ gtk_widget_set_usize (count_sb, 80, 0);
+ gtk_box_pack_start (GTK_BOX(count_hb), count_sb, FALSE, FALSE, 0);
+ gtk_widget_show(count_sb);
+
+ count_lb = gtk_label_new("packet(s) captured");
+ gtk_misc_set_alignment(GTK_MISC(count_lb), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(count_hb), count_lb, FALSE, FALSE, 0);
+ gtk_widget_show(count_lb);
+
+ /* Filesize row */
+ filesize_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(limit_vb), filesize_hb);
+ gtk_widget_show(filesize_hb);
+
+ filesize_cb = gtk_check_button_new_with_label("");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(filesize_cb), FALSE);
+ gtk_signal_connect(GTK_OBJECT(filesize_cb), "toggled",
+ GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w));
+ gtk_box_pack_start(GTK_BOX(filesize_hb), filesize_cb, FALSE, FALSE, 0);
+ gtk_widget_show(filesize_cb);
+
+ filesize_adj = (GtkAdjustment *) gtk_adjustment_new(1,
+ 1, INT_MAX, 1.0, 10.0, 0.0);
+ filesize_sb = gtk_spin_button_new (filesize_adj, 0, 0);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (filesize_sb), TRUE);
+ gtk_widget_set_usize (filesize_sb, 80, 0);
+ gtk_box_pack_start (GTK_BOX(filesize_hb), filesize_sb, FALSE, FALSE, 0);
+ gtk_widget_show(filesize_sb);
+
+ filesize_lb = gtk_label_new("");
+ gtk_misc_set_alignment(GTK_MISC(filesize_lb), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(filesize_hb), filesize_lb, FALSE, FALSE, 0);
+ gtk_widget_show(filesize_lb);
+
+ /* Duration row */
+ duration_hb = gtk_hbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(limit_vb), duration_hb);
+ gtk_widget_show(duration_hb);
+
+ duration_cb = gtk_check_button_new_with_label("Stop capture after");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(duration_cb), FALSE);
+ gtk_signal_connect(GTK_OBJECT(duration_cb), "toggled",
+ GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w));
+ gtk_box_pack_start(GTK_BOX(duration_hb), duration_cb, FALSE, FALSE, 0);
+ gtk_widget_show(duration_cb);
+
+ duration_adj = (GtkAdjustment *) gtk_adjustment_new(1,
+ 1, INT_MAX, 1.0, 10.0, 0.0);
+ duration_sb = gtk_spin_button_new (duration_adj, 0, 0);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (duration_sb), TRUE);
+ gtk_widget_set_usize (duration_sb, 80, 0);
+ gtk_box_pack_start (GTK_BOX(duration_hb), duration_sb, FALSE, FALSE, 0);
+ gtk_widget_show(duration_sb);
+
+ duration_lb = gtk_label_new("second(s)");
+ gtk_misc_set_alignment(GTK_MISC(duration_lb), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(duration_hb), duration_lb, FALSE, FALSE, 0);
+ gtk_widget_show(duration_lb);
+
+ /* Resolution options frame */
+ resolv_fr = gtk_frame_new("Name resolution");
+ gtk_container_add(GTK_CONTAINER(main_vb), resolv_fr);
+ gtk_widget_show(resolv_fr);
+
+ resolv_vb = gtk_vbox_new(FALSE, 3);
+ gtk_container_add(GTK_CONTAINER(resolv_fr), resolv_vb);
+ gtk_widget_show(resolv_vb);
+
m_resolv_cb = dlg_check_button_new_with_label_with_mnemonic(
"Enable _MAC name resolution", accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(m_resolv_cb),
g_resolv_flags & RESOLV_MAC);
- gtk_container_add(GTK_CONTAINER(main_vb), m_resolv_cb);
+ gtk_container_add(GTK_CONTAINER(resolv_vb), m_resolv_cb);
gtk_widget_show(m_resolv_cb);
n_resolv_cb = dlg_check_button_new_with_label_with_mnemonic(
"Enable _network name resolution", accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(n_resolv_cb),
g_resolv_flags & RESOLV_NETWORK);
- gtk_container_add(GTK_CONTAINER(main_vb), n_resolv_cb);
+ gtk_container_add(GTK_CONTAINER(resolv_vb), n_resolv_cb);
gtk_widget_show(n_resolv_cb);
t_resolv_cb = dlg_check_button_new_with_label_with_mnemonic(
"Enable _transport name resolution", accel_group);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(t_resolv_cb),
g_resolv_flags & RESOLV_TRANSPORT);
- gtk_container_add(GTK_CONTAINER(main_vb), t_resolv_cb);
+ gtk_container_add(GTK_CONTAINER(resolv_vb), t_resolv_cb);
gtk_widget_show(t_resolv_cb);
/* Button row: OK and cancel buttons */
@@ -428,21 +510,26 @@ capture_prep_cb(GtkWidget *w, gpointer d)
/* Attach pointers to needed widgets to the capture prefs window/object */
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_IFACE_KEY, if_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_SNAP_CB_KEY, snap_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_SNAP_SB_KEY, snap_sb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_PROMISC_KEY, promisc_cb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILT_KEY, filter_te);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILE_TE_KEY, file_te);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_COUNT_KEY, count_cb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_SNAP_KEY, snap_sb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_PROMISC_KEY, promisc_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_ON_TB_KEY, ringbuffer_on_tb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_NBF_LB_KEY, ringbuffer_nbf_lb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_NBF_SB_KEY, ringbuffer_nbf_sb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_SYNC_KEY, sync_cb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_AUTO_SCROLL_KEY, auto_scroll_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_COUNT_CB_KEY, count_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_COUNT_SB_KEY, count_sb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILESIZE_CB_KEY, filesize_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILESIZE_SB_KEY, filesize_sb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILESIZE_LB_KEY, filesize_lb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_DURATION_CB_KEY, duration_cb);
+ gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_DURATION_SB_KEY, duration_sb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_M_RESOLVE_KEY, m_resolv_cb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_N_RESOLVE_KEY, n_resolv_cb);
gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_T_RESOLVE_KEY, t_resolv_cb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_FILESIZE_KEY, filesize_cb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_DURATION_KEY, duration_cb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_ON_TB_KEY, ringbuffer_on_tb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_NBF_LB_KEY, ringbuffer_nbf_lb);
- gtk_object_set_data(GTK_OBJECT(cap_open_w), E_CAP_RING_NBF_SB_KEY, ringbuffer_nbf_sb);
/* Set the sensitivity of various widgets as per the settings of other
widgets. */
@@ -596,9 +683,13 @@ get_positive_int(const char *string, const char *name)
static void
capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
- GtkWidget *if_cb, *filter_te, *file_te, *count_cb, *snap_sb, *promisc_cb,
- *sync_cb, *auto_scroll_cb, *m_resolv_cb, *n_resolv_cb, *t_resolv_cb,
- *filesize_cb, *duration_cb, *ringbuffer_on_tb, *ringbuffer_nbf_sb;
+ GtkWidget *if_cb, *snap_cb, *snap_sb, *promisc_cb, *filter_te,
+ *file_te, *ringbuffer_on_tb, *ringbuffer_nbf_sb,
+ *sync_cb, *auto_scroll_cb,
+ *count_cb, *count_sb,
+ *filesize_cb, *filesize_sb,
+ *duration_cb, *duration_sb,
+ *m_resolv_cb, *n_resolv_cb, *t_resolv_cb;
gchar *if_text;
gchar *if_name;
gchar *filter_text;
@@ -606,20 +697,24 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
int value;
if_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_IFACE_KEY);
+ snap_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SNAP_CB_KEY);
+ snap_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SNAP_SB_KEY);
+ promisc_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_PROMISC_KEY);
filter_te = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILT_KEY);
file_te = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILE_TE_KEY);
- count_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_COUNT_KEY);
- snap_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SNAP_KEY);
- promisc_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_PROMISC_KEY);
+ ringbuffer_on_tb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_ON_TB_KEY);
+ ringbuffer_nbf_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_NBF_SB_KEY);
sync_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SYNC_KEY);
auto_scroll_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_AUTO_SCROLL_KEY);
+ count_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_COUNT_CB_KEY);
+ count_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_COUNT_SB_KEY);
+ filesize_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_CB_KEY);
+ filesize_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_SB_KEY);
+ duration_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_DURATION_CB_KEY);
+ duration_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_DURATION_SB_KEY);
m_resolv_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_M_RESOLVE_KEY);
n_resolv_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_N_RESOLVE_KEY);
t_resolv_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_T_RESOLVE_KEY);
- filesize_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_KEY);
- duration_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_DURATION_KEY);
- ringbuffer_on_tb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_ON_TB_KEY);
- ringbuffer_nbf_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_NBF_SB_KEY);
if_text =
g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(if_cb)->entry)));
@@ -635,6 +730,17 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
cfile.iface = g_strdup(if_name);
g_free(if_text);
+ has_snaplen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(snap_cb));
+ if (has_snaplen) {
+ has_snaplen = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(snap_sb));
+ if (has_snaplen < 1)
+ has_snaplen = WTAP_MAX_PACKET_SIZE;
+ else if (has_snaplen < MIN_PACKET_SIZE)
+ has_snaplen = MIN_PACKET_SIZE;
+ }
+
+ promisc_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(promisc_cb));
+
/* XXX - don't try to get clever and set "cfile.filter" to NULL if the
filter string is empty, as an indication that we don't have a filter
and thus don't have to set a filter when capturing - the version of
@@ -658,42 +764,38 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
save_file = NULL;
}
- value = get_positive_int(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(count_cb)->entry)),
- "maximum packet count");
- if (value == -1)
- return; /* error */
- cfile.count = value;
-
- value = get_positive_int(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(filesize_cb)->entry)),
- "maximum capture file size");
- if (value == -1)
- return; /* error */
- cfile.autostop_filesize = value;
-
- value = get_positive_int(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(duration_cb)->entry)),
- "capture duration");
- if (value == -1)
- return; /* error */
- cfile.autostop_duration = value;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(count_cb)))
+ cfile.count = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(count_sb));
+ else
+ cfile.count = 0; /* no limit */
- cfile.snap = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(snap_sb));
- if (cfile.snap < 1)
- cfile.snap = WTAP_MAX_PACKET_SIZE;
- else if (cfile.snap < MIN_PACKET_SIZE)
- cfile.snap = MIN_PACKET_SIZE;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filesize_cb))) {
+ cfile.autostop_filesize =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(filesize_sb));
+ } else
+ cfile.autostop_filesize = 0; /* no limit */
- promisc_mode = GTK_TOGGLE_BUTTON (promisc_cb)->active;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(duration_cb))) {
+ cfile.autostop_duration =
+ gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(duration_sb));
+ } else
+ cfile.autostop_duration = 0; /* no limit */
- sync_mode = GTK_TOGGLE_BUTTON (sync_cb)->active;
+ sync_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sync_cb));
- auto_scroll_live = GTK_TOGGLE_BUTTON (auto_scroll_cb)->active;
+ auto_scroll_live =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(auto_scroll_cb));
g_resolv_flags = RESOLV_NONE;
- g_resolv_flags |= (GTK_TOGGLE_BUTTON (m_resolv_cb)->active ? RESOLV_MAC : RESOLV_NONE);
- g_resolv_flags |= (GTK_TOGGLE_BUTTON (n_resolv_cb)->active ? RESOLV_NETWORK : RESOLV_NONE);
- g_resolv_flags |= (GTK_TOGGLE_BUTTON (t_resolv_cb)->active ? RESOLV_TRANSPORT : RESOLV_NONE);
-
- cfile.ringbuffer_on = GTK_TOGGLE_BUTTON (ringbuffer_on_tb)->active && !(sync_mode);
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_resolv_cb)))
+ g_resolv_flags |= RESOLV_MAC;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(n_resolv_cb)))
+ g_resolv_flags |= RESOLV_NETWORK;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t_resolv_cb)))
+ g_resolv_flags |= RESOLV_TRANSPORT;
+
+ cfile.ringbuffer_on =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ringbuffer_on_tb)) && !(sync_mode);
if (cfile.ringbuffer_on == TRUE) {
if (save_file == NULL) {
simple_dialog(ESD_TYPE_CRIT, NULL,
@@ -701,7 +803,8 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
return;
} else if (cfile.autostop_filesize == 0) {
simple_dialog(ESD_TYPE_CRIT, NULL,
- "You must specify a maximum save file size other \nthan 0 (infinite) if you want to use the ring buffer.");
+ "You must specify a file size at which to rotate the capture files\n"
+ "if you want to use the ring buffer.");
return;
}
}
@@ -759,14 +862,32 @@ capture_prep_destroy_cb(GtkWidget *win, gpointer user_data)
static void
capture_prep_adjust_sensitivity(GtkWidget *tb, gpointer parent_w)
{
- GtkWidget *sync_cb, *auto_scroll_cb, *ringbuffer_on_tb;
- GtkWidget *ringbuffer_nbf_lb, *ringbuffer_nbf_sb;
-
- sync_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SYNC_KEY);
- auto_scroll_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_AUTO_SCROLL_KEY);
+ GtkWidget *snap_cb, *snap_sb,
+ *ringbuffer_on_tb, *ringbuffer_nbf_lb, *ringbuffer_nbf_sb,
+ *sync_cb, *auto_scroll_cb,
+ *count_cb, *count_sb,
+ *filesize_cb, *filesize_sb, *filesize_lb,
+ *duration_cb, *duration_sb;
+
+ snap_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SNAP_CB_KEY);
+ snap_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SNAP_SB_KEY);
ringbuffer_on_tb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_ON_TB_KEY);
ringbuffer_nbf_lb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_NBF_LB_KEY);
ringbuffer_nbf_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_RING_NBF_SB_KEY);
+ sync_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_SYNC_KEY);
+ auto_scroll_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_AUTO_SCROLL_KEY);
+ count_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_COUNT_CB_KEY);
+ count_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_COUNT_SB_KEY);
+ filesize_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_CB_KEY);
+ filesize_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_SB_KEY);
+ filesize_lb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_FILESIZE_LB_KEY);
+ duration_cb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_DURATION_CB_KEY);
+ duration_sb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_CAP_DURATION_SB_KEY);
+
+ /* The snapshot length spinbox is sensitive iff the "Limit each packet
+ to" checkbox is on. */
+ gtk_widget_set_sensitive(GTK_WIDGET(snap_sb),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(snap_cb)));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sync_cb))) {
/* "Update list of packets in real time" captures enabled; we don't
@@ -798,12 +919,41 @@ capture_prep_adjust_sensitivity(GtkWidget *tb, gpointer parent_w)
of ring buffer files, and its label, sensitive. */
gtk_widget_set_sensitive(GTK_WIDGET(ringbuffer_nbf_lb), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(ringbuffer_nbf_sb), TRUE);
+
+ /* Also, indicate that the file size is a size at which to switch
+ ring buffer files, not a size at which to stop the capture,
+ turn its button on. */
+ gtk_label_set_text(GTK_LABEL(GTK_BIN(filesize_cb)->child),
+ "Rotate capture file every");
+ gtk_label_set_text(GTK_LABEL(filesize_lb), "kilobyte(s)");
+ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(filesize_cb), TRUE);
} else {
/* Ring buffer mode disabled. Make the spin button for the number
of ring buffer files, and its label insensitive. */
gtk_widget_set_sensitive(GTK_WIDGET(ringbuffer_nbf_lb), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(ringbuffer_nbf_sb), FALSE);
+
+ /* Also, indicate that the file size is a size at which to stop the
+ capture, not a size at which to switch ring buffer files. */
+ gtk_label_set_text(GTK_LABEL(GTK_BIN(filesize_cb)->child),
+ "Stop capture after");
+ gtk_label_set_text(GTK_LABEL(filesize_lb), "kilobyte(s) captured");
}
+
+ /* The maximum packet count spinbox is sensitive iff the "Stop capture
+ after N packets captured" checkbox is on. */
+ gtk_widget_set_sensitive(GTK_WIDGET(count_sb),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(count_cb)));
+
+ /* The maximum file size spinbox is sensitive iff the "Stop capture
+ after N kilobytes captured" checkbox is on. */
+ gtk_widget_set_sensitive(GTK_WIDGET(filesize_sb),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filesize_cb)));
+
+ /* The capture duration spinbox is sensitive iff the "Stop capture
+ after N seconds" checkbox is on. */
+ gtk_widget_set_sensitive(GTK_WIDGET(duration_sb),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(duration_cb)));
}
#endif /* HAVE_LIBPCAP */
diff --git a/gtk/main.c b/gtk/main.c
index 68d0fabbab..5e507f4001 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.231 2002/01/21 07:37:41 guy Exp $
+ * $Id: main.c,v 1.232 2002/02/08 10:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1289,6 +1289,9 @@ main(int argc, char *argv[])
prefs = read_prefs(&gpf_open_errno, &gpf_path, &pf_open_errno, &pf_path);
#ifdef HAVE_LIBPCAP
+ has_snaplen = FALSE;
+ snaplen = MIN_PACKET_SIZE;
+
/* If this is a capture child process, it should pay no attention
to the "prefs.capture_prom_mode" setting in the preferences file;
it should do what the parent process tells it to do, and if
@@ -1334,6 +1337,7 @@ main(int argc, char *argv[])
cfile.iface = NULL;
cfile.save_file = NULL;
cfile.save_file_fd = -1;
+ cfile.has_snap = FALSE;
cfile.snap = WTAP_MAX_PACKET_SIZE;
cfile.count = 0;
#ifdef HAVE_LIBPCAP
@@ -1543,7 +1547,8 @@ main(int argc, char *argv[])
break;
case 's': /* Set the snapshot (capture) length */
#ifdef HAVE_LIBPCAP
- cfile.snap = get_positive_int(optarg, "snapshot length");
+ has_snaplen = TRUE;
+ snaplen = get_positive_int(optarg, "snapshot length");
#else
capture_option_specified = TRUE;
arg_error = TRUE;
@@ -1751,10 +1756,12 @@ main(int argc, char *argv[])
}
#ifdef HAVE_LIBPCAP
- if (cfile.snap < 1)
- cfile.snap = WTAP_MAX_PACKET_SIZE;
- else if (cfile.snap < MIN_PACKET_SIZE)
- cfile.snap = MIN_PACKET_SIZE;
+ if (has_snaplen) {
+ if (snaplen < 1)
+ snaplen = WTAP_MAX_PACKET_SIZE;
+ else if (snaplen < MIN_PACKET_SIZE)
+ snaplen = MIN_PACKET_SIZE;
+ }
/* Check the value range of the ringbuffer_num_files parameter */
if (cfile.ringbuffer_num_files < RINGBUFFER_MIN_NUM_FILES)
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index b0b313cd51..58dc208f00 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -1,7 +1,7 @@
/* summary_dlg.c
* Routines for capture file summary window
*
- * $Id: summary_dlg.c,v 1.10 2001/12/12 21:38:59 gerald Exp $
+ * $Id: summary_dlg.c,v 1.11 2002/02/08 10:07:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -106,9 +106,11 @@ summary_open_cb(GtkWidget *w, gpointer d)
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);
+ if (summary.has_snap) {
+ /* 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");
diff --git a/mergecap.c b/mergecap.c
index 79966f5dfb..d5ce6c63d1 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -1,6 +1,6 @@
/* Combine two dump files, either by appending or by merging by timestamp
*
- * $Id: mergecap.c,v 1.5 2001/10/04 08:30:33 guy Exp $
+ * $Id: mergecap.c,v 1.6 2002/02/08 10:07:34 guy Exp $
*
* Written by Scott Renfro <scott@renfro.org> based on
* editcap by Richard Sharpe and Guy Harris
@@ -275,10 +275,16 @@ max_snapshot_length(int count, in_file_t in_files[])
{
int i;
int max_snapshot = 0;
+ int snapshot_length;
for (i = 0; i < count; i++) {
- if (wtap_snapshot_length(in_files[i].wth) > max_snapshot)
- max_snapshot = wtap_snapshot_length(in_files[i].wth);
+ snapshot_length = wtap_snapshot_length(in_files[i].wth);
+ if (snapshot_length == 0) {
+ /* Snapshot length of input file not known. */
+ snapshot_length = WTAP_MAX_PACKET_SIZE;
+ }
+ if (snapshot_length > max_snapshot)
+ max_snapshot = snapshot_length;
}
return max_snapshot;
}
diff --git a/summary.c b/summary.c
index 180b3747a4..b10d632afe 100644
--- a/summary.c
+++ b/summary.c
@@ -1,7 +1,7 @@
/* summary.c
* Routines for capture file summary info
*
- * $Id: summary.c,v 1.21 2002/01/21 07:36:48 guy Exp $
+ * $Id: summary.c,v 1.22 2002/02/08 10:07:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -89,6 +89,7 @@ summary_fill_in(summary_tally *st)
st->filename = cfile.filename;
st->file_length = cfile.f_len;
st->encap_type = cfile.cd_t;
+ st->has_snap = cfile.has_snap;
st->snap = cfile.snap;
st->elapsed_time = secs_usecs(cfile.esec, cfile.eusec);
st->packet_count = cfile.count;
diff --git a/summary.h b/summary.h
index c12d27c9d2..7f03594033 100644
--- a/summary.h
+++ b/summary.h
@@ -1,7 +1,7 @@
/* summary.h
* Definitions for capture file summary data
*
- * $Id: summary.h,v 1.6 2001/02/11 09:28:15 guy Exp $
+ * $Id: summary.h,v 1.7 2002/02/08 10:07:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -39,7 +39,8 @@ typedef struct _summary_tally {
const char *filename;
long file_length; /* file length in bytes */
int encap_type; /* wiretap encapsulation type */
- int snap; /* snapshot length */
+ gboolean has_snap; /* TRUE if maximum capture packet length is known */
+ int snap; /* Maximum captured packet length */
gboolean drops_known; /* TRUE if number of packet drops is known */
guint32 drops; /* number of packet drops */
const char *iface; /* interface name */
diff --git a/tethereal.c b/tethereal.c
index 6ef3224a9b..4914ff10b2 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.120 2002/01/29 05:38:55 guy Exp $
+ * $Id: tethereal.c,v 1.121 2002/02/08 10:07:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -154,6 +154,7 @@ capture_file cfile;
FILE *data_out_file = NULL;
ts_type timestamp_type = RELATIVE;
#ifdef HAVE_LIBPCAP
+static int snaplen = WTAP_MAX_PACKET_SIZE;
static int promisc_mode = TRUE;
#endif
@@ -349,6 +350,7 @@ main(int argc, char *argv[])
cfile.iface = NULL;
cfile.save_file = NULL;
cfile.save_file_fd = -1;
+ cfile.has_snap = FALSE;
cfile.snap = WTAP_MAX_PACKET_SIZE;
cfile.count = 0;
#ifdef HAVE_LIBPCAP
@@ -558,7 +560,7 @@ main(int argc, char *argv[])
break;
case 's': /* Set the snapshot (capture) length */
#ifdef HAVE_LIBPCAP
- cfile.snap = get_positive_int(optarg, "snapshot length");
+ snaplen = get_positive_int(optarg, "snapshot length");
#else
capture_option_specified = TRUE;
arg_error = TRUE;
@@ -688,10 +690,10 @@ main(int argc, char *argv[])
}
#ifdef HAVE_LIBPCAP
- if (cfile.snap < 1)
- cfile.snap = WTAP_MAX_PACKET_SIZE;
- else if (cfile.snap < MIN_PACKET_SIZE)
- cfile.snap = MIN_PACKET_SIZE;
+ if (snaplen < 1)
+ snaplen = WTAP_MAX_PACKET_SIZE;
+ else if (snaplen < MIN_PACKET_SIZE)
+ snaplen = MIN_PACKET_SIZE;
/* Check the value range of the ringbuffer_num_files parameter */
if (cfile.ringbuffer_num_files < RINGBUFFER_MIN_NUM_FILES)
@@ -819,7 +821,7 @@ capture(volatile int packet_count, int out_file_type)
if they succeed; to tell if that's happened, we have to clear
the error buffer, and check if it's still a null string. */
open_err_str[0] = '\0';
- ld.pch = pcap_open_live(cfile.iface, cfile.snap, promisc_mode, 1000,
+ ld.pch = pcap_open_live(cfile.iface, snaplen, promisc_mode, 1000,
open_err_str);
if (ld.pch == NULL) {
@@ -1079,6 +1081,7 @@ static int
load_cap_file(capture_file *cf, int out_file_type)
{
gint linktype;
+ int snapshot_length;
wtap_dumper *pdh;
int err;
int success;
@@ -1087,8 +1090,13 @@ load_cap_file(capture_file *cf, int out_file_type)
linktype = wtap_file_encap(cf->wth);
if (cf->save_file != NULL) {
/* Set up to write to the capture file. */
+ snapshot_length = wtap_snapshot_length(cf->wth);
+ if (snapshot_length == 0) {
+ /* Snapshot length of input file not known. */
+ snapshot_length = WTAP_MAX_PACKET_SIZE;
+ }
pdh = wtap_dump_open(cf->save_file, out_file_type,
- linktype, wtap_snapshot_length(cf->wth), &err);
+ linktype, snapshot_length, &err);
if (pdh == NULL) {
/* We couldn't set up to write to the capture file. */
@@ -1760,6 +1768,12 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
cf->esec = 0;
cf->eusec = 0;
cf->snap = wtap_snapshot_length(cf->wth);
+ if (cf->snap == 0) {
+ /* Snapshot length not known. */
+ cf->has_snap = FALSE;
+ cf->snap = WTAP_MAX_PACKET_SIZE;
+ } else
+ cf->has_snap = TRUE;
cf->progbar_quantum = 0;
cf->progbar_nextstep = 0;
firstsec = 0, firstusec = 0;
diff --git a/wiretap/csids.c b/wiretap/csids.c
index 35425d4ce9..3f1dd461a6 100644
--- a/wiretap/csids.c
+++ b/wiretap/csids.c
@@ -1,6 +1,6 @@
/* csids.c
*
- * $Id: csids.c,v 1.8 2001/10/04 08:30:35 guy Exp $
+ * $Id: csids.c,v 1.9 2002/02/08 10:07:40 guy Exp $
*
* Copyright (c) 2000 by Mike Hall <mlh@io.com>
* Copyright (c) 2000 by Cisco Systems
@@ -127,7 +127,7 @@ int csids_open(wtap *wth, int *err)
wth->capture.csids->byteswapped = byteswap;
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_CSIDS;
- wth->snapshot_length = 16384; /* just guessing */
+ wth->snapshot_length = 0; /* not known */
wth->subtype_read = csids_read;
wth->subtype_seek_read = csids_seek_read;
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c
index 4bc7707940..1bd1c94941 100644
--- a/wiretap/dbs-etherwatch.c
+++ b/wiretap/dbs-etherwatch.c
@@ -1,6 +1,6 @@
/* dbs-etherwatch.c
*
- * $Id: dbs-etherwatch.c,v 1.2 2002/01/08 22:30:29 guy Exp $
+ * $Id: dbs-etherwatch.c,v 1.3 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 2001 by Marc Milgram <mmilgram@arrayinc.com>
@@ -70,6 +70,11 @@ static const char dbs_etherwatch_rec_magic[] =
#define DBS_ETHERWATCH_REC_MAGIC_SIZE \
(sizeof dbs_etherwatch_rec_magic / sizeof dbs_etherwatch_rec_magic[0])
+/*
+ * XXX - is this the biggest packet we can get?
+ */
+#define DBS_ETHERWATCH_MAX_PACKET_LEN 16384
+
static gboolean dbs_etherwatch_read(wtap *wth, int *err, long *data_offset);
static int dbs_etherwatch_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
@@ -155,7 +160,7 @@ int dbs_etherwatch_open(wtap *wth, int *err)
wth->data_offset = 0;
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_DBS_ETHERWATCH;
- wth->snapshot_length = 16384; /* just guessing */
+ wth->snapshot_length = 0; /* not known */
wth->subtype_read = dbs_etherwatch_read;
wth->subtype_seek_read = dbs_etherwatch_seek_read;
@@ -180,7 +185,7 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, long *data_offset)
pkt_len = parse_dbs_etherwatch_rec_hdr(wth, wth->fh, err);
/* Make sure we have enough room for the packet */
- buffer_assure_space(wth->frame_buffer, wth->snapshot_length);
+ buffer_assure_space(wth->frame_buffer, DBS_ETHERWATCH_MAX_PACKET_LEN);
buf = buffer_start_ptr(wth->frame_buffer);
/* Convert the ASCII hex dump to binary data */
diff --git a/wiretap/etherpeek.c b/wiretap/etherpeek.c
index 6844e26e3a..6e99adb7c8 100644
--- a/wiretap/etherpeek.c
+++ b/wiretap/etherpeek.c
@@ -2,7 +2,7 @@
* Routines for opening EtherPeek (and TokenPeek?) files
* Copyright (c) 2001, Daniel Thompson <d.thompson@gmx.net>
*
- * $Id: etherpeek.c,v 1.14 2002/01/29 09:45:58 guy Exp $
+ * $Id: etherpeek.c,v 1.15 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -314,7 +314,7 @@ int etherpeek_open(wtap *wth, int *err)
g_assert_not_reached();
}
- wth->snapshot_length = 16384; /* just guessing */
+ wth->snapshot_length = 0; /* not available in header */
return 1;
}
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index 55059f1d28..7b4b88c380 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -1,6 +1,6 @@
/* i4btrace.c
*
- * $Id: i4btrace.c,v 1.15 2001/10/04 08:30:35 guy Exp $
+ * $Id: i4btrace.c,v 1.16 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -98,7 +98,7 @@ int i4btrace_open(wtap *wth, int *err)
wth->capture.i4btrace = g_malloc(sizeof(i4btrace_t));
wth->subtype_read = i4btrace_read;
wth->subtype_seek_read = i4btrace_seek_read;
- wth->snapshot_length = 2048; /* actual length set per packet */
+ wth->snapshot_length = 0; /* not known */
wth->capture.i4btrace->bchannel_prot[0] = -1;
wth->capture.i4btrace->bchannel_prot[1] = -1;
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 1c864e84b5..cae0d77fb5 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -1,6 +1,6 @@
/* netmon.c
*
- * $Id: netmon.c,v 1.46 2002/01/25 09:44:52 guy Exp $
+ * $Id: netmon.c,v 1.47 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -205,7 +205,7 @@ int netmon_open(wtap *wth, int *err)
wth->subtype_seek_read = netmon_seek_read;
wth->subtype_close = netmon_close;
wth->file_encap = netmon_encap[hdr.network];
- wth->snapshot_length = 16384; /* XXX - not available in header */
+ wth->snapshot_length = 0; /* not available in header */
/*
* Convert the time stamp to a "time_t" and a number of
* milliseconds.
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 31fd67144f..8ebe1a0523 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -1,6 +1,6 @@
/* nettl.c
*
- * $Id: nettl.c,v 1.21 2001/11/13 23:55:43 gram Exp $
+ * $Id: nettl.c,v 1.22 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -118,7 +118,7 @@ int nettl_open(wtap *wth, int *err)
wth->subtype_read = nettl_read;
wth->subtype_seek_read = nettl_seek_read;
wth->subtype_close = nettl_close;
- wth->snapshot_length = 16384; /* not available in header, only in frame */
+ wth->snapshot_length = 0; /* not available in header, only in frame */
return 1;
}
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index f864b48bd9..7f0f6fe1ba 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1,6 +1,6 @@
/* netxray.c
*
- * $Id: netxray.c,v 1.43 2001/11/13 23:55:43 gram Exp $
+ * $Id: netxray.c,v 1.44 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -206,7 +206,7 @@ int netxray_open(wtap *wth, int *err)
wth->subtype_seek_read = wtap_def_seek_read;
wth->subtype_close = netxray_close;
wth->file_encap = netxray_encap[hdr.network];
- wth->snapshot_length = 16384; /* XXX - not available in header */
+ wth->snapshot_length = 0; /* not available in header */
wth->capture.netxray->start_time = pletohl(&hdr.start_time);
wth->capture.netxray->timeunit = timeunit;
t = (double)pletohl(&hdr.timelo)
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 43f7cb6e6a..9441be3789 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.70 2002/01/11 02:51:31 guy Exp $
+ * $Id: ngsniffer.c,v 1.71 2002/02/08 10:07:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -483,7 +483,7 @@ int ngsniffer_open(wtap *wth, int *err)
wth->subtype_seek_read = ngsniffer_seek_read;
wth->subtype_sequential_close = ngsniffer_sequential_close;
wth->subtype_close = ngsniffer_close;
- wth->snapshot_length = 16384; /* not available in header, only in frame */
+ wth->snapshot_length = 0; /* not available in header, only in frame */
wth->capture.ngsniffer->timeunit = Usec[version.timeunit];
wth->capture.ngsniffer->is_atm =
(wth->file_encap == WTAP_ENCAP_ATM_SNIFFER);
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 1f1a855b4e..e25ea3f014 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -1,6 +1,6 @@
/* radcom.c
*
- * $Id: radcom.c,v 1.31 2001/11/13 23:55:44 gram Exp $
+ * $Id: radcom.c,v 1.32 2002/02/08 10:07:41 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -137,7 +137,7 @@ int radcom_open(wtap *wth, int *err)
wth->file_type = WTAP_FILE_RADCOM;
wth->subtype_read = radcom_read;
wth->subtype_seek_read = radcom_seek_read;
- wth->snapshot_length = 16384; /* not available in header, only in frame */
+ wth->snapshot_length = 0; /* not available in header, only in frame */
tm.tm_year = pletohs(&start_date.year)-1900;
tm.tm_mon = start_date.month-1;
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index 9cf54ee346..1738b713bf 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -1,6 +1,6 @@
/* snoop.c
*
- * $Id: snoop.c,v 1.39 2001/11/13 23:55:44 gram Exp $
+ * $Id: snoop.c,v 1.40 2002/02/08 10:07:41 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -289,7 +289,7 @@ int snoop_open(wtap *wth, int *err)
wth->subtype_read = snoop_read;
wth->subtype_seek_read = snoop_seek_read;
wth->file_encap = file_encap;
- wth->snapshot_length = 16384; /* XXX - not available in header */
+ wth->snapshot_length = 0; /* not available in header */
return 1;
}
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
index 76479ce4f0..b5b0f895a2 100644
--- a/wiretap/toshiba.c
+++ b/wiretap/toshiba.c
@@ -1,6 +1,6 @@
/* toshiba.c
*
- * $Id: toshiba.c,v 1.19 2001/12/08 07:46:54 guy Exp $
+ * $Id: toshiba.c,v 1.20 2002/02/08 10:07:41 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -104,6 +104,11 @@ static const char toshiba_hdr_magic[] =
static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' };
#define TOSHIBA_REC_MAGIC_SIZE (sizeof toshiba_rec_magic / sizeof toshiba_rec_magic[0])
+/*
+ * XXX - is this the biggest packet we can get?
+ */
+#define TOSHIBA_MAX_PACKET_LEN 16384
+
static gboolean toshiba_read(wtap *wth, int *err, long *data_offset);
static int toshiba_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
@@ -191,7 +196,7 @@ int toshiba_open(wtap *wth, int *err)
wth->data_offset = 0;
wth->file_encap = WTAP_ENCAP_PER_PACKET;
wth->file_type = WTAP_FILE_TOSHIBA;
- wth->snapshot_length = 16384; /* just guessing */
+ wth->snapshot_length = 0; /* not known */
wth->subtype_read = toshiba_read;
wth->subtype_seek_read = toshiba_seek_read;
@@ -217,7 +222,7 @@ static gboolean toshiba_read(wtap *wth, int *err, long *data_offset)
&wth->pseudo_header, err);
/* Make sure we have enough room for the packet */
- buffer_assure_space(wth->frame_buffer, wth->snapshot_length);
+ buffer_assure_space(wth->frame_buffer, TOSHIBA_MAX_PACKET_LEN);
buf = buffer_start_ptr(wth->frame_buffer);
/* Convert the ASCII hex dump to binary data */
diff --git a/wiretap/vms.c b/wiretap/vms.c
index 57327d11a8..794a2e76dd 100644
--- a/wiretap/vms.c
+++ b/wiretap/vms.c
@@ -1,6 +1,6 @@
/* vms.c
*
- * $Id: vms.c,v 1.5 2002/01/30 18:58:04 guy Exp $
+ * $Id: vms.c,v 1.6 2002/02/08 10:07:41 guy Exp $
*
* Wiretap Library
* Copyright (c) 2001 by Marc Milgram <mmilgram@arrayinc.com>
@@ -165,7 +165,7 @@ int vms_open(wtap *wth, int *err)
wth->data_offset = 0;
wth->file_encap = WTAP_ENCAP_RAW_IP;
wth->file_type = WTAP_FILE_VMS;
- wth->snapshot_length = 16384; /* just guessing */
+ wth->snapshot_length = 0; /* not known */
wth->subtype_read = vms_read;
wth->subtype_seek_read = vms_seek_read;