Commit Graph

523 Commits

Author SHA1 Message Date
Guy Harris f180114360 Remove the "--without-gcc" option - it doesn't work with the Sun,
Digital UNIX, and HP C compilers, and it may not work with other
compilers (due to the GLib problem mentioned in the previous checkin),
so it runs the risk of being an "attractive nuisance", i.e. users may
try it, find it doesn't work, and then send mail to various Ethereal
mailing lists asking about it.

svn path=/trunk/; revision=4640
2002-01-30 23:48:53 +00:00
Guy Harris 595513d5cc Add a "--without-gcc" option, similar to what tcpdump and libpcap have.
(This isn't as useful for testing purposes as it is in tcpdump and
libpcap, as GLib is configured based on the compiler used to compile it,
so you can't necessarily build an application using GLib with a compiler
different from the one used to compile GLib, but we'll add it anyway.)

svn path=/trunk/; revision=4637
2002-01-30 23:01:33 +00:00
Guy Harris f560c48396 Bug fixes from Marc Milgram.
svn path=/trunk/; revision=4632
2002-01-30 18:58:04 +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 5cf3587feb Support a libpcap link-layer type of 17 as DLT_PFLOG unless DLT_LANE8023
is defined as 17.

svn path=/trunk/; revision=4617
2002-01-29 08:55:24 +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 32b4f58cd7 From Motonori Shindo: protect include of <netinet/in.h> with #ifdef
HAVE_NETINET_IN_H.

svn path=/trunk/; revision=4610
2002-01-25 09:44:52 +00:00
Guy Harris 886b4994ec Add support for ATM captures (based on writing one out and handing it to
NetMon 2.0; I don't have any ATM captures *from* NetMon to try it on, so
I don't know what significance the "destination address" and "source
address" fields have, but we can at least read the captures we ourselves
write out, as can NetMon).

svn path=/trunk/; revision=4606
2002-01-24 23:02:56 +00:00
Guy Harris 0a979b81b8 Get rid of "m"/"M" and other Macintosh references in names - it appears
that EtherPeek for Windows uses the same format as EtherPeek for MacOS,
so the code isn't specific to the MacOS version.

Check the physMedium value in the secondary header, and leave a
placeholder for a value of 1, which is presumably used in AiroPeek
captures.

Treat unknown mediaType and physMedium values as indications that we
don't have a *Peek file, not as unsupported *Peek files - we need all
the heuristics we can get.

svn path=/trunk/; revision=4601
2002-01-23 06:32:52 +00:00
Guy Harris be0b8a2d31 Fix up various product names and descriptions in the lists of file
formats we can read; include vendor names.

We should be able to read TokenPeek captures, as well as captures from
the Windows versions of EtherPeek.

Don't list the version numbers for EtherPeek and TokenPeek - those are
file format version numbers, not program version numbers.

svn path=/trunk/; revision=4599
2002-01-22 22:38:05 +00:00
Guy Harris 8d1812f93c From Alan Harrison: set "wth->phdr.pkt_encap" to "wth->file_encap" in
the V7-format read routine.

svn path=/trunk/; revision=4597
2002-01-22 20:01:07 +00:00
Guy Harris e6440c4f16 Fixes to EtherPeek file reader code, from Alan Harrison.
svn path=/trunk/; revision=4593
2002-01-21 23:45:58 +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 68115d6089 It's EtherPeek, not Etherpeek, as WildPackets' Web site indicates.
svn path=/trunk/; revision=4562
2002-01-18 00:48:37 +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
Guy Harris b8157b393c From Marc Milgram: fix to allow VMS TCPIPtrace files that don't have
exactly 3 spaces before the word "TCPIPtrace" to be recognized.

svn path=/trunk/; revision=4547
2002-01-15 20:18:02 +00:00
Guy Harris fc53c2b7b3 Oh, what the heck, write out FDDI and bit-swapped FDDI as the same type
in Sniffer Classic files; there's nothing we can do about those
platforms that bit-swap FDDI addresses before handing them to DLPI or
whatever, so we'll just let people live with wrong FDDI addresses (or
maybe someday put in code to bit-swap them before writing them out to
the capture file).

svn path=/trunk/; revision=4519
2002-01-11 02:51:31 +00:00
Gilbert Ramirez 573f3fb04a Provide a --disable-usr-local flag to configure so that
-I/usr/local/include and -L/usr/local/lib aren't automatically added
to the build flags.

svn path=/trunk/; revision=4507
2002-01-09 23:21:55 +00:00
Guy Harris 5e7698f322 From Marc Milgram: all packets in DBS Etherwatch and VMS TCPIPTRACE
captures are IP packets, so make the file encapsulation
WTAP_ENCAP_RAW_IP rather than WTAP_ENCAP_PER_PACKET, so you can save
those captures in other formats.

