Commit Graph

24 Commits

Author SHA1 Message Date
Guy Harris 31d74c1922 Use the packet length read from the packet header, and check for an EOF
and treat it as an error, when reading packets randomly.

svn path=/trunk/; revision=54517
2013-12-31 23:30:39 +00:00
Jakub Zawadzki 01e08ae582 wiretap: start using <wsutil/pint.h>
svn path=/trunk/; revision=53764
2013-12-03 20:35:50 +00:00
Guy Harris 853da2eb9b The "file types" we have are actually combinations of types and
subtypes, e.g. Network Monitor version 1 and Network Monitor version 2
are separate "file types", even though they both come from Network
Monitor.

Rename various functions, #defines, and variables appropriately.

svn path=/trunk/; revision=53166
2013-11-08 09:53:01 +00:00
Guy Harris 8c9edf1280 Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.

This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.

svn path=/trunk/; revision=49949
2013-06-16 00:20:00 +00:00
Guy Harris 609dac2f9e Move some packet-header handling code into aethra_read_rec_header(), so
it's done in both the read and seek-read routines.

svn path=/trunk/; revision=49346
2013-05-16 21:40:04 +00:00
Guy Harris 88e9d1c1e5 Do not call wtap_file_read_unknown_bytes() or
wtap_file_read_expected_bytes() from an open routine - open routines are
supposed to return -1 on error, 0 if the file doesn't appear to be a
file of the specified type, or 1 if the file does appear to be a file of
the specified type, but those macros will cause the caller to return
FALSE on errors (so that, even if there's an I/O error, it reports "the
file isn't a file of the specified type" rather than "we got an error
trying to read the file").

When doing reads in an open routine before we've concluded that the file
is probably of the right type, return 0, rather than -1, if we get
WTAP_ERR_SHORT_READ - if we don't have enough data to check whether a
file is of a given type, we should keep trying other types, not give up.
For reads done *after* we've concluded the file is probably of the right
type, if a read doesn't return the number of bytes we asked for, but
returns an error of 0, return WTAP_ERR_SHORT_READ - the file is
apparently cut short.

For NetMon and NetXRay/Windows Sniffer files, use a #define for the
magic number size, and use that for both magic numbers.

svn path=/trunk/; revision=46803
2012-12-27 12:19:25 +00:00
Guy Harris 5996b49c53 Squelch implicit 64-bit-to-32-bit conversion warnings.
svn path=/trunk/; revision=46650
2012-12-21 03:32:16 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 33bb54a945 file_seek() used to be a wrapper around fseek() or gzseek(), both of
which could use lseek() and were thus expensive due to system call
overhead.  To avoid making a system call for every packet on a
sequential read, we maintained a data_offset field in the wtap structure
for sequential reads.

It's now a routine that just returns information from the FILE_T data
structure, so it's cheap.  Use it, rather than maintaining the data_offset
field.

Readers for some file formats need to maintain file offset themselves;
have them do so in their private data structures.

svn path=/trunk/; revision=42423
2012-05-04 16:56:18 +00:00
Anders Broman cd2c726c8c The User & Network direction is reversed https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6656
svn path=/trunk/; revision=41402
2012-03-07 17:02:27 +00:00
Guy Harris b6ff142f60 Add a presence flag field to the packet information structure filled in
by Wiretap, to indicate whether certain fields in that structure
actually have data in them.

Use the "time stamp present" flag to omit showing time stamp information
for packets (and "packets") that don't have time stamps; don't bother
working very hard to "fake" a time stamp for data files.

Use the "interface ID present" flag to omit the interface ID for packets
that don't have an interface ID.

We don't use the "captured length, separate from packet length, present"
flag to omit the captured length; that flag might be present but equal
to the packet length, and if you want to know if a packet was cut short
by a snapshot length, comparing the values would be the way to do that.

More work is needed to have wiretap/pcapng.c properly report the flags,
e.g. reporting no time stamp being present for a Simple Packet Block.

svn path=/trunk/; revision=41185
2012-02-25 23:24:34 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +00:00
Guy Harris bc3796b7ac Updates based on stuff seen in a new capture.
I'm leaving debug messages in, but #if 0'ed out, for now.

svn path=/trunk/; revision=39736
2011-11-04 23:59:07 +00:00
Guy Harris 42c2e1c57b It appears that the "packet" records are actually "stuff from the ISDN
link" records, including stuff that's from a G.704 PRI frame but not
from a D or H channel in that frame.  Handle them (currently, we ignore
them).

The low-order bit of the flags field for "packet" records" is "network
to user" (NT->TE), not "user to network" (TE->NT).

svn path=/trunk/; revision=39663
2011-10-28 22:57:33 +00:00
Guy Harris 83aed00fac The version string field isn't followed by 20 bytes of stuff; the last 8
bytes of what we thought was a version string appears to be an 8-byte
record of some sort in the captures we originally looked at, and appears
to be a non-8-byte record in another capture.  If we treat that as a
record, the version string field appears to be null-padded and 41 bytes
long.

svn path=/trunk/; revision=39645
2011-10-28 02:48:52 +00:00
Guy Harris c0db24bf4d Fix cut-and-pasteo that happened not to cause a problem on *P64
platforms but failed on *P32 platforms.

Remove the debugging code (the above was the problem in question).

svn path=/trunk/; revision=39628
2011-10-27 03:00:03 +00:00
Guy Harris a4e597b545 Add some debugging code; the current code doesn't work when compiled
with MSVC on Win32, and the fix will remove the debugging code as well.

svn path=/trunk/; revision=39624
2011-10-26 23:41:15 +00:00
Guy Harris 05269a7178 Put the magic number into the aethra_hdr structure, to avoid compiler
padding of the structure getting in the way (it should now not require
padding).

svn path=/trunk/; revision=39619
2011-10-26 20:53:27 +00:00
Guy Harris b4415758bf Ok, we found what appears to be the capture start time. Use it.
Also mark what appear to be strings in the file header.

svn path=/trunk/; revision=39591
2011-10-26 04:05:17 +00:00
Guy Harris 12e95e2cda It appears that the octet in the record header after the record length
might be a record type, with 0 being a "Stop Monitor" record and 1 being
a packet.  Ignore records other than packet records.

svn path=/trunk/; revision=39590
2011-10-26 03:14:21 +00:00
Guy Harris 72a96fc6a6 Avoid warnings.
svn path=/trunk/; revision=39589
2011-10-26 02:37:45 +00:00
Guy Harris e9ae3a0fd6 Initial support for .aps files from Aethra Telecommunications' PC108
software.  More work is needed:

	we don't know where the capture start time is yet;

	we aren't handling the "stop capture" record;

	we don't know where the ISDN channel is;

	there might be non-ISDN file formats;

but this at least is easier than trying to text2pcap hex dumps from that
software into pcap files.

svn path=/trunk/; revision=39588
2011-10-26 02:18:55 +00:00