Commit Graph

60 Commits

Author SHA1 Message Date
Guy Harris a0c5cac89d It appears that a channel number of 0 means DTE->DCE, and a channel
number of 1 means DCE->DTE, in DOS Sniffer ATM captures.

svn path=/trunk/; revision=6881
2003-01-09 01:55:13 +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 c3674ba31c Sigh. We really *do* have to check whether a capture is a snoop or
Surveyor capture, as there's one link-layer type that UNICOS/mp snoop
treats one way and Shomiti Surveyor treats another way.  The only way to
check that is to look at the first record to see how much padding it
has.

svn path=/trunk/; revision=6750
2002-12-05 22:33:11 +00:00
Guy Harris bb240540bd From Brian Ginsbach: upport for additional snoop file encapsulations in
UNICOS/mp.

svn path=/trunk/; revision=6621
2002-11-13 21:49:58 +00:00
Guy Harris 7a973edb96 Update some comments.
svn path=/trunk/; revision=6176
2002-09-04 19:29:59 +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 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 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 31fe776a02 Get rid of an unused variable.
svn path=/trunk/; revision=5571
2002-05-26 21:32:39 +00:00
Guy Harris 85c7401856 Set the LANE subtype in the "seek and read" routine.
svn path=/trunk/; revision=5529
2002-05-23 08:17:31 +00:00
Guy Harris d471f94388 Traffic with a traffic type of 0x06 is Signalling AAL traffic, including
non-Q.2931 SSCOP traffic; change comments to reflect that.

svn path=/trunk/; revision=5411
2002-05-07 06:25:30 +00:00
Guy Harris 105efda404 Move the code to guess the traffic type based on the packet contents
into Wiretap, so that if you read a frame from Wiretap you have what
traffic type information could be gleaned from the information in the
capture file, and can write the frame out to a capture file where the
file contains some or all of that information without having to
determine it outside of Wiretap.

svn path=/trunk/; revision=5314
2002-04-30 18:58:16 +00:00
Guy Harris b0f59c0ce7 Support writing Sun atmsnoop files.
Map MARS to TRAF_UNKNOWN, not TRAF_ILMI.

Don't support writing WTAP_ENCAP_NULL files.

svn path=/trunk/; revision=5304
2002-04-30 09:23:29 +00:00
Guy Harris ecb2a3939e Replace the "ngsniffer_atm" with an "atm" pseudo-header, which isn't
just an image of the ATM Sniffer data.  This means that Ethereal doesn't
have to know any ATM Sniffer-specific details (that's all hidden in
Wiretap), and allows us to add to that pseudo-header fields, traffic
types, etc. unknown to ATM Sniffers.

Have Wiretap map VPI 0/VCI 5 to the signalling AAL - for some capture
files, this might not be necessary, as they may mark all signalling
traffic as such, but, on other platforms, we don't know the AAL, so we
assume AAL5 except for 0/5 traffic.  Doing it in Wiretap lets us hide
those details from Ethereal (and lets Ethereal interpret 0/5 traffic as
non-signalling traffic, in case that happens to be what it is).

We may know that traffic is LANE, but not whether it's LE Control or
emulated 802.3/802.5; handle that case.

svn path=/trunk/; revision=5302
2002-04-30 08:48:27 +00:00
Guy Harris d415468153 The first byte of the frame header in atmsnoop does, in fact, contain an
indication of the type of traffic; use it.

svn path=/trunk/; revision=5301
2002-04-30 06:04:33 +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 761ae95b19 From Joerg Mayer: get rid of "-Wno-unused" flag in some configure
scripts, and check in changes to add _U_ to some unused arguments (some
other should perhaps be used, so we leave the _U_ out so that the
warnings serve as a reminder to check those).

svn path=/trunk/; revision=4847
2002-03-02 20:41:08 +00:00
Guy Harris cbf5c537c4 From Joerg Mayer: remove unused variables and declarations of
non-existent functions.

Remove the "filetype" argument from the "can_write_encap" functions for
particular capture file types - the argument value is implicit, in that
the routine being called is the routine for that particular file type.

svn path=/trunk/; revision=4823
2002-02-27 08:57:25 +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
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
Gilbert Ramirez a505b64912 Get rid of signed/unsigned comparison warnings in wiretap.
svn path=/trunk/; revision=4077
2001-10-25 20:29:24 +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 606d363a9b The return value from "fwrite()" is a "size_t"; make the variable into
which we store it a "size_t", and then fix up the bugs that were
revealed by the compiler warnings that produced - "fwrite()" returns 0,
not a negative number, on an I/O error.

Fix up some other items to have type "size_t", or to have various
unsigned types, while we're at it, to squelch compiler warnings.

svn path=/trunk/; revision=3867
2001-08-25 03:18:48 +00:00
Guy Harris 837e848329 Sigh. Shomiti apparently didn't know that the RFC 1761 data link types
were just DLPI data link types, and didn't know that the list had
expanded at some point and that Sun *used* some of the new types (e.g.,
in atmsnoop), or decided on their own to go beyond those types to encode
an Oh-So-Useful link speed indication, or just didn't *care* that they
were just DLPI data link types.