svn path=/trunk/; revision=4503
2002-01-08 22:30:29 +00:00
Gerald Combs e2106afbf2 VMS TCPIPtrace efficiency improvments, from Marc Milgram.
svn path=/trunk/; revision=4446
2001-12-24 17:00:01 +00:00
Guy Harris 2953cd1a97 From Irfan Khan: fix a couple of bugs in the pppdump reader.
svn path=/trunk/; revision=4414
2001-12-17 22:22:42 +00:00
Gilbert Ramirez d11f1dd6fb Get rid of newly-introduced signed/unsigned comparison warning.
svn path=/trunk/; revision=4392
2001-12-13 05:50:51 +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 39362af814 From Motonori Shindo:
fix a bogus batch mode inference rule of make, so that
	"vc60.pdb" files are created in the proper directory;

	delete ".pdb" files in a "nmake -f Makefile.nmake clean";

	include the text2pcap and mergecap ".pdb" files in the Windows
	binary distribution.

svn path=/trunk/; revision=4385
2001-12-12 01:29:13 +00:00
Guy Harris 291e50cea0 Fix white space.
svn path=/trunk/; revision=4359
2001-12-08 07:46:54 +00:00
Guy Harris f85f8bf466 Use "-no-cpp-precomp" rather than "-traditional-cpp" on MacOS X, as per
the "The Compiler and Tools" section on

	http://fink.sourceforge.net/doc/porting/basics.php

Do so on MacOS X regardless of whether the compiler is called "gcc" or
not, as that page also indicates that the compiler is installed as "cc".

svn path=/trunk/; revision=4354
2001-12-07 22:56:58 +00:00
Guy Harris 31519a0ff0 From Motonori Shindo: get rid of "send output to /dev/null" hack in
Ascend/Lucent trace reading code's Flex scanner.

svn path=/trunk/; revision=4346
2001-12-06 08:25:52 +00:00
Guy Harris fcdb378417 Update Gilbert's e-mail address.
svn path=/trunk/; revision=4340
2001-12-05 21:42:42 +00:00
Guy Harris faacd2b71c The data structure for per-packet headers for Mac V5 and V6 Etherpeek
files would put a 32-bit quantity on a 16-bit boundary without padding;
this means that many compilers will insert the padding and thus make the
structure not match what's in the file.

Instead of using a C structure, #define values for the offsets of
fields, read the header into an array of bytes, and extract values using
the offsets.

svn path=/trunk/; revision=4334
2001-12-05 07:19:11 +00:00
Guy Harris 2174f26cdc In the NetMon capture file reading code, if we get a short read when
trying to read the frame table, return -1 with "*err" set to
WTAP_ERR_SHORT_READ, don't return 0 - we've already decided that the
file is a NetMon file, so we shouldn't return a "this isn't a NetMon
file" indication, we should return a "this file is too short" error, as
that's what the problem is.

Fix up the error messages for WTAP_ERR_SHORT_READ to indicate that the
read might have gotten cut short in the middle of data other than a
packet.

svn path=/trunk/; revision=4331
2001-12-04 23:38:55 +00:00
Guy Harris bc225c2a87 Support for reading Visual Networks traffic capture files, from Tom
Nisbet.

Make a comment in "wiretap/file.c" clearer, so people know where to put
the entries for their capture file type.

svn path=/trunk/; revision=4328
2001-12-04 22:28:19 +00:00
Guy Harris 2e379072ec From Motonori Shindo: fix Ascend/Lucent trace reading code to handle
later trace formats that have an ASCII dump at the end of the line.

svn path=/trunk/; revision=4327
2001-12-04 10:07:30 +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
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
Guy Harris 16bb4350ff Back the previous hack out - the padding is often zero, but it's not
*always* zero, so it won't always work, and it's somewhat gross.  The
right answer is "don't use Digital/Tru64 UNIX's tcpdump, use
tcpdump.org's".

svn path=/trunk/; revision=4202
2001-11-14 22:54:26 +00:00
Guy Harris e96b689067 Throw in a hack to try to detect FDDI captures from Digital UNIX's
tcpdump and, if we think we've found one, strip off the 3 padding bytes
they put in front of the frame.

svn path=/trunk/; revision=4201
2001-11-14 22:34: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
Guy Harris 40b22f317b Wrap calls to "pcap_datalink()" in a routine that attempts to compensate
for AIX 5.x's non-standard libpcap, where "pcap_datalink()" doesn't
return DLT_ values, it returns RFC 1573 ifType values.

Put that wrapper, and the routine to get the interface list, in a
separate file, for packet-capture utility routines, so not everybody who
includes "util.h" needs to include <pcap.h>.

Fix up the Wiretap hack for dealing with said incompatibility to use the
correct ifType value for Token Ring.

