Commit Graph

82 Commits

Author SHA1 Message Date
Jeff Morriss be97290991 Tighten heuristics a bit: traces with packets longer than 16k are no good (is this a valid limit?)
svn path=/trunk/; revision=25679
2008-07-08 22:23:26 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Ulf Lamping 723c80ea90 timestamp display precision:
- automatic adjustment depending on file format
- manual adjustment through menu items

save the setting in the recent file

svn path=/trunk/; revision=15534
2005-08-25 21:29:54 +00:00
Ulf Lamping 6f43fbb2f0 EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry!
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ...

What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere.

As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon.

Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way...

As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number...

svn path=/trunk/; revision=15520
2005-08-24 21:31:56 +00:00
Gerald Combs d0811b3d35 Don't assume ints are 32 bits. Fixes a recent Buildbot error.
svn path=/trunk/; revision=15200
2005-08-03 17:32:00 +00:00
Jörg Mayer f5afb4da1b Include the .h files into the .c files. That way we
a) get rid of warnings of type "no previous declaration" and
b) make sure that declaration and implementation are in sync.

svn path=/trunk/; revision=15168
2005-08-02 04:23:39 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris 1c8f8924ac Fix a compiler warning.
svn path=/trunk/; revision=9867
2004-01-26 21:26:52 +00:00
Guy Harris d6cd61061e Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors.  Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.

Add messages for cases where those errors were returned without printing
an additional message.

Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.

Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument.  (That handles a lot of the work of putting the info
string into the error message.)

Make some variables in "ascend-grammar.y" static.

Check the return value of "erf_read_header()" in "erf_seek_read()".

Get rid of an unused #define in "i4btrace.c".

svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
Guy Harris 56f644145e Discard the WTAP_ENCAP_LAPD encapsulation type in favor of a
WTAP_ENCAP_ISDN encapsulation type, which includes a pseudo-header
giving the direction (user-to-network or network-to-user) and the
channel number.

Add a new circuit type, using the ISDN channel number as the circuit ID.

Add an ISDN dissector to put the direction and channel number into the
protocol tree and to call the appropriate dissector for the payload
based on the channel (LAPD for the D channel; V.120, PPP, or data for B
channels, based on some heuristics).

svn path=/trunk/; revision=6521
2002-10-31 07:12:42 +00:00
Guy Harris 6e21561be8 From Joerg Mayer:
All files:
  - Replace types from sys/types.h by those from glib.h
  - Replace ntoh family of macros from netinet/in.h and winsock2.h
    by g_ntoh family from glib.h
  - Remove now unneeded includes of sys/types.h, netinet/in.h and
    winsock2.h
wtap.h
  Move includes to the top

svn path=/trunk/; revision=5909
2002-07-29 06:09:59 +00:00
Guy Harris 2aad75bb82 Graeme Hewson noted that zlib has a bug wherein "gzseek()" doesn't set
the internal z_err value for the stream if an "fseek()" call it makes
fails, so that if "gzerror()" is subsequently called, it returns Z_OK
rather than an error.

To work around this, we pass "file_seek()" an "int *err", and have the
with-zlib version of "file_seek()" check, if "gzseek()" fails, whether
the return value of "file_error()" is 0 and, if so, have it return
"errno" instead.

svn path=/trunk/; revision=5642
2002-06-07 07:27:35 +00:00
Guy Harris bf7e4ce909 Move the definition of the FROM_DCE bit in the "flags" field of a
"struct x25_phdr" to "wiretap/wtap.h".

Have two X.25 dissectors, one of which assumes that there's a "struct
x25_phdr" pseudo-header and one of which doesn't; the former uses the
information in that pseudo-header to determine whether the packet is
DTE->DCE or DCE->DTE, and the latter assumes it has no clue whether the
packet is DTE->DCE or DCE->TDE.  Use the former one in the LAPB
dissector, and the latter one in the XOT dissector and in the LLC
dissector table.

In the X.25-over-TCP dissector, handle multiple X.25 packets per TCP
segment, and handle X.25 packets split across TCP segments.

svn path=/trunk/; revision=5134
2002-04-09 08:15:04 +00:00
Guy Harris b5e9cef2bf Make "wtap_seek_read()" return TRUE on success and FALSE on error, like
"wtap_read()".

