summaryrefslogtreecommitdiff
path: root/wiretap
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 /wiretap
parentad1ce4a43d656ac7ef4a418317417fe503162636 (diff)
downloadwireshark-89a4acb4389e07e335aa8fbe791c223b533c0de1.tar.gz
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
Diffstat (limited to 'wiretap')
-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
12 files changed, 36 insertions, 26 deletions
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;