svn path=/trunk/; revision=4184
2001-11-09 07:44:51 +00:00
Guy Harris b7d32da1eb Expand on the comments about AIX libpcap.
No, Nokia *weren't* kind enough to change the major or minor version
number in the capture file when they changed the format, just as they
weren't kind enough to change the magic number.

svn path=/trunk/; revision=4173
2001-11-07 08:16:26 +00:00
Guy Harris 6910b84deb Add in some heuristics to try to detect AIX libpcap format. (This works
with one capture I've seen, but perhaps that was done with an old
version of AIX, and newer versions use a minor version number, in the
file, of 4.

However, libpcap hasn't used a minor version of 2 for ages, so perhaps
AIX hasn't updated their libpcap in ages, and aren't about to do so
soon.  If they do, let's hope they change the magic number.  The capture
file in question *does* have the capture length and real length in the
old, pre-2.3, order, so it really looks as if it's an old version,
rather than IBM trying to be "helpful" by using a different minor
version number so that you can distinguish between normal libpcap and
AIX libpcap formats.)

svn path=/trunk/; revision=4164
2001-11-06 01:55:14 +00:00
Gilbert Ramirez 0326e32563 Support DLT_CISCO_IOS.
svn path=/trunk/; revision=4126
2001-11-02 13:00:30 +00:00
Guy Harris 1b526aa894 Include <unistd.h>, if we have it, to declare "unlink()".
svn path=/trunk/; revision=4094
2001-10-28 01:51:46 +00:00
Gilbert Ramirez f686502750 Interface type 0x07 is Ethernet.
svn path=/trunk/; revision=4078
2001-10-25 20:36:26 +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 9c0c25dc17 DBS Etherwatch wiretap module, from Marc Milgram.
svn path=/trunk/; revision=4042
2001-10-19 20:18:48 +00:00
Guy Harris 3c78feeadc VMS TCPIPtrace wiretap module, from Marc Milgram.
Update the lists of known capture file formats in the Tethereal,
editcap, and mergecap man pages to match the current list (as found in
the Ethereal man page).

svn path=/trunk/; revision=4039
2001-10-18 20:29:56 +00:00
Guy Harris f509ddeaa5 Don't create a Wiretap dump file unless we're at least sure we support
the specified encapsulation with the specified capture file type, and
that we can allocate a "wtap_dumper *".

If we could do all that, and could create the dump file, but the
file-type-specific create routine fails (e.g., because there's not
enough disk space to write out the header), remove the dump file.

svn path=/trunk/; revision=4032
2001-10-16 04:58: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 61568581bd We have our own internal versions of "gzgets()" and "gzgetc()", so we
don't need to check whether zlib has them.  We *do*, however, have to
check for "gzseek()", as we don't have our own version of that.

svn path=/trunk/; revision=3963
2001-09-28 05:41:45 +00:00
Guy Harris c80cd072ac Update the URL for ATM-on-Linux.
svn path=/trunk/; revision=3949
2001-09-23 21:55:21 +00:00
Ashok Narayanan 29c8fa03b3 Removed the dependency on gzgetc and gzgets by implementing internal
versions of these commands in file_wrappers.c. This allows us to
compile successfully even on platforms where X has an older zlib built
in.

Removed this restriction from acinclude.m4

svn path=/trunk/; revision=3948
2001-09-20 16:36:45 +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
Gilbert Ramirez aacb4d90f0 Use system's version of AM_PATH_GLIB macro.
Optimize use of AC_CHECK_FUNC in wiretap/acinclude.m4
Move #include "config.h" to be first include in some files.
From albert chin (china@thewrittenword.com)

svn path=/trunk/; revision=3857
2001-08-20 15:23:34 +00:00
Guy Harris 4533ae7c55 If there's no "zlib.h" header, we won't be using zlib, so don't bother
checking for "gzgets()" in zlib.

If there is a "zlib.h" header, and there is a "gzgets()" in zlib, check
whether we find "gzgets()" in zlib when we link with the GTK+ link
flags, and, if not, fail.  People often grab XFree86 source and build
and install it on their systems, and they appear sometimes to
misconfigure XFree86 so that, even on systems with zlib, it assumes
there is no zlib, so the XFree86 build process builds and installs its
own "mini-zlib" in the X11 library directory.  The "mini-zlib" lacks
"gzgets()", and that's the zlib with which Ethereal gets linked, so the
build of Ethereal fails.

svn path=/trunk/; revision=3849
2001-08-18 20:09:44 +00:00
Guy Harris 5bb08b0970 Fix AC_ETHEREAL_PCAP_CHECK so that, if a directory was specified with
"--with-pcap", it adds the "include" subdirectory of that directory to
the list of directories to search for include files, rather than adding
the directory itself.