Add some additional error checks to the Sniffer file reader.

svn path=/trunk/; revision=4875
2002-03-05 08:40:27 +00:00
Guy Harris e300f4db52 Have "wtap_seek_read()" return 0 on success and -1 on failure, and take
an "err" argument that points to an "int" into which to put an error
code if it fails.

Check for errors in one call to it, and note that we should do so in
other places.

In the "wtap_seek_read()" call in the TCP graphing code, don't overwrite
"cfile.pseudo_header", and make the buffer into which we read the data
WTAP_MAX_PACKET_SIZE bytes, as it should be.

In some of the file readers for text files, check for errors from the
"parse the record header" and "parse the hex dump" routines when reading
sequentially.

In "csids_seek_read()", fix some calls to "file_error()" to check the
error on the random stream (that being what we're reading).

svn path=/trunk/; revision=4874
2002-03-05 05:58:41 +00:00
Guy Harris d54bd0bd6b Check for errors in seeks, "tell"s, and "stat()"s/"fstat()"s.
For file types where we allocate private data, add "close" routines
where they were missing, to free the private data.  Also fix up the code
to clean up after some errors by freeing private data where that wasn't
being done.

Get rid of unused arguments to "wtap_dump_open_finish()".

Fix indentation.

svn path=/trunk/; revision=4857
2002-03-04 00:25:35 +00:00
Guy Harris 89a4acb438 Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file.  Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).

If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.

Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").

Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping.  Also add units to the capture count option.

Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.

Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.

svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00
Guy Harris 3c9efdf478 Use longs as file offsets, so that on platforms with 64-bit "long" we
can handle capture files bigger than 2GB.

svn path=/trunk/; revision=3993
2001-10-04 08:30:36 +00:00
Guy Harris a251addb63 Obliging every capture file reader's "open()" routine to seek to the
beginning of the file before reading anything from the file is bogus -
do that in the loop that tries each of the open routines, instead.
(They may have to reset the seek pointer later if, for example, the
capture file begins with the first packet, and the "open()" routine
looks at that packet to try to guess whether the packet is in the file
format in question.)

Set "wth->data_offset" to 0 while you're at it, so capture file readers
don't have to do that, either.

svn path=/trunk/; revision=3123
2001-03-10 06:33:58 +00:00
Guy Harris 4933cc340f "wtap_read()" must *always* set "*err" when it returns FALSE - if it's
just an EOF, it should set "*err" to 0.  Fix up a bunch of read routines
for various capture file types to set "*err" appropriately.

svn path=/trunk/; revision=2667
2000-11-19 03:47:36 +00:00
Gilbert Ramirez abb6702fc2 Add #include <string.h>, to get prototypes for mem* and str* functions.
svn path=/trunk/; revision=2654
2000-11-17 21:00:40 +00:00
Guy Harris 62b3490af4 We have to set "x25.flags" in the Wiretap pseudo-header if the capture
is WTAP_ENCAP_LAPB *or* WTAP_ENCAP_V120, and we have to set "p2p.sent"
in the capture file for *all* WTAP_ENCAP_LAPD captures; fix the
i4btrace and Sniffer capture file readers to do so.

(XXX - should we eliminate "x25.flags", and use "p2p.sent" instead?  The
directions for X.25 are DTE->DCE and DCE->DTE, not "sent" and
"received", but I suspect that "sent" and "received" should be thought
of from the point of view of the DTE, so DTE->DCE is "sent" and DCE->DTE
is "received"; the directions for ISDN are user->network and
network->user, but I suspect that "sent" and "received" should be
thought of from the standpoint of the user equipment, so user->network
is "sent" and network->user is "received".)

