Commit Graph

127 Commits

Author SHA1 Message Date
Jeff Morriss f7e1f76659 From njtaylor0101 [AT] gmail.com via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6740 :
Fix an out-of-array-bounds warning from OpenBSD's compiler.  (Note: this is
actually a false positive since adequate memory is allocated.)

From me: some additional code simplification.

svn path=/trunk/; revision=40680
2012-01-24 02:20:46 +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 a8c363bd54 Try to squelch some compiler warnings.
svn path=/trunk/; revision=37673
2011-06-15 19:48:27 +00:00
Guy Harris c317a1c3cd Make all the fields in the various structures just arrays of bytes, so
we can cast not-necessarily-aligned pointers to pointers to those
structures without risk of compiler warnings *or* the underlying problem
the compiler's trying to warn us about (no, you can't always dereference
an unaligned pointer - SPARC traps, and at least some ARM processors may
do something other than what you want, for example).

This also caught some cases where we were not even properly
byte-swapping on big-endian platforms.

This also lets us not muck around with splitting 64-bit times into two
32-bit fields - we have pletohll(), after all.

svn path=/trunk/; revision=36787
2011-04-22 03:10:22 +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 2b8ebd389b "This file format can't be written to a pipe" and "this file format
can't be saved in compress form" are both equivalent to "this file file
format requires seeking when writing it".  Change the "can compress"
Boolean in the file format table to "writing requires seeking", give all
the entries the proper value, and do the checks for attempting to write
a file format to a pipe or write it in compressed format to common code.

This means we don't need to pass the "can't seek" flag to the dump open
routines.

svn path=/trunk/; revision=36575
2011-04-12 00:44:44 +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
Gerald Combs b2d28ce435 Fix checkapi.
svn path=/trunk/; revision=35955
2011-02-16 01:28:29 +00:00
Gerald Combs 8af7080001 Fix errors found by the Visual C++ analyzer.
svn path=/trunk/; revision=35954
2011-02-16 00:44:12 +00:00
Jaap Keuter d6c7ebee86 From Alexis La Goutte:
Replace all *_min()/*_max() by MIN() and MAX().

svn path=/trunk/; revision=34770
2010-11-04 06:37:58 +00:00
Guy Harris 194cfe2d2f Don't use fwrite directly when writing a dump file; call it through
wtap_dump_file_write().  Replace various wrappers around fwrite() with
wtap_dump_file_write(), or at least make the wrappers call
wtap_dump_file_write().

svn path=/trunk/; revision=33116
2010-06-06 22:19:30 +00:00
Stig Bjørlykke 7b1e97b64e Make it build without zlib on OSX.
svn path=/trunk/; revision=32472
2010-04-15 13:59:15 +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
Bill Meier cc43ff3835 From: Ravi Kondamuru:
"... a patch to make the netscaler wiretap code independent of the
 host system endian-ness. 
 I have taken care of (1) reading and writing nstrace files (netscaler.c) and
 (2) reading in dissector code (packet-nstrace.c) also."

See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3540#c26

svn path=/trunk/; revision=31171
2009-12-04 15:21:48 +00:00
Stig Bjørlykke e6a57f0107 Switch HighHdr and LowHdr to build correct absolute time.
svn path=/trunk/; revision=31005
2009-11-18 16:29:13 +00:00
Stig Bjørlykke 0eba377436 Another try to treat the two 32bit time values (low, high) in v23 format
as a 64bit value.

svn path=/trunk/; revision=31002
2009-11-18 07:48:03 +00:00
Guy Harris d393e03e07 If no error is returned by a Wiretap routine, err_info is presumed not
to have been set.  Do not set it to something g_mallocated in that case,
as that will cause a memory leak - the error string will not be freed by
the caller, as it's presumed not to have been set.

svn path=/trunk/; revision=31001
2009-11-18 06:36:13 +00:00
Stig Bjørlykke 99b8600eca From Ravi Kondamuru via bug 3540:
Treat the two 32bit time values (low, high) in v23 format as a 64bit value.

svn path=/trunk/; revision=30994
2009-11-17 18:23:40 +00:00
Stig Bjørlykke d9b405deb9 Optimized check if file is a nstrace file.
svn path=/trunk/; revision=28614
2009-06-02 20:59:48 +00:00
Stig Bjørlykke e12f08aa8b Corrected nspm_signature_version() again.
svn path=/trunk/; revision=28588
2009-06-02 09:23:48 +00:00
Stig Bjørlykke a9c95008c7 Avoid infinite loop in nspm_signature_version().
svn path=/trunk/; revision=28585
2009-06-02 08:47:45 +00:00
Stig Bjørlykke 496e7909ba Try Jakub's casting with GPOINTER_TO_INT().
svn path=/trunk/; revision=28579
2009-06-01 21:47:45 +00:00
Stig Bjørlykke 29839540cf Adding casts, take 3.
svn path=/trunk/; revision=28578
2009-06-01 21:26:50 +00:00
Stig Bjørlykke c5bba6e8d8 Adding casts, take 2.
svn path=/trunk/; revision=28576
2009-06-01 19:55:57 +00:00
Stig Bjørlykke c1ef7b0135 Added/Changed some more casts to build.
svn path=/trunk/; revision=28575
2009-06-01 19:46:40 +00:00
Stig Bjørlykke ffd02e49f5 Added some casts to remove some warnings.
svn path=/trunk/; revision=28573
2009-06-01 18:50:16 +00:00
Stig Bjørlykke c9b492a422 From Ravi Kondamuru via bug 3457:
Add support to read citrix netscaler capture file format.

From me:
- Renamed packet-ns.c to packet-nstrace.c
- Rewrote to not use "goto" in netscaler.c
- Moved dissecting of coreid

svn path=/trunk/; revision=28564
2009-06-01 17:23:38 +00:00