Check whether libpcap defines "pcap_version", and define
HAVE_PCAP_VERSION if it does.  Use "pcap_version" iff HAVE_PCAP_VERSION
is defined, rather than special-casing MacOS X.

Don't #define a string for the WinPcap version; just leave
HAVE_PCAP_VERSION undefined on Windows, as WinPcap 2.2beta is out, so we
can no longer assume that the Windows version of Ethereal is using
WinPcap 2.1.

svn path=/trunk/; revision=3792
2001-07-27 07:10:13 +00:00
Guy Harris ae251f8426 MacOS support changes, from Michael Tuexen (with some modifications):
replace "--with-plugindir" with "--with-plugins", and have the
	plugin directory optional - this allows plugins to be disabled;

	add "--traditional-cpp" on MacOS X/Darwin (Apple's "cc" compiler
	requires it, for some annoying reason, even though it is, as far
	as I know, GCC-based, and other GCC's don't require it);

	on MacOS X, don't use "pcap_version[]", as, for some annoying
	reason, libpcap on MacOS X doesn't define it.

Clean up some whitespace in the help messages for the configure script.

Move the AM_CONDITIONAL for SETUID_INSTALL after the point at which
"enable_setuid_install" is set, as it tests "enable_setuid_install".

svn path=/trunk/; revision=3788
2001-07-26 07:25:49 +00:00
Guy Harris b7255e108a Fixes, from Scott Renfro, for some calls to "localtime()" that didn't
check whether the call succeeded (it doesn't always do so on Windows,
for example).

svn path=/trunk/; revision=3722
2001-07-15 19:14:03 +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 42f88b6693 Remove a comment that no longer applies - we no longer seek forward in
compressed Sniffer files by sequentially moving forward, and we no
longer seek backward by seeking to the beginning and then seeking
forward to the new position, we now seek to the beginning of the
compressed block that contains the target position, if we're not already
in that block, and then move to the appropriate position in that block.

svn path=/trunk/; revision=3658
2001-07-06 00:17:36 +00:00
Guy Harris 42f55e0208 "wtap_file()" is no longer in Wiretap, so don't try to export it from
the Wiretap DLL.

svn path=/trunk/; revision=3655
2001-07-05 20:57:09 +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 c932345421 Replace "--enable-pcap" with "--with-pcap", and if an argument is
specified to "--with-pcap", add that directory to the include file and
library search paths, so that you can use "--with-pcap=DIR" to search
for libpcap in a directory other than the standard ones (either because
it was installed somewhere other than under "/usr" or "/usr/local", or
because you want to use a special version you've installed rather than
the standard one).

svn path=/trunk/; revision=3611
2001-06-27 07:47:50 +00:00
Guy Harris 288053a6db Patch from Chris Jepeway to use, in NetXRay 2.x captures, a field from
the file header to specify the time units; different files appear to
have different time stamp units.

svn path=/trunk/; revision=3407
2001-05-09 04:42:27 +00:00
Gilbert Ramirez 3277a5255a Distribute wtap.def
svn path=/trunk/; revision=3330
2001-04-18 21:34:22 +00:00
Gilbert Ramirez 6c89e58e7f #define YY_NEVER_INTERACTIVE to avoid reference to isatty() on Win32,
and thus avoid a compiler warning when compiling ascend-scanner.c.

svn path=/trunk/; revision=3322
2001-04-18 03:03:42 +00:00
Guy Harris 3782799323 As of GLib 1.2.9, you won't automatically get "-I/usr/local/include" and
"-L/usr/local/lib" added to CFLAGS and LDFLAGS merely as a result of
running AM_PATH_GLIB, as 1.2.9 and later don't install headers directly
under "/usr/local/include".  Therefore, we have to put
"-I/usr/local/include" into CFLAGS ourselves, just as we do in the
top-level configure script, or we run the risk of not being able to find
other packages (libpcap, zlib, etc.) if it's installed under
"/usr/local".