Therefore, we have to map Shomiti link types to wiretap types using a
different mapping table.  For now, we assume files with a version number
of 2 are snoop files, and version numbers of 3, 4, and 5 are Shomiti
files; Shomiti claims to use a version number of 2 as well, but to
determine whether a file with a version number of 2 is a snoop file or a
Shomiti file requires that we look at the header of the first packet and
assume that if there's more than 3 bytes of padding it's a Shomiti file.

The return value from "fwrite()" is a "size_t"; make the variable into
which we store it a "size_t", and then fix up the bugs that were
revealed by the compiler warnings that produced - "fwrite()" returns 0,
not a negative number, on an I/O error.

svn path=/trunk/; revision=3866
2001-08-25 02:56:31 +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
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
Gilbert Ramirez c312f69abc Make sure to pass the sent/received direction from pppdump.c in
pseudo_header.
Use generic "p2p_phdr" instead of "lapd_phdr". Modify toshiba.c and
packet-lapd.c to take that into account.
Add frame.p2p_dir, a filterable field, 0=sent, 1=recvd
Make p2p_dir available in packe_info, as I think it will be needed
in VJ COMP and UNCOMP dissection.

Rename WTAP_ENCAP_TR to WTAP_ENCAP_TOKEN_RING.

Mention pppd-log support in man page.
Mention atmsnoop in README.

svn path=/trunk/; revision=2455
2000-09-21 04:41:37 +00:00
Guy Harris 706bd5e1fc Shomiti Surveyor 3.x appears to have changed the version number in the
file header to 4; fortunately, as they appear to put their extensions to
snoop into the padding at the end of the record, all their capture files
look alike to programs such as snoop and Ethereal that ignore the
padding, so we can just treat version 4 just like version 2 (unless and
until Brent decides a new snoop format is called for, changes the record
header, and picks a version number that's the same as one used by
Shomiti).

svn path=/trunk/; revision=2447
2000-09-19 05:12:11 +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
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 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
Guy Harris 0dcade2634 Fields in the "snoop" file header are big-endian; write them as such.
svn path=/trunk/; revision=1204
1999-12-04 11:19:04 +00:00
Guy Harris 1eaa99a669 Fix some names.
svn path=/trunk/; revision=1203
1999-12-04 09:38:38 +00:00
Guy Harris 3b93574402 Add some infrastructure for the use of Ethereal, so it can make a list
of all the file types in which a file can be saved.

Giving each dumpable file type a routine that checks whether a file of a
given file type and encapsulation can be written lets us hoist some
checks into common code from out of the open routines.

If the "dump close" routine for a dump stream is NULL, have that mean
that there's no action that needs to be taken on a close by the code to
handle that file type; some file types don't need that, as they can be
written purely sequentially.

svn path=/trunk/; revision=1200
1999-12-04 08:32:14 +00:00
Guy Harris 4c37395f73 Add support to Wiretap for writing Network Monitor 1.x-format capture
files.

Make the return type of a number of routines that return 1 (for "true")
on success and 0 (for "false") on failure to "gboolean", and make the 1's
and 0's TRUEs and FALSEs.

svn path=/trunk/; revision=1194
1999-12-04 05:14:39 +00:00
Guy Harris 4c6b80bb27 Add support to Wiretap for writing "snoop"-format capture files.
svn path=/trunk/; revision=1193
1999-12-04 03:36:22 +00:00
Guy Harris 7c502167e4 Update a comment.
svn path=/trunk/; revision=1125
1999-11-27 06:03:46 +00:00
Guy Harris 48d5f6de4d Move the "guess what type of ATM traffic this is" stuff into the ATM
dissector; I don't think it's guaranteed that even a Sniffer will tell
you that (there may be situations where it can't figure it out, and
where the user didn't tell it), we may need it for "atmsnoop" traffic
and other types of ATM traffic as well, we will probably want to add to
it the ability to let the user specify "virtual circuit X.Y is this kind
of traffic", and we may also have Ethereal try to intuit it based on
previous traffic in the capture (Q.2931 call setup, LANE traffic, etc.).

Don't show the cell count if it's zero - assume that means we don't know
how many cells made up the packet.  Also don't show the AAL5 trailer if
the cell count is zero - the ATM Sniffer *might* sometimes supply a cell
count of 0 even if it has the AAL5 trailer, I guess, and we *might* see
some other capture file format that has the AAL5 trailer but no cell
count, but we'll cross that bridge when we come to it.

Add support for "atmsnoop" captures to the code to handle "snoop"
captures.

Use the field in "iptrace" headers that appears to be, in ATM captures,
a direction indicator - we may have the direction backwards, but, as an
STP packet was tagged as a DCE->DTE packet, and as the capturing
machine, which also was presumably the recipient of the packet, was an
AIX box, not a switch or bridge or some piece of networking equipment
such as that, it *probably* wasn't sending the STP packet, it was
probably receiving it.

svn path=/trunk/; revision=1120
1999-11-27 01:55:44 +00:00
Guy Harris 73813e04ce Add a bunch of placeholder entries for DLPI link-layer types, for
reference.

svn path=/trunk/; revision=1114
1999-11-26 11:18:12 +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 2ba5608a0b "snoop" seems to treat "IEEE 802.3" and "Ethernet" datalink types the
same (which raises the question "so why the heck are there two types?" -
note that the way you're supposed to tell Ethernet from 802.3 packets is
by looking at the value of the type/length field; both of them can be
transmitted on the same wire), so we'll treat them the same.

svn path=/trunk/; revision=733
1999-09-28 01:19:01 +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