Commit Graph

177 Commits

Author SHA1 Message Date
Jörg Mayer db0d014224 Use <zlib.h> instead of "zlib.h"
svn path=/trunk/; revision=5926
2002-07-31 22:52:38 +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 73ef5a2753 WinPcap 2.3's <pcap.h> includes <packet32.h>, and WinPcap 2.3's
<packet32.h> includes <winsock2.h>; we include that rather than
<winsock.h>, to avoid errors due to conflicting declarations in
<winsock.h> and <winsock2.h>.

svn path=/trunk/; revision=5742
2002-06-23 10:32:36 +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 ae54ef681c Make the end-of-packet padding a per-capture-file property.
Read in the entire packet, including the padding, and just tell our
caller about the non-padding part; that avoids doing a "file_seek()"
("fseek()"s are inefficient on some platforms, as they flush the
standard I/O buffers and do an "lseek()"), and would also let us supply
the padding to the caller if it turns out it's an FCS rather than
padding.

svn path=/trunk/; revision=5107
2002-04-07 21:29:01 +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 203d0680a1 The time base in an EtherPeek capture isn't necessarily the start time
of the capture, so change some names and comments.

svn path=/trunk/; revision=4563
2002-01-18 01:08:36 +00:00
Guy Harris 6cdc5dfde2 In the EtherPeek file reader, keep the capture start time in a private
data structure attached to the "wtap" structure, rather than in a
pseudo-header structure; get rid of the EtherPeek pseudo-header
structure, as it's not actually used as a pseudo-header, it's just used
as private data for the EtherPeek reader.

Get rid of an extra level of indentation in switch statements.

svn path=/trunk/; revision=4561
2002-01-18 00:25:50 +00:00
Gilbert Ramirez 82380ce2c4 Don't leak memory when closing a pppdump trace file.
The second argument to g_ptr_array_free() does not indicate to
glib to free the objects that the pointers in the GPtrArray refer to,
but simply whether or not the free the block of pointers.  We have
to free the objects ourselves.

svn path=/trunk/; revision=4391
2001-12-13 05:49:13 +00:00
Guy Harris 8032fa8a1b Make the bytes-written information from Wiretap a long, as we allow
files to get that big.

From Thomas Wittwer and Matthias Nyffenegger:

Support for "ring buffer mode", wherein there's a ring buffer of N
capture files; as each capture file reaches its maximum size (the ring
buffer works only with a maximum capture file size specified), Ethereal
rolls over to the next capture file in the ring buffer, replacing
whatever packets might be in it with new packets.

svn path=/trunk/; revision=4323
2001-12-04 08:26:00 +00:00
Guy Harris a1660d6d3a Support for stopping capture at specified capture file size or capture
duration, from Thomas Wittwer and Matthias Nyffenegger.

svn path=/trunk/; revision=4322
2001-12-04 07:32:05 +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 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 2833a57f09 You have to define "htolell()" on little-endian platforms, too....
svn path=/trunk/; revision=3028
2001-02-13 07:07:17 +00:00
Guy Harris b3f35be74a Changes from Chris Jepeway to
in some places use "guint64", on plaforms where it's available,
	rather than floating point (we don't yet use it universally, as
	we'd have to provide code to do 64-bit arithmetic on
	platforms/compilers where 64-bit integral types aren't
	supported);

	use .838096 microseconds rather than 1 microseconds as the time
	stamp units for NetXRay 2.x format, as those capture files seem
	to use that time stamp (that's the Sniffer "PC" time stamp;
	perhaps when Network Associates assimilated Cinco, they changed
	the time stamp units).

svn path=/trunk/; revision=3027
2001-02-13 00:50:05 +00:00
Guy Harris 00beb21eca "wtap_loop()" no longer has problems with packet offsets of 0, so we
don't need to work around that.

The offset, for a given packet, at which "ascend_seek()" should start
searching for that packet's header must be computed separately from the
offset, for that packet, at which "ascend_seek()" should start searching
for the *next* packet - if the file is a "wdd" capture, and the packet
has a "Date:" header and a WD_DIALOUT_DISP header, the search for that
packet should start at the beginning of the "Date:" header, but the
search for the next packet should start after the WD_DIALOUT_DISP
header, as if we start it after the "Date:" header, the search will stop
at the packet's own WD_DIALOUT_DISP header, as a packet could have a
WD_DIALOUT_DISP header but no "Date:" header.

svn path=/trunk/; revision=2620
2000-11-12 08:45:28 +00:00
Gilbert Ramirez e191760a7b Add support for reading pppd log files in wiretap.
svn path=/trunk/; revision=2448
2000-09-19 17:22: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
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
Laurent Deniel 6a480953a9 Miscellaneous code cleaning
- add <stdarg.h> or <varargs.h> in snprintf.h
  and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes

- remove the check of multiple inclusions in source (.c)  code
  (there is a bit loss of _cpp_ performance, but I prefer the gain of
   code reading and maintenance; and nowadays, disk caches and VM are
   correctly optimized ;-).

- protect all (well almost) header files against multiple inclusions

- add header (i.e. GPL license) in some include files

- reorganize a bit the way header files are included:

  First:
  #include <system_include_files>
  #include <external_package_include_files (e.g. gtk, glib etc.)>
  Then
  #include "ethereal_include_files"

  with the correct HAVE_XXX or NEED_XXX protections.

- add some HAVE_XXX checks before including some system header files

- add the same HAVE_XXX in wiretap as in ethereal

Please forgive me, if I break something (I've only compiled and regression
tested on Linux).

svn path=/trunk/; revision=2254
2000-08-11 13:37:21 +00:00
Guy Harris 4df46758e3 If we have a random stream open for a compressed Sniffer file, have the
sequential pass through the file build a list of information about the
compressed blobs, with the starting offset in the compressed file and in
the uncompressed byte stream for each blob.

When seeking on the random stream, check whether the target location is
within the uncompressed buffer we currently have; if not, use that list
to figure out which blob contains the target location, and read that
blob into the buffer.  Then, as we now know that the target location is
within the uncompressed buffer we currently have, just move the current
pointer into that buffer to the target location.

This means we don't have to read forwards through any uninteresting
blobs in order to seek forwards, and don't have to go all the way back
to the beginning and seek forwards in order to seek backwards.

svn path=/trunk/; revision=2251
2000-08-11 07:28:12 +00:00
Mike Hall c83d80de36 Added wiretap support to read the Cisco Secure Intrusion Detection System IPLog format.
svn path=/trunk/; revision=2231
2000-08-08 22:16:42 +00:00
Guy Harris 7de3b988bd In the final scene of the horror movie, just when you think the monster
is finally dead, and you're walking away, it springs up again and
attacks.

It appears that the ss990915 version of Alexey Kuznetzov's libpcap patch
has some extra stuff in the per-packet header for some sort of SMP
debugging, and that SuSE Linux 6.3 picked it up.

Thus, even if a libpcap file has the modified magic number, we *still*
have to go through the usual heuristic hell to figure out what type of
file it is.

svn path=/trunk/; revision=2164
2000-07-26 06:04:34 +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