svn path=/trunk/; revision=3318
2001-04-17 22:47:37 +00:00
Guy Harris d73302ad9b Fix the e-mail address for Joerg Mayer (and remove it from files he
wasn't involved with).

svn path=/trunk/; revision=3311
2001-04-17 00:46:06 +00:00
Guy Harris aedaabc8c8 GCC 2.95.1 on SPARC/Solaris, at least, is clever enough to figure out
that the loop in "lanalyzer_open()" is an infinite loop, so the "return
0;" at the end isn't necessary to suppress a compiler warning with that
compiler - and Sun C not only figures it out, it warns that the
"g_assert_not_reached()" and the "return 0;" are unreachable, so I'll
take them out for now (and put them back if my older GCC at home still
requires it to suppress warnings).

svn path=/trunk/; revision=3310
2001-04-16 22:06:34 +00:00
Guy Harris 122ed97b4a The "data" member of a Buffer structure is a "u_char *"; when assigning
the result of a "g_malloc()" to it, cast it to "u_char *", not "char *".

svn path=/trunk/; revision=3309
2001-04-16 21:59:38 +00:00
Gilbert Ramirez b6bd7af57a Improvement of 'make clean' targets.
svn path=/trunk/; revision=3297
2001-04-12 18:07:22 +00:00
Gerald Combs 5b9ad66cb8 Add support for "version 7" wandess output. Actually, I think it's
simply PPP data that doesn't have a username associated with it, e.g. for
a dedicated WAN link as opposed to a dialup link.

svn path=/trunk/; revision=3274
2001-04-09 03:32:34 +00:00
Gilbert Ramirez b71792efa4 Build with zlib.
Pre-compiled zlib provided at
	http://www.ethereal.com/distribution/win32/zlib-1.1.3-fixed.zip
"fixed" because the pre-compiled version in the "extralibs" package
from the Gimp/Win32 page has a fault zlib.lib in it.

Add note about zlib in README.win32; more work needs to be done to
this file to mention new packaging method.

svn path=/trunk/; revision=3263
2001-04-06 03:52:45 +00:00
Gilbert Ramirez a8d864bca7 Use sed in the Win32 build to place the version in various files.
We us $(VERSION), defined in the top-level config.nmake, to replace
@VERSION@ in various files. $(RC_VERSION) and $(WTAP_VERSION) are
similarly used.

svn path=/trunk/; revision=3258
2001-04-05 04:39:29 +00:00
Guy Harris 289f57e570 Back out the guint64 stuff - it's not clear it's the right way to handle
this, as

	1) we still need to handle platforms that don't support 64-bit
	   integral data types, so we still needed the old stuff in some
	   fashion anyway

and

	2) MSVC appears to treat structures as requiring 8-byte
	   alignment in some cases, and "guint64"s require 8-byte
	   alignment on at least some platforms, forcing structures
	   containing those 64-bit time stamps to have a size that's a
	   multiple of 8 bytes, which *isn't* the correct size for the
	   data record header.

svn path=/trunk/; revision=3177
2001-03-23 23:16:29 +00:00
Gilbert Ramirez e108afe2bb The Win32 build builds wiretap as a DLL and requires WinPcap 2.1.
svn path=/trunk/; revision=3163
2001-03-23 02:05:29 +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 ed3b9031f6 Handle NetBSD Cisco HDLC as PPP, for now.
svn path=/trunk/; revision=3125
2001-03-11 02:51:05 +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 9b1133892b Close the random stream, not just the sequential stream, if we got an
error trying to open a file.

svn path=/trunk/; revision=3122
2001-03-09 07:11:38 +00:00
Guy Harris 561f935663 Include "etherpeek.h", which declares routines we define, not "snoop.h",
which declares routines we neither define nor use.

svn path=/trunk/; revision=3121
2001-03-09 06:34:59 +00:00
Guy Harris 99ec31082e Etherpeek version 5, 6, and 7 support, from Daniel Thompson.
svn path=/trunk/; revision=3066
2001-02-22 22:03:31 +00:00
Guy Harris 33ca70bed1 Sigh. Microsoft Visual C++ 6.0 won't convert a "guint64" to a "double"
- it only allows you to convert a *signed* 64-bit integer to a "double".
Cast the result of "pletohll()" to "gint64" before returning it from a
function that returns a "double".

svn path=/trunk/; revision=3033
2001-02-14 09:38:10 +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 67fb533233 "autoheader" recognizes AC_CHECK_HEADERS as a macro that defines
HAVE_XXX_H if xxx.h is present, but doesn't recognize AC_CHECK_HEADER as
such, and thus doesn't put anything about HAVE_XXX_H into "config.h.in",
and thus HAVE_XXX_H doesn't get defined even if xxx.h is present.

svn path=/trunk/; revision=2942
2001-01-27 23:47:16 +00:00
Guy Harris f72f3b7861 Finish up support for writing NetMon 2.x capture files.
(We really need to put in some rudimentary 64-bit integer support, for
the benefit of platforms+compilers that don't support it; the
floating-point calculations we're doing now appear not to get exactly
the right answer, from an experiment at reading a NetMon 2.x file and
writing it back out as NetMon 2.x with editcap.)

svn path=/trunk/; revision=2939
2001-01-25 21:47:23 +00:00
Guy Harris bb2b650c9b Update a comment to reflect reality (we no longer skip all the extra
headers, we look at REC_HEADER2 records).

svn path=/trunk/; revision=2911
2001-01-17 21:29:53 +00:00
Jeff Foster 27bc256702 Fixed potential buffer overflow in skip_header_records when processing
REC_HEADER2 encapsulation type.

Modified skip_header_records to accept REC_HEADER3-REC_HEADER7.
These header records would cause file read error if the capture file was
compressed.

