Commit Graph

238 Commits

Author SHA1 Message Date
Guy Harris 0fdd93d1ce Rename the "private" member of a "wtap_dumper" structure to "dump", as
per the "capture" member of a "wtap" structure, so that it doesn't
collide with the C++ reserved word "private".

svn path=/trunk/; revision=1936
2000-05-10 22:16:31 +00:00
Guy Harris 005588b8b9 In a Network Monitor capture file, get the starting offsets of frames
from the frame table - Network Monitor 2.x, at least, doesn't always
write frame N+1 right after frame N.

To do that, we need to mallocate a big array to hold the frame table,
and free it when we close the capture file; this requires that we have
capture-file-type-specific close routines as well as
capture-file-type-specific read routines - we let it the pointer to that
routine be null if it's not needed.  Given that, we might as well get
rid of the switch statement in "wtap_close()", in favor of using
capture-file-type-specific close routines, as per the comment before
that switch statement.

svn path=/trunk/; revision=1740
2000-03-22 07:06:59 +00:00
Guy Harris 585268e3e1 Use WTAP_ERR_UNSUPPORTED_ENCAP for all attempts to open or read a
capture file for an unsupported link-layer encapsulation type (as the
nettl reader does), and report it correctly if it occurs on an open or
read attempt rather than a save attempt.

svn path=/trunk/; revision=1647
2000-02-19 08:00:08 +00:00
Guy Harris 3e067b812c Fix files that had Gilbert's old e-mail address or that didn't have my
forwarding e-mail address.

