Commit Graph

24 Commits

Author SHA1 Message Date
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
Guy Harris 57839d9e4a Flag mp2t file as really having only relative time stamps. Put the
comment on its own line in mpeg.c as well.

svn path=/trunk/; revision=41294
2012-03-02 10:17:36 +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 e9fc1b72aa Use guint8 rather than guchar for raw octets and pointers to arrays of
same.

Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for
ATM (by looking at the VPI, VCI, and packet data, and guessing) and
Ethernet (setting the FCS length appropriately).  Use it for both pcap
and pcap-ng files.

svn path=/trunk/; revision=38840
2011-09-01 09:43:10 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
by the gunzipping code.  Have it also supply a err_info string, and
report it.  Have file_error() supply an err_info string.

Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to
suggest a decompression error - into the rawshark and tshark errors,
along the lines of what other programs print.

Fix a case in the Netscaler code where we weren't fetching the error
code on a read failure.

svn path=/trunk/; revision=36748
2011-04-21 09:41:52 +00:00
Guy Harris 4c93827e34 From Jakub Zawadzki:
file_read(buf, bsize, count, file) macro is compilant with fread
function and takes elements count+ size of each element, however to make
it compilant with gzread() it always returns number of bytes.

In wiretap file_read() this is not really used, file_read is called
either with bsize set to 1 or count to 1.

Attached patch remove bsize argument from macro.

svn path=/trunk/; revision=36491
2011-04-06 06:51:19 +00:00
Chris Maynard 9e49109b28 Check return value of file_seek(). Fixes CID 338.
svn path=/trunk/; revision=36425
2011-03-31 18:28:52 +00:00
Guy Harris 17392a865a Move the definitions of all the private data structures out of
wtap-int.h, and change the unions of pointers to those private data
structures into just void *'s.

Have the generic wtap close routine free up the private data, rather
than the type-specific close routine, just as the wtap_dumper close
routine does for its private data.  Get rid of close routines that don't
do anything any more.

svn path=/trunk/; revision=32015
2010-02-26 07:59:54 +00:00
Gerald Combs cc739fecb0 P64 fixes.
svn path=/trunk/; revision=27683
2009-03-09 21:18:55 +00:00
Jeff Morriss 74c02268d8 Add MP3 to the list of magic types
svn path=/trunk/; revision=25690
2008-07-09 19:15:50 +00:00
Stig Bjørlykke cb91244d0b Fixed some "shadowed variables", as pointed out by John Smith.
svn path=/trunk/; revision=25539
2008-06-23 20:06:20 +00:00
Jeff Morriss 58459d3fba Create a new "Wireshark utility" library and move the mpeg-audio stuff from
wiretap to this new libwsutil.  This solves
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1677 by making libwireshark
no longer depend on libwiretap.

svn path=/trunk/; revision=25330
2008-05-20 21:51:01 +00:00
Guy Harris 2c041a8fa4 Cast away shortening conversions that are presumed not to lose any data.
Use G_GINT64_CONSTANT() to make a 64-bit integral constant; not all
compilers we use support LL as a suffix for that (MSVC++ 6, for one).

svn path=/trunk/; revision=22580
2007-08-22 02:45:42 +00:00
Richard van der Hoff e6002deb3e From Shaun Jackman <sjackman@gmail.com> / bug 1753:
* asn1/mpeg/packet-mpeg-pes-template.c: Improved decoding of PES
        extension header and Pack header. Decode SCR, PTS, and DTS.
        * asn1/mpeg/mpeg-pes.asn (Pack): Remove.
        * epan/dissectors/packet-mpeg-pes.c: Regenerate.
        * wiretap/mpeg.c (mpeg_read): Decode the SCR using integer
        arithmetic instead of double float arithmetic to prevent rounding
        error.
        * wiretap/wtap-int.h (mpeg_t) <t0>: Use time_t instead of double.


svn path=/trunk/; revision=22577
2007-08-21 22:00:06 +00:00
Luis Ontanon 96f81d7eba From: Shaun Jackman
This patch adds MPEG PES (packetized elementary stream) to the list of
magic types in wiretap/mpeg.c.


svn path=/trunk/; revision=22460
2007-08-06 22:34:26 +00:00
Jaap Keuter 668689a69d Now it really can read MP3 files, without SIGABRT.
svn path=/trunk/; revision=22261
2007-07-06 22:27:03 +00:00
Guy Harris 48f03c7800 Get rid of a warning with at least some compilers.
svn path=/trunk/; revision=21489
2007-04-21 22:58:03 +00:00
Guy Harris 07d6794bea All private data for a capture in a Wiretap module must be per-file, not
static to the module.

Add the older(?) ID tag for MPEG audio.

Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.

If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).

Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.

svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
Luis Ontanon 4e7a4e0b06 make the mpeg_open() more conservative checking whether there's ssome magic bytes at the beginning of the file.
I added just one type of mpeg magic ("ID3") there's probably more, please add.

svn path=/trunk/; revision=21185
2007-03-25 19:00:59 +00:00
Ulf Lamping 636924e7c8 fix a new warning
svn path=/trunk/; revision=21128
2007-03-22 23:14:37 +00:00
Ronnie Sahlberg eac30afbec From Graham Bloice
Remove compiler warnings


svn path=/trunk/; revision=21115
2007-03-22 11:59:39 +00:00
Ronnie Sahlberg 80525da7db Add some missing includes and hope that msvc will find the definition for off_t
svn path=/trunk/; revision=21113
2007-03-22 11:33:18 +00:00
Ronnie Sahlberg 430eef27fe From Shaun Jackman
Wiretap support to read MPEG files


svn path=/trunk/; revision=21112
2007-03-22 10:44:33 +00:00