svn path=/trunk/; revision=2910
2001-01-17 18:58:42 +00:00
Guy Harris 2fba1a4a8c Update a comment to reflect reality (we no longer skip all the extra
headers, we look at REC_HEADER2 records).

svn path=/trunk/; revision=2904
2001-01-16 20:26:26 +00:00
Jeff Foster 5ff4d8a721 Moved settingg wth->file_encap from sniffer_encap to precede the
skip_header_records call because skip_header_records function
may set the field based upon the header records

svn path=/trunk/; revision=2903
2001-01-16 20:12:30 +00:00
Guy Harris 5da16b932a Code to get a putative network subtype from a type 7 record in an
"Internetwork analyzer" capture, from Jeff Foster.  (It's not a
replacement for the heuristics, as

	1) at least one PPP capture doesn't have a type 7 record

and

	2) LAPB/X.25 and LAPD/ISDN might both be "HDLC" captures and
	   we'd need to figure out how to tell them apart.)

svn path=/trunk/; revision=2902
2001-01-16 09:17:34 +00:00
Guy Harris b5477dc71c Fix up Gerald's e-mail address to be his "ethereal.com" address.
svn path=/trunk/; revision=2859
2001-01-10 10:11:27 +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
Gilbert Ramirez a36915da20 Fix for pppdump buffer-overflow check.
From Daniel Thompson <daniel.thompson@st.com>

svn path=/trunk/; revision=2748
2000-12-09 03:02:43 +00:00
Guy Harris 5a8c21a217 Catch Sniffer packets where the record length for a record containing a
packet is too small to contain all the data that the frame header claims
was captured for the packet; treat that as a bad record, and return an
error.

svn path=/trunk/; revision=2711
2000-11-29 08:24:14 +00:00
Guy Harris b4219afa51 Generated Bison and Flex files test whether __STDC__ is defined
in order to check whether to use ANSI C features such as "const".

GCC defines it as 1 even if extensions that render the implementation
non-conformant are enabled; Sun's C compiler (and, I think, other
AT&T-derived C compilers) define it as 0 if extensions that render
the implementation non-conformant are enabled; Microsoft Visual C++
6.0 doesn't define it at all if extensions that render the implementation
non-conformant are enabled.

We define it as 0 in "config.h.win32", so that those generated files will use
those features (and thus not get type warnings when compiled with
MSVC++).

svn path=/trunk/; revision=2698
2000-11-22 07:20:27 +00:00
Gilbert Ramirez 90e0fb129d Change Ethereal homepage URL from etheral.zing.org to www.ethereal.com.
svn path=/trunk/; revision=2696
2000-11-22 04:07:04 +00:00
Gerald Combs 6cbf7512cb Add an overflow check to process_data().
svn path=/trunk/; revision=2675
2000-11-19 20:56:17 +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 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
Olivier Abad 245f7d30ab Support for the BASE100 and GSC100BT subsystems by Jeff Foster.
svn path=/trunk/; revision=2640
2000-11-13 23:02:24 +00:00
Olivier Abad 87205b018f Improve the detection of the encapsulation used in a radcom file.
svn path=/trunk/; revision=2639
2000-11-13 23:00:55 +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
Guy Harris 3d7d4a297d Not all packets in a "wdd" dump necessarily have a "Cause an attempt to
place call to" header (I presume this can happen if there was a call in
progress when the packet was sent or received); don't require the

	Date: 01/12/1990.  Time: 12:22:33
	Cause an attempt to place call to 14082750382

to be present in every packet.

(Only the date on the first packet is used, and only if it's present in
the first packet; if the first packet doesn't have a date, we can't
easily go back and fix up the previous packets, *especially* in programs
such as Tethereal and editcap which make only one pass through the
capture.

We set the called number to a null string if that's the case; we could
assume, in the sequential pass, that it's the phone number from the last
call, and remember that for use when doing random access.)

svn path=/trunk/; revision=2617
2000-11-12 04:57:39 +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
Guy Harris 81566ec823 In "wdd" captures:
fix the interpretation of the date and time reported in capture
	files;

	use that date and time only to set the start date and time of
	the capture, not to generate the time stamp for every packet.

Make the "struct tm" used for that local to the code to handle that
production in the grammar, rather than global.

For all captures, we *can* now fstat a compressed file (and have been
able to do so for a while, in fact), so revert to doing so and using the
ctime of the capture file if we can't get a date and time from the
file's contents.

svn path=/trunk/; revision=2605
2000-11-11 03:15:07 +00:00
Guy Harris 6ba1bf3f83 Add some comments, and fix one comment.
Remove what appear to be a pair of dangling "else"s.