svn path=/trunk/; revision=1522
2000-01-22 06:22:44 +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
Olivier Abad 8e8821b4a3 Changed the meaning of the 0x80 bit in "fs" in a frame2 record (from DTE
instead of from DCE).
I can now open a RADCOM X.25 capture in ethereal, save it as sniffer, and
read it with a sniffer. The frame directions are correct. (BTW, the
snifconv.exe tool provided by RADCOM doesn't work with X.25 captures).

svn path=/trunk/; revision=1331
1999-12-14 12:41:13 +00:00
Guy Harris 626078e808 Put in a private data structure hanging off the "wtap_dumper" structure
the "this is the first frame" flag, and the time stamp of the first
frame, used when writing Sniffer files, so that more than one could be
open at a time (Wiretap doesn't forbid that) and so that they're
initialized when you start writing a capture.

svn path=/trunk/; revision=1292
1999-12-11 10:02:13 +00:00
Olivier Abad e906581356 Correct timestamp calculation in ngsniffer_dump
svn path=/trunk/; revision=1291
1999-12-11 09:22:36 +00:00
Olivier Abad 1c7d6cf9fc Add support to Wiretap for writing sniffer capture files.
I'm using 4.0 as the version in the REC_VERS record. It seems to work
with sniffer versions 4.40 and 5.0

No ATM support yet.

svn path=/trunk/; revision=1270
1999-12-09 23:17:20 +00:00
Guy Harris 5feaeca5f2 Update one more comment.
svn path=/trunk/; revision=1150
1999-11-29 08:00:58 +00:00
Guy Harris 2fcfdf77d7 Update some comments.
svn path=/trunk/; revision=1149
1999-11-29 07:54:40 +00:00
Guy Harris 9f084a7ebc Add in a comment about the "fs" and "flags" fields in the "frame2"
record.

svn path=/trunk/; revision=1130
1999-11-28 02:08:48 +00:00
Guy Harris d6c3d1b5bf Sigh. Apparently "Internetwork analyzer" covers a multitude of sins;
both LAPB and PPP captures get written out with that network type.

Flag it as WTAP_ENCAP_UNKNOWN when the file is opened, and, when we see
the first packet, check whether the address field is 0xFF, in which case
we flag it as PPP, or anything else, in which case we flag it as LAPB.

svn path=/trunk/; revision=1129
1999-11-27 20:46:46 +00:00
Guy Harris 5f7868c7e0 Better handle errors from zlib:
Assign a range of Wiretap errors for zlib errors, and have
	"wtap_strerror()" use "zError()" to get an error message for
	them.

	Have the internal "file_error()" routine return 0 for no error
	and a Wiretap error code for an error.

svn path=/trunk/; revision=769
1999-10-05 07:06:08 +00:00
Guy Harris 57772323ad A "time units" value of 5 means "microseconds", according to an FDDI
Sniffer trace, and printout therefrom, sent to me by Jeff Foster.  (The
Sniffer manuals I'd had a chance to read didn't say what the units
were.)

svn path=/trunk/; revision=744
1999-09-30 20:34:26 +00:00
Guy Harris a9c36a4b69 Fix it so that it builds with "--disable-zlib".
The "fh" member of a "wtap" structure points to something constructed
from the "fd" member of that structure, so that closing the stream
referred to by "fh" also closes the underlying file descriptor; get rid
of an unnecessary close of "wth->fd".

svn path=/trunk/; revision=720
1999-09-24 05:49:53 +00:00
Ashok Narayanan 3dfa56c498 This commit contains support for reading capture files compressed using
gzip. The zLib library is used for this purpose. If zLib is not available
(or it's use is disabled by the --disable-zlib option to configure), you
can still compile Ethereal but it will be unable to read compressed capture
files.

IMPORTANT:

Now all file accesses to capture files should be done through special macros.
Specifically, for any use of the following functions on capture files, replace them.
The arguments for the right-side functions are exactly the same as for the
original stdio functions.

	fopen			file_open
	fdopen			filed_open
	fread			file_read
	fwrite			file_write
	fseek			file_seek
	fclose			file_close
	ferror			file_error

svn path=/trunk/; revision=695
1999-09-22 01:26:50 +00:00
Guy Harris ae53260d02 Keep in the "wtap" structure the current offset into the file being
read, and maintain it ourselves as we read through the file, rather than
calling "ftell()" for every packet we read - "ftell()" may involve an
"lseek()" call, which could add a noticeable CPU overhead when reading a
large file.

svn path=/trunk/; revision=596
1999-08-28 01:19:45 +00:00
Guy Harris 678b5fd6ff Add a new Wiretap encapsulation type WTAP_ENCAP_FDDI_BITSWAPPED, meaning
"FDDI with the MAC addresses bit-swapped"; whether the MAC addresses are
bit-swapped is a property of the machine on which the capture was taken,
not of the machine on which the capture is being read - right now, none
of the capture file formats we read indicate whether FDDI MAC addresses
are bit-swapped, but this does let us treat non-"libpcap" captures as
being bit-swapped or not bit-swapped independent of the machine on which
they're being read (and of the machine on which they were captured, but
I have the impression they're bit-swapped on most platforms), and allows
us to, if, as, and when we implement packet capture in Wiretap, mark
packets in a capture file written in Wiretap-native format based on the
machine on which they are captured (assuming the rule "Ultrix, Alpha,
and BSD/OS are the only platforms that don't bit-swap", or some other
compile-time rule, gets the right answer, or that some platform has
drivers that can tell us whether the addresses are bit-swapped).

(NOTE: if, for any of the capture file formats used only on one
platform, FDDI MAC addresses aren't bit-swapped, the code to read that
capture file format should be fixed to flag them as not bit-swapped.)

Use the encapsulation type to decide whether to bit-swap addresses in
"dissect_fddi()".

svn path=/trunk/; revision=557
1999-08-24 03:19:34 +00:00
Guy Harris 4b9ab6d1fc Get rid of some cruft left in by previous checkins as placeholders.
Get rid of WTAP_ENCAP_NONE; replace it with WTAP_ENCAP_UNKNOWN, which
means "I can't handle that file, it's using an encapsulation I don't
support".

Check for encapsulations we don't support, and return an error (as is
already done in "libpcap.c").

Check for too-large packet sizes, and return an error (as is already
done in "libpcap.c").

Print unsigned quantities in Wiretap messages with "%u", not "%d".

svn path=/trunk/; revision=544
1999-08-22 02:29:40 +00:00
Guy Harris 3a41de3bbb The 16-bit and 32-bit fields in the "frame4" record header in ATM
Sniffer captures are little-endian; convert them as necessary.

svn path=/trunk/; revision=535
1999-08-20 23:11:05 +00:00
Guy Harris 942470521a Get rid of an unused variable left stranded on the beach when a wave
washed out to sea the code that used to pretend that an ATM Sniffer
capture was an Ethernet or Token-Ring Sniffer capture.

svn path=/trunk/; revision=524
1999-08-20 07:38:30 +00:00
Guy Harris a033390918 Add support for reading Full Frontal ATM from an ATM Sniffer capture
file, instead of throwing out all but LANE or RFC 1483 data frames and
pretending that the former are just Ethernet or Token-Ring frames.

Add some level of decoding for ATM LANE, but not all of it; the rest,
including decoding non-LANE frames, is left as an exercise for somebody
who has captures they want to decode, an interest in decoding them, ATM
expertise, and time....

svn path=/trunk/; revision=523
1999-08-20 06:55:20 +00:00
Guy Harris 137ba48d18 Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code.  Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.

Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.

Add some new error codes for them to return.

Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.

Handle the additional errors we can get when opening a capture file.

If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.

svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
Guy Harris 79c2223425 Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, and
wiretap support for RADCOM Ltd.'s WAN/LAN analyzers (see

	http://www.radcom-inc.com/

).  Note: as I remember, IEEE 802.2/ISO 8022 LLC has somewhat of an SDLC
flavor to it, just as I think LAP, LAPB, LAPD, and so on do, so we may
be able to combine some of the LLC dissection and the LAPB dissection
into common code that could, conceivably be used for other SDLC-flavored
protocols.

Make "S" a mnemonic for "Summary" in the "Tools" menu.

Move the routine, used for the "Tools/Summary" display, that turns a
wiretap file type into a descriptive string for it into the wiretap
library itself, expand on some of its descriptions, and add an entry for
files from a RADCOM analyzer.

Have "Tools/Summary" display the snapshot length for the capture.

svn path=/trunk/; revision=416
1999-08-02 02:04:38 +00:00
Gilbert Ramirez 601c52f0fb Added support for compiling on win32 with Visual C and 'nmake'. It compiles,
but does not link. Perhaps someone who understands the MS tools can help
out. I made it link a few months ago, but with different version of glib/gtk+.
I can't remember how I made it link.

Most of the compatibility issues were resolved with adding
#ifdef HAVE_UNISTD_H the the source code. Please be sure to add this to all
future code.

svn path=/trunk/; revision=359
1999-07-13 02:53:26 +00:00
Gilbert Ramirez 2dbd008ea5 Added display filters to wiretap.
svn path=/trunk/; revision=198
1999-03-01 18:57:07 +00:00
Gilbert Ramirez 7757b2e72b I removed the per-file encapsulation type from wiretap, and make all filetypes
provide a per-packet encapsulation type. this required minor modifications to
ethereal.

svn path=/trunk/; revision=162
1999-01-07 16:15:37 +00:00
Gilbert Ramirez e071c65555 Added Guy Harris' patch to read Sniffer ATM trace files. Very nice.
svn path=/trunk/; revision=128
1998-12-17 06:39:13 +00:00
Guy Harris dfceeaeb7c Fix the bitmask for the hour field in a DOS-format time (not that it
matters, as that code is commented out).

svn path=/trunk/; revision=125
1998-12-15 04:11:58 +00:00
Gilbert Ramirez 84e0fc12a0 Added Guy's patch to calculate date of Sniffer packet trace. I copied
bits of it to do the same for Lanalyzer packets.

svn path=/trunk/; revision=123
1998-12-13 05:08:05 +00:00
Gilbert Ramirez cd7484ddf5 Added time-stamp decoding to LANalyzer decodes, made minor comment changes to
ngsniffer.c, and removed DLT_* defines from wtap.h

svn path=/trunk/; revision=119
1998-11-23 04:40:22 +00:00
Gilbert Ramirez bb9f28af0f The Sniffer-reading code now checks to make sure that it is trying
to read an uncompressed Sniffer file.

svn path=/trunk/; revision=118
1998-11-21 05:08:40 +00:00
Guy Harris 86bf1fc851 Add support to wiretap for reading Sun "snoop" capture files.
That requires that, in the packet-reading loop, we pass to the callback
routine the offset in the file of a packet's data, because we can no
longer compute that offset by subtracting the size of the captured
packet data from the offset in the file after the data was read -
"snoop" may stick padding in after the packet data to align packet
headers on 4-byte boundaries.

Doing that required that we arrange that we do that for "libpcap"
capture files as well; the cleanest way to do that was to write our own
code for reading "libpcap" capture files, rather than using the
"libpcap" code to do it.

Make "wtap_dispatch_cb()" and "pcap_dispatch_cb()" static to "file.c",
as they're not used elsewhere.

If we're using wiretap, don't define in "file.h" stuff used only when
we're not using wiretap.

Update the wiretap README to reflect Gilbert's and my recent changes.

Clean up some memory leaks in "wiretap/lanalyzer.c" and
"wiretap/ngsniffer.c", where the capture-file-format-specific data
wasn't freed if the open failed.

svn path=/trunk/; revision=91
1998-11-15 05:29:17 +00:00
Gilbert Ramirez d773727c23 The Sniffer-reading code in wiretap now decodes the time field for each
packet. The date is still not taken into account, so all the traces appear to
start on Jan 1, 1970. But the time of day is correct, so at least you get good
delta times.

svn path=/trunk/; revision=89
1998-11-13 06:47:37 +00:00
Gilbert Ramirez d744ff6a91 Now that I know where to find the file format of Sniffer trace files, wiretap
now *properly* reads Sniffer files. I now know the field in the file header
which denotes link type.

svn path=/trunk/; revision=88
1998-11-13 05:57:39 +00:00
Gilbert Ramirez c0f191e9e0 I added the LANalzyer file format to wiretap. I cleaned up some code in the
wiretap functions to be more generic and therefore allow an easier integration
of more packet-capture file types. I also put in all the GPL copyrights in the
wiretap code.

svn path=/trunk/; revision=83
1998-11-12 06:01:27 +00:00
Gilbert Ramirez fcb4c78a6a A lengthy patch to add the wiretap library. Wiretap is not used by default
because it is still in its infancy, but it can be compiled in optionally.
The library exists in its own subdirectory ethereal/wiretap. This patch also
edits all the packet-*.c files to remove the #include <pcap.h> line which is
unnecessary in these files. In the ethereal code, file.c is the most heavily
modified with #ifdef WITH_WIRETAP lines for the optional library.

svn path=/trunk/; revision=82
1998-11-12 00:06:47 +00:00