Commit Graph

91 Commits

Author SHA1 Message Date
Guy Harris 48cd9f9358 Add support for DLT_ value 99, as used by the Axent Raptor
firewall/Symantec Enterprise Firewall.  Thanks, Axent/Symantec, for not
asking us for a DLT_ value and not telling us about the link-layer type.

svn path=/trunk/; revision=10361
2004-03-11 09:18:33 +00:00
Guy Harris ba72e955dc Have "wtap_read()" set "wth->phdr.pkt_encap" to "wth->file_encap",
rather than requiring individual capture file type handlers to do it
(unless they're doing per-packet encapsulation, in which case we check
to make sure they didn't *leave* it as WTAP_ENCAP_PER_PACKET).

svn path=/trunk/; revision=10290
2004-03-03 22:24:53 +00:00
Guy Harris cf131d9e16 The DLT_ value 127 is being used for the BSD radio header, and the
current CVS libpcap uses 163 for the AVS radio header (127 was never
used for the AVS radio header).  Redo the Wiretap encapsulation values
for that (and shuffle them to put the 802.11 Wiretap values together).

svn path=/trunk/; revision=9904
2004-01-29 10:58:28 +00:00
Guy Harris 677db2dadd From Tomas Kukosa: reserve private WTAP_ENCAP values and map them to
reserved private DLT_ values.

svn path=/trunk/; revision=9892
2004-01-28 01:24:30 +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 b8299f0b98 From Jan Kiszka: IrDA support.
svn path=/trunk/; revision=9345
2003-12-18 19:07:14 +00:00
Guy Harris 02260b4056 From Jeff Morriss: add support for libpcap MTP2 and MTP3 captures.
Add a missing entry in "encap_table[]" for Bluetooth H4, and fix some
comments.

svn path=/trunk/; revision=9157
2003-12-03 22:40:39 +00:00
Guy Harris b624dce63b Add a new WTAP_ENCAP_CHDLC_WITH_PHDR type, to distinguish Cisco HDLC
captures with packet direction information from captures without it.
Use them appropriately.

svn path=/trunk/; revision=8780
2003-10-25 07:17:28 +00:00
Guy Harris 11a979dd4c Fix a typo.
svn path=/trunk/; revision=7681
2003-05-16 00:34:33 +00:00
Guy Harris 86f3c38c4a From Can Erkin Acar: OpenBSD is now using tcpdump.org-assigned DLT_
value for DLT_PFLOG, and that goes along with a change to the link-layer
header for DLT_PFLOG - support both the old and new values and format.

svn path=/trunk/; revision=7676
2003-05-15 07:14:46 +00:00
Guy Harris 3cc1053182 A captured length bigger than the actual length makes no sense; clip the
captured length so it's <= the actual length.

svn path=/trunk/; revision=7268
2003-03-04 02:38:02 +00:00
Guy Harris f88816e60f Add WTAP_ENCAP_FRELAY_WITH_PHDR for use with Frame Relay capture files
that have direction information.

Support writing WTAP_ENCAP_FRELAY_WITH_PHDR and WTAP_ENCAP_PPP_WITH_PHDR
captures out in libpcap format - we throw away the direction
information, but so it goes.

When reading/writing Windows Sniffer format, read and write the
direction flag.

svn path=/trunk/; revision=7052
2003-01-31 01:02:14 +00:00
Guy Harris 8e6518ea60 In the BSDs, ARCNET packets don't have an offset field between the
addresses and the protocol type, as supplied by BPF; on Linux, they *do*
have an offset field, as supplied by PF_PACKET sockets.  Add a new
WTAP_ENCAP_ARCNET_LINUX, with packets that include the offset field, and
don't dissect an offset in WTAP_ENCAP_ARCNET packets.

Map a libpcap link-layer type of 129 to WTAP_ENCAP_ARCNET_LINUX; that
value was recently assigned to Linux-style ARCNET.

Add some more ARCNET protocol IDs.

For most protocol IDs, dissect an ATA 878.2 fragmentation header; don't
do it for RFC 1051 IP and ARP, and Diagnose packets.  Set the length of
the ARCNET protocol tree item appropriately.

Dissect both the RFC 1051 and RFC 1201 styles of IP and ARP over ARCNET,
and dissect the RFC 1201 style of RARP as well.

svn path=/trunk/; revision=6981
2003-01-23 04:04:01 +00:00
Guy Harris 94800ef0fb From Chris Waters: support Tazmen Sniffer Protocol and DLT_TZSP captures
from network-based libpcaps that use that protocol.

svn path=/trunk/; revision=6875
2003-01-08 05:03:54 +00:00
Guy Harris e56b77f4cd Add support for SDLC encapsulation in DOS Sniffer captures; that
includes adding an SDLC dissector.

svn path=/trunk/; revision=6848
2003-01-03 22:31:26 +00:00
Guy Harris 0a5be3f18b Rename WTAP_ENCAP_ATM_SNIFFER to WTAP_ENCAP_ATM_PDUS, as it's not just
used for the DOS-based ATM Sniffer.  (That's not a great name, but I
couldn't think of a better one.)

Add a new WTAP_ENCAP_ATM_PDUS_UNTRUNCATED encapsulation type for capture
files where reassembled frames don't have trailers, such as the AAL5
trailer, chopped off.  That's what at least some versions of the
Windows-based ATM Sniffer appear to have.

Map the ATM capture file type for NetXRay captures to
WTAP_ENCAP_ATM_PDUS_UNTRUNCATED, and put in stuff to fill in what we've
reverse-engineered, so far, for the pseudo-header; there's more that
needs to be done on it, e.g. getting the channel, AAL type, and traffic
type (or inferring them if they're not in the packet header).

svn path=/trunk/; revision=6840
2003-01-03 06:45:45 +00:00
Guy Harris 156254096a Add an item for Wellfleet HDLC.
svn path=/trunk/; revision=6813
2002-12-20 21:59:33 +00:00
Guy Harris 8ee4a65f76 From Solomon Peachy: support for new "wlancap" 802.11 extra-information
header.

Add overflow checks to "BYTES_ARE_IN_FRAME()", and cast all arguments to
unsigned values (negative values should never be passed) to squelch
compiler warnings.

svn path=/trunk/; revision=6567
2002-11-06 21:49:34 +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 2a54cd2a76 Add a Wiretap encapsulation type for RFC 2625 IP-over-Fibre Channel, and
map libpcap's DLT_IP_OVER_FC to it.

svn path=/trunk/; revision=6473
2002-10-22 09:11:13 +00:00
Jörg Mayer 64b6acac6d Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6115
2002-08-28 20:30:45 +00:00
Guy Harris 20557c1fb7 From Anand V. Narwani: add an entry for the DOCSIS encapsulation to the
Wiretap table of encapsuations.

svn path=/trunk/; revision=5955
2002-08-06 05:40:47 +00:00
Guy Harris 5d929e0e8f From Motonori Shindo: support for reading CoSine L2 debug output.
svn path=/trunk/; revision=5922
2002-07-31 19:27:57 +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 44d19627ef From Graeme Hewson:
Allow "-" as the output file name in Wiretap, referring to the
	standard error.

	Optimize the capture loop.

Fix some of the error-message printing code in Ethereal and Tethereal.

Have Wiretap check whether it can seek on a file descriptor, and pass
the results of that test to the file-type-specific "open for output"
routine.  Have the "open for output" routines for files where we need to
seek when writing the file return an error if seeks don't work.

svn path=/trunk/; revision=5884
2002-07-16 07:15:09 +00:00
Guy Harris 1b72ef68e6 Add a new error for attempts to open a pipe or FIFO for random access.
Have "wtap_open_offline()", if asked to open a FIFO, return that error
if it was asked to open the file for random access.

svn path=/trunk/; revision=5643
2002-06-07 07:47:58 +00:00
Guy Harris b2c46086c3 Use WTAP_ENCAP_IEEE_802_11_WITH_RADIO for AiroPeek files, rather than
having a special encapsulation type for AiroPeek files.

svn path=/trunk/; revision=5123
2002-04-08 09:44:42 +00:00
Guy Harris 939b3c8e0a Add an encapsulation type for "802.11 with radio information"; that type
returns radio information such as signal strength, channel, and data
rate in a pseudo-header.  Add that pseudo-header.

Use the "802.11 with radio information" encapsulation type for Wireless
Sniffer files; extract the radio information from where it appears to be
in the header.

Add dissector code for that encapsulation type.

Fix an error in the code to put radio information into the AiroPeek
tree.

Make the "wrapped" flag for NetXRay/Windows Sniffer captures a
"gboolean".

svn path=/trunk/; revision=5122
2002-04-08 09:09:49 +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 f9c109a239 Support in Wiretap for DLT_HHDLC, from Tomas Kukosa.
svn path=/trunk/; revision=4707
2002-02-07 20:41:28 +00:00
Guy Harris a66d50bbf2 Untested support for AiroPeek captures.
svn path=/trunk/; revision=4619
2002-01-29 09:45:58 +00:00
Guy Harris c873f79156 Support for capturing on, and reading captures from, OpenBSD firewall
logging virtual interface, from Mike Frantzen.

svn path=/trunk/; revision=4616
2002-01-29 08:44:53 +00:00
Guy Harris a7bb49b0d9 Add support for LocalTalk Link Access Protocol.
Rename WTAP_ENCAP_PRISM to WTAP_ENCAP_PRISM_HEADER, to match
DLT_PRISM_HEADER.

Add in missing capture support for WTAP_ENCAP_PRISM_HEADER when
capturing with "pcap_open_live()" rather than reading the capture from a
pipe.

svn path=/trunk/; revision=4299
2001-11-30 07:14:22 +00:00
Guy Harris 56636f157a Support for 802.11+Prism II monitor-mode link-layer headers, from
Tim Newsham.

Add in missing item for WTAP_ENCAP_CISCO_IOS in the Wiretap
encapsulation type table.

svn path=/trunk/; revision=4290
2001-11-28 07:11:11 +00:00
Gilbert Ramirez f14a6b8b91 Hopefully the last time I have to change my e-mail address.
svn path=/trunk/; revision=4199
2001-11-13 23:55:44 +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 f7b50ca754 From Joerg Mayer:
* gcc 3.0 warning fixes:
  - text2pcap.c: The number of characters to scan should probably not be 0
  - wiretap/csids.c: using preincrement on a variable used on both
    sides of an assignment might be undefined by the C99(?) standard
 * turn on additional warnings for epan and wiretap too
  - epan/configure.in
  - wiretap/configure.in
 * Fix some warnings (missing includes, signed/unsigned, missing
    initializers) found by turning on the warnings
  - all other files :-)

svn path=/trunk/; revision=3709
2001-07-13 00:55:58 +00:00
Guy Harris 537d308abe "open_cap_file()" in Ethereal and Tethereal don't use the FILE_T they
get from calling "wtap_file()", so get rid of the call and the
(otherwise unused) variable to which its result gets assigned.

That lets us get rid of "wtap_file()" in Wiretap.

It also lets us get rid of the include of "zlib.h" in "file.h"; the
#defines of "file_open()", "filed_open()", and "file_close()" are also
unnecessary, so we get rid of those as well.

However, that means we need to include <zlib.h> in "gtk/main.c" and
"tethereal.c", so that the version number of libz is defined and can
show up in the version string.

svn path=/trunk/; revision=3652
2001-07-05 00:34:42 +00:00
Guy Harris 7ecac8fbd0 Add a new Wiretap encapsulation type for Cisco HDLC. Map the NetBSD
DLT_HDLC to it.

Make a separate dissector for Cisco HDLC, and add a dissector for Cisco
SLARP.  Have the PPP dissector call the Cisco HDLC dissector if the
address field is the Cisco HDLC unicast or multicast address.  Use the
Cisco HDLC dissector for the Cisco HDLC Wiretap encapsulation type.

Add a new dissector table "chdlctype", for Cisco HDLC packet types
(they're *almost* the same as Ethernet types, but 0x8035 is SLARP, not
Reverse ARP, and 0x2000 is the Cisco Discovery protocol, for example),
replacing "fr.chdlc".

Have a "chdlctype()" routine, similar to "ethertype()", used both by the
Cisco HDLC and Frame Relay dissectors.  Have a "chdlc_vals[]"
"value_string" table for Cisco HDLC types and protocol names.  Split the
packet type field in the Frame Relay dissector into separate SNAP and
Cisco HDLC fields, and give them the Ethernet type and Cisco HDLC type
"value_string" tables, respectively.

svn path=/trunk/; revision=3133
2001-03-15 09:11:03 +00:00
Guy Harris 3f75680191 Code to handle Frame Relay Sniffer captures, from Jeff Foster.
Code to register the Frame Relay dissector to handle Frame Relay
captures, from Paul Ionescu.

svn path=/trunk/; revision=2845
2001-01-08 22:18:22 +00:00
Guy Harris 039805843b Add support for the DLT_LINUX_SLL capture type in the current CVS
version of libpcap; that's used on Linux for captures on the "any"
device (which captures from all interfaces simultaneously) and for
captures on devices whose link-layer type libpcap doesn't (yet) support
natively.

The spanning tree code, when checking for GV{M,R,...}P packets, must
first check whether the link-layer destination address is, in fact, an
Ethernet-style address; on Linux cooked captures, there *is* no
destination address, so it's of type AT_NONE, not AT_ETHER.

svn path=/trunk/; revision=2772
2000-12-23 08:06:16 +00:00
Guy Harris 7c3fcbac34 IEEE 802.11 support, from Johan Jorgensen of Axis Communications AB.
Add in stuff for a bunch of libpcap formats either in libpcap 0.5.2 or
in the current CVS version; we don't implement all of them in
Ethereal/Wiretap (those are "#if 0"ed out), but we do implement the IEEE
802.11 stuff (which isn't yet in libpcap or tcpdump, but the CVS version
of libpcap *does* reserve 105 as the encapsulation type number for
802.11).

svn path=/trunk/; revision=2646
2000-11-15 05:42:35 +00:00
Gilbert Ramirez e942fe5f31 Add string representation for WTAP_ENCAP_PPP_WITH_PHDR
svn path=/trunk/; revision=2464
2000-09-28 04:19: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
Laurent Deniel 8d95269d34 Fix buffer overflow on zlib uncompression errors.
svn path=/trunk/; revision=2299
2000-08-19 18:31:23 +00:00
Guy Harris 7843ac6d0e Add routines to Wiretap to allow a client of Wiretap to get:
a pointer to the "wtap_pkthdr" structure for an open capture
	file;

	a pointer to the "wtap_pseudo_header" union for an open capture
	file;

	a pointer to the packet buffer for an open capture file;

so that a program using "wtap_read()" in a loop can get at those items.

Keep, in a "capture_file" structure, an indicator of whether:

	no file is open;

	a file is open, and being read;

	a file is open, and is being read, but the user tried to quit
	out of reading the file (e.g., by doing "File/Quit");

	a file is open, and has been completely read.

Abort if we try to close a capture that's being read if the user hasn't
tried to quit out of the read.

Have "File/Quit" check if a file is being read; if so, just set the
state indicator to "user tried to quit out of it", so that the code
reading the file can do what's appropriate to clean up, rather than
closing the file out from under that code and causing crashes.

Have "read_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
close the capture and return an indication that the read was aborted by
the user.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "continue_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
return an indication that the read was aborted by the user if that
happened.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "finish_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
close the capture and return an indication that the read was aborted by
the user if that happened.  Otherwise, return an indication of whether
the read completely succeeded or failed in the middle (and, if it
failed, return the error code through a pointer).

Have their callers check whether the read was aborted or not and, if it
was, bail out in the appropriate fashion (exit if it's reading a file
specified by "-r" on the command line; exit the main loop if it's
reading a file specified with File->Open; kill the capture child if it's
"continue_tail_cap_file()"; exit the main loop if it's
"finish_tail_cap_file()".

svn path=/trunk/; revision=2095
2000-06-27 07:13:42 +00:00
Guy Harris 8af330852d Support for reading compressed Sniffer files, from Tim Farley, Joerg
Mayer, and yours truly.

svn path=/trunk/; revision=2002
2000-05-25 09:00:24 +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 bae4ad8d18 "wtap.h" doesn't need to include "ascend.h" or "toshiba.h".
svn path=/trunk/; revision=1982
2000-05-19 05:33:32 +00:00