Before calling "mktime()" on a "struct tm", you have to set "tm_isdst",
so it knows what to do about daylight savings time; set it to -1, so it
picks the appropriate time (except, presumably, for those times that
don't exist, when the clock is moved forward, where there is no
appropriate time, and those times that exist twice, when the clock is
moved backward, where there are *two* times and you can't tell which is
appropriate).

svn path=/trunk/; revision=2604
2000-11-11 01:44:05 +00:00
Gerald Combs c83c84fffb Add initial support for "type 12" frames. I have no documentation for
these other than a trace file a client sent me.  The header appears to
be similar to frame2 and frame4 records, but with extra bytes at the end.
The trace file also contains record types 13 - 17 which appear to contain
metainformation such as retransmit counts.

svn path=/trunk/; revision=2508
2000-10-17 18:07:52 +00:00
Guy Harris fc1ed4cd4b Do checks for platform-specific compiler flags in the libethereal and
wiretap configure scripts as well as in the main configure script.

svn path=/trunk/; revision=2501
2000-10-17 07:30:35 +00:00
Guy Harris 81c030d01a Wiretap no longer works with "GLib 1.0[.x]" (the version that came
bundled with GTK+ 1.0[.x]), it works only with 1.2[.x] and later, so we
no longer need to check for 1.0[.x] and define HAVE_GLIB10.

svn path=/trunk/; revision=2500
2000-10-17 00:09:43 +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
Guy Harris f881e13932 Windows Sniffers appear to write out ATM traces with a network type of
8, which is NDIS's ATM type.  At least one capture appears to have
LLC-encapsulated frames in it; for now, we'll map it to
WTAP_ENCAP_ATM_RFC1483 - and make Ethereal dissect
WTAP_ENCAP_ATM_RFC1483 by handing the frames to "dissect_llc()".

While we're at it, we'll have Ethereal panic if handed a Wiretap packet
type it doesn't dissect, rather than giving you a rather blank
dissection.

svn path=/trunk/; revision=2457
2000-09-23 05:58:26 +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
Gilbert Ramirez 565a28497a Mention support for reading pppd log files.
svn path=/trunk/; revision=2452
2000-09-20 12:09:52 +00:00
Gilbert Ramirez e0139fc43b Oh well, get rid of the debug printf's.
svn path=/trunk/; revision=2450
2000-09-19 17:35:08 +00:00
Gilbert Ramirez 8fa85bbd2f Add pppdump.obj to win32 makefile.
svn path=/trunk/; revision=2449
2000-09-19 17:27:08 +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
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
Guy Harris 726da14b05 Close the handle for the SNMP library after we're done with it - shared
objects are reference-counted so that won't make it disappear if
Ethereal is also linked with it as a shared SNMP library.

svn path=/trunk/; revision=2444
2000-09-17 07:50:35 +00:00
Guy Harris 6eccd35505 Code to read capture files from some version of tcpdump from some sort
of Nokia box (firewall) - yep, it's yet *another* mutant libpcap format
that didn't change the magic number, sigh....

svn path=/trunk/; revision=2440
2000-09-15 07:52:43 +00:00
Graham Bloice 0ae9cce784 Updated to ignore Win32 detritus
svn path=/trunk/; revision=2430
2000-09-13 22:03:52 +00:00
Guy Harris e4fd931dde Add support for NetBSD DLT_PPP_SERIAL, which has the value 50, and which
is, for now, handled as WTAP_ENCAP_PPP (although we may have to split
WTAP_ENCAP_PPP into more than one type at some point).

svn path=/trunk/; revision=2423
2000-09-12 18:35:47 +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 14a6294e69 Re-arrange size and nmemb arguments in fread() (file_read()) calls so
that these calls work on Win32. I still don't have a good reason as to
why this is necessary, but it fixes the problem. I'll continue looking
for a reason.

svn path=/trunk/; revision=2386
2000-08-31 16:44:47 +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 5e52e98926 Redo the way we map between libpcap encapsulation type codes and Wiretap
encapsulation type codes - for those libpcap type codes whose numerical
value is interpreted differently by different versions of libpcap,
include <pcap.h> if you can and, if you can, use what it defines to
control which Wiretap code we map those type codes to.

Also, map the new libpcap type codes introduced by libpcap 0.5.

svn path=/trunk/; revision=2369
2000-08-25 06:25:21 +00:00
Gilbert Ramirez b27ce4e859 More mention of csids support in wiretap.
svn path=/trunk/; revision=2335
2000-08-22 06:50:16 +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
Mike Hall 32eb1e4b8a The caplen and iplen are not always going to be equal. Need to use > and <= instead of != ==.
svn path=/trunk/; revision=2273
2000-08-15 18:19:06 +00:00
Guy Harris 7810e860d6 Initialize "last_blob" and "current_blob" when the file is opened.
Set "current_blob" when the first read is done from the random file, as
"current_blob" is the current blob in the random file.