svn path=/trunk/; revision=2606
2000-11-11 06:36:09 +00:00
Gilbert Ramirez f52ffba407 Change wtap_read() API so that the data offset is set via a pointer, and
a "keep reading" boolean value is returned from the function.
This avoids having to hack around the fact that some file formats truly
do have records that start at offset 0. (i4btrace and csids have no
file header. Neither does the pppdump-style file that I'm looking at right now).

svn path=/trunk/; revision=2392
2000-09-07 05:34:23 +00:00
Gilbert Ramirez 4a3b77ba46 Move #include <time.h> into wtap-int.h instead of requiring it in
every C file. I noticed this because of a build break of csids.obj on
Win32.

svn path=/trunk/; revision=2378
2000-08-25 21:25:43 +00:00
Guy Harris f48ff36e64 Use unsigned character pointers and arrays rather than signed character
pointers and arrays in a number of places, to remove warnings some
compilers give.

svn path=/trunk/; revision=2160
2000-07-26 00:20:09 +00:00
Gilbert Ramirez d7e6e0e384 Add wtap-int.h. Move definitions relevant to the internal workins of wiretap
to that file, leave public definitions in wtap.h.

Rename "union pseudo_header" to "union wtap_pseudo_header".
Make the wtap_pseudo_header pointer available in packet_info struct.

svn path=/trunk/; revision=1989
2000-05-19 23:07:04 +00:00
Guy Harris 0cc75a3569 In Wiretap, a file stream handle is a "FILE_T", not a "FILE_T *" (a
"FILE_T" is either a "gzFile" or a "FILE *", depending on whether zlib
support is enabled or not).  Fix various function declarations and
definitions.

svn path=/trunk/; revision=1984
2000-05-19 08:18:17 +00:00
Guy Harris f3d90d30a4 Remove the "union pseudo_header" from the "frame_data" structure;
there's no need to keep it around in memory - when the frame data is
read in when handing a frame, read in the information, if any, necessary
to reconstruct the frame header, and reconstruct it.  This saves some
memory.

This requires that the seek-and-read function be implemented inside
Wiretap, and that the Wiretap handle remain open even after we've
finished reading the file sequentially.

This also points out that we can't really do X.25-over-Ethernet
correctly, as we don't know where the direction (DTE->DCE or DCE->DTE)
flag is stored; it's not clear how the Ethernet type 0x0805 for X.25
Layer 3 is supposed to be handled in any case.  We eliminate
X.25-over-Ethernet support (until we find out what we're supposed to
do).

svn path=/trunk/; revision=1975
2000-05-18 09:09:50 +00:00
Guy Harris d51f36236f Get rid of the "start" field in the private data for RADCOM, i4btrace,
and nettl captures - a "start" field is used for capture files where the
time stamps on packets are relative to some initial time stamp, e.g. the
time the capture started, but those file formats use absolute time
stamps, so no "start" field is needed.

Make the "this is an HP-UX 11.x nettl capture" flag a member of the
private data structure for a nettl capture, rather than a global - it's
per-capture-file state.

Once the "start" field is removed from the RADCOM private data
structure, there's nothing left, so eliminate the private data
structure.

svn path=/trunk/; revision=1863
2000-04-15 21:12:37 +00:00
Guy Harris 7a36bede0b We are obliged to define HAVE_UNISTD_H in "config.h"; to avoid the
hideous problem on FreeBSD 3.[23] (and perhaps other BSDs) if
HAVE_UNISTD_H is defined before "zlib.h" is included, turn "file_seek()"
into a subroutine defined in a file that *undefines* HAVE_UNISTD_H
before including "zlib.h", so that the *only* call to "gzseek()" is made
from a file that does not have HAVE_UNISTD_H defined when it includes
"zlib.h".

Move "file_error()" to that file while you're at it, so it holds all the
wrappers that hide the presence or absence of zlib from routines to read
capture files.

Turn "file.h", which declared those wrapper functions as well as wrapper
macros, into "file_wrapper.h" - it belongs with the "file_wrapper.c"
file that defines the wrapper functions, not with "file.c" which handles
higher-layer file access functions.

Remove the comment in "configure.in" that explained why defining
HAVE_UNISTD_H was a bad idea, as we're not obliged to define it and work
around the problem.  (The comment in "file_wrapper.c" explains the
workaround.)

svn path=/trunk/; revision=1463
2000-01-13 07:09:20 +00:00
Guy Harris 9658c33db6 Handle i4btrace captures if they're from a machine with the opposite
byte order from the machine that's reading them.

svn path=/trunk/; revision=1338
1999-12-15 02:25:50 +00:00
Gilbert Ramirez 4a15f6582a Added Bert Driehuis <driehuis@playbeing.org>'s I4B wiretap module
and V.120 decoder.

svn path=/trunk/; revision=1304
1999-12-12 22:40:10 +00:00