svn path=/trunk/; revision=2262
2000-08-12 07:12:46 +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
Gilbert Ramirez afc31a3c22 Mention IDSN4BSD's i4btrace utility as a supported trace file format.
svn path=/trunk/; revision=2203
2000-08-04 05:17:18 +00:00
Guy Harris 3b56e37043 Add a comment explaining why we're defining S_ISDIR and company.
svn path=/trunk/; revision=2189
2000-07-31 04:48:54 +00:00
Guy Harris a459c2bea7 It appears that, at least with Visual C++ 6.0, the "stat()" supplied in
the C run-time library sets "statb.st_mode" appropriately, at least for
plain files and directories; it just doesn't offer the POSIX "S_ISxxx()"
macros to test the file type.

If those macros aren't defined (which might also be the case on really
ancient UNIX systems), define them appropriately, and use them even on
Win32 systems, so that we can properly report attempts by a user to read
from a directory on Win32, just as we do on UNIX.

svn path=/trunk/; revision=2188
2000-07-31 04:19:54 +00:00
Guy Harris 0b406c38ba In "buffer.h", include <winsock.h> if we have it, so that "u_char" is
defined on Win32 systems - it's not defined in <sys/types.h> on those
systems.

In "buffer.c", include "config.h", to cause HAVE_WINSOCK_H to be
defined, on systems that have it, so that we include it in <buffer.h>.

svn path=/trunk/; revision=2187
2000-07-31 04:15:58 +00:00
Olivier Abad 9348644164 Support for capturing packet data from a pipe (a FIFO, or standard input).
capture.c :
- modified capture() to try to open an interface as a pipe if pcap_open_live()
  failed, and then read data in libpcap format from this pipe ;
- add new functions used by capture() : pipe_open_live() and pipe_dispatch()
  which are equivalents to the pcap_ functions.

libpcap.[ch] :
- moved the MAGIC and headers definitions from libpcap.c to libpcap.h
  because capture() now needs it.

svn path=/trunk/; revision=2181
2000-07-30 16:54:12 +00:00
Guy Harris ec9f9cb687 Add a script, "aclocal-flags", which figures out where
1) aclocal expects autoconf/automake macros to be hidden;

	2) GTK+ hid its autoconf/automake macros;

and, if both places exist but aren't the same directory, returns a "-I"
flag to tell aclocal to look in GTK+'s directory.

Then have "autogen.sh", and Makefiles in directories with "acinclude.m4"
files, use that script and pass what flag it supplies, if any, to
aclocal.

This should, I hope, avoid problems such as those FreeBSD systems where
GTK+ was installed from a port or package (and thus stuck its macros in
"/usr/X11R6/share/aclocal") but aclocal doesn't look there.

(It doesn't solve the problem of somebody downloading and installing,
say, libtool from source - which means it probably shows up under
"/usr/local", with its macros in "/usr/local/share/aclocal" - on a
system that comes with aclocal (meaning it probably just looks in
"/usr/share/aclocal", but that may be best fixed by, whenever you
download a source tarball for something that's part of your OS,
configuring it to install in the standard system directories and
*overwriting* your OS's version.)

svn path=/trunk/; revision=2165
2000-07-26 08:03:57 +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 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
Guy Harris e068b7dbe7 In Tethereal:
When capturing, report errors trying to create the output file
	with "file_open_error_message()".

	Make the "for_writing" argument to "file_open_error_message()" a
	"gboolean", as it's either TRUE (if the file is being opened for
	writing) or FALSE (if it's being opened for reading).

	Report EISDIR as "XXX is a directory (folder), not a file.".

When checking whether an "open()" of a capture file succeeded, check
whether "open()" returns a negative number, not whether it returns 0.

In "wtap_open_offline()", if the file to be opened is a directory,
return EISDIR, not WTAP_ERR_NOT_REGULAR_FILE, so that the error message
can say "that's a directory, not a file".

If "wtap_open_offline()" returns WTAP_ERR_NOT_REGULAR_FILE, don't just
say the file is "invalid", say it's a "special file" or socket or some
other weird type of file.

svn path=/trunk/; revision=2144
2000-07-20 09:39:43 +00:00
Guy Harris 352246de2f Don't reposition the random stream in "ngsniffer_open()" if there isn't
a random stream open.

svn path=/trunk/; revision=2097
2000-06-28 03:58:52 +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 ae1f565029 Joerg Mayer's changes to add support for NetXRay file format version
2.002, as used by release 3.50 of the Network Associates Sniffer for
Windows; currently, we treat it just like the 2.001 version, so we
rename the version #define WTAP_FILE_NETXRAY_2_001 to
WTAP_FILE_NETXRAY_2_00x and use that for both 2.001 and 2.002.

svn path=/trunk/; revision=2087
2000-06-24 05:32:48 +00:00