aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2011-04-22Cast away warnings about "struct sockaddr" -> "struct sockaddr_XXX"Guy Harris1-2/+10
casts that are actually safe. svn path=/trunk/; revision=36788
2011-04-22Make all the fields in the various structures just arrays of bytes, soGuy Harris1-100/+108
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-21In a dump_open routine, you don't need to seek to the beginning of theGuy Harris2-8/+4
file before doing any writes - it starts out at the beginning of the file. This means that you *can* write a Network Instruments capture file to a pipe, or write it out in compressed form, now that its dump_open routine no longer seeks. NetXRay format and K12 binary format, however, *do* require a seek when writing them. svn path=/trunk/; revision=36776
2011-04-21In file_wrappers.c, explicitly set err_info to null for all errors thatGuy Harris3-22/+21
don't have an "additional information" string. Get rid of WTAP_ERR_ZLIB; just report an internal error with WTAP_ERR_INTERNAL instead. (If they start happening, we can think about supplying an "additional information" string for compression errors on output.) svn path=/trunk/; revision=36774
2011-04-21Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discoveredGuy Harris46-547/+656
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-20Always check whether NEXT() failed - and rename it to GZ_GETC(), as itGuy Harris1-44/+169
has semantics similar to getc(). If it fails due to an EOF, set state->err to WTAP_ERR_SHORT_READ to report a premature EOF; otherwise, raw_read() has already set state->err, so don't set state->err to something else - that loses the errno value in favor of a generic "bad data" error. svn path=/trunk/; revision=36744
2011-04-20Sigh. The "data" element of a GArray is, alas, a "gchar *", not a "voidGuy Harris1-4/+4
*", and some compilers complain when you cast that pointer to something requiring stricter alignment. Maybe the intent is to nudge you into thinking about whether the pointer really is properly aligned, but.... svn path=/trunk/; revision=36739
2011-04-20pntohll() takes a guint8 * as an argument; there's no need to cast to aGuy Harris1-1/+1
guint64 *, and it causes clang to complain. svn path=/trunk/; revision=36738
2011-04-19Unbreak live capture using pcapng.Michael Tüxen1-1/+5
svn path=/trunk/; revision=36714
2011-04-18Wrap actual_len inside #ifdef DEBUG_K12 to avoid gcc 4.6.0 warning reported byChris Maynard1-2/+8
Kaul: http://www.wireshark.org/lists/wireshark-dev/201104/msg00170.html svn path=/trunk/; revision=36710
2011-04-18Update Motonori Shindo's email address at the author's request. Fixes bug 5840.Chris Maynard3-3/+3
svn path=/trunk/; revision=36695
2011-04-17Mark err as unused in k12text_dump_open().Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=36682
2011-04-15Return ENOMEM if we run out of memory. (We're either running on UN*X,Guy Harris1-3/+7
in which case ENOMEM is the right error, or we're running on Windows but using UN*Xy routines, in which case ENOMEM is the right error; unlike zlib, we don't have to run on a whole pile of OSes.) svn path=/trunk/; revision=36648
2011-04-14Export new file_...() functions from libwiretap.dllTomas Kukosa1-0/+9
svn path=/trunk/; revision=36640
2011-04-14Check for _setmode() failing, Just In Case. Squelches some MSVC staticGuy Harris1-10/+32
analyzer warnings. Return an actual error if we're failing because we're trying to write to the standard output in compressed mode. svn path=/trunk/; revision=36636
2011-04-12#if 0 out some unused variables; we may make use of them later, but thisGuy Harris1-0/+16
keeps GCC 4.6.0 from complaining about them and failing to build with -Werror, and may also squelch some Coverity (and other static analyzer) complaints. svn path=/trunk/; revision=36599
2011-04-12Now that wtap_read() checks for delayed errors on EOF, there's no needGuy Harris2-32/+7
to check for it on close. svn path=/trunk/; revision=36593
2011-04-12From Jakub Zawadski: some small fixes.Guy Harris1-6/+5
From me: small indentation fix (use spaces rather than tabs in all lines in that routine). svn path=/trunk/; revision=36591
2011-04-12Update and expand some comments.Guy Harris1-35/+59
In the end-of-stream code, when we're checking the CRC and length, don't check the CRC or length if we failed to read them, and don't check the length if the CRC is bad. We define O_BINARY as 0 on UN*X in <wsutil/file_util.h>, so we don't need to avoid using it on UN*X. In file_gets(), check for delayed errors. svn path=/trunk/; revision=36590
2011-04-12A parameter isn't used if ZLIB isn't enabled.Martin Mathieson1-1/+1
svn path=/trunk/; revision=36584
2011-04-12If we hit an EOF - wth->subtype_read returns FALSE, but sets *err to 0 -Guy Harris1-1/+13
call file_error() to fetch any deferred error, so we report an error rather than an "everything's OK" EOF. svn path=/trunk/; revision=36578
2011-04-12From Jakub Zawadzki: speed up random access to gzipped files, as per theGuy Harris5-55/+302
zran.c example in the zlib source. This means that problems in the file's contents might not be reported when a packet is read, as long as there's no problem in the contents of the file up to the last bit of compressed data for the packet; we now check for errors after finishing the sequential read of the file, at least in some programs, so that shouldn't be an issue (the other programs need to be changed to do so as well). This is necessary in order to be able to read all the packets we saw in the sequential pass; it also lets us get a few more packets from truncated files in some cases. svn path=/trunk/; revision=36577
2011-04-12Allow wtap_sequential_close() and wtap_close() to return an error; thisGuy Harris2-7/+32
may happen if, when reading a compressed file, we find an error in the file's contents past the last packet (e.g., the file being cut short so that we can't get a full buffer worth of compressed data), and that reporting of that error is delayed (so that you can get all of the packets that we *can* decompress). Check for those errors, at least on the sequential read pass (the only errors we should see when closing the random stream are errors we've already seen in the sequential stream). svn path=/trunk/; revision=36576
2011-04-12"This file format can't be written to a pipe" and "this file formatGuy Harris37-136/+76
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-11Use ws_open(), not open(), so we handle UTF-8 pathnames on Windows.Guy Harris8-21/+8
Update or remove some additional "we don't have ferror() in zlib" comments to reflect the current reality. svn path=/trunk/; revision=36568
2011-04-11Remove a no-longer-valid comment (we're not using zlib's I/O routines,Guy Harris1-3/+0
and the routines we're now using guarantee that an error has occured in that case). svn path=/trunk/; revision=36567
2011-04-11Don't use the zlib I/O routines for writing compressed files, either;Guy Harris3-21/+282
this frees us from worrying about zlib large file issues on the write side, and also lets us clean up a few other things. svn path=/trunk/; revision=36563
2011-04-10To fill in a ws_statb64, you must use ws_fstat64.Guy Harris1-1/+1
Declare ws_stdio_stat64, as that's its new name. svn path=/trunk/; revision=36549
2011-04-10Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64Guy Harris1-2/+2
as an argument, along the lines of ws_fstat64, and, on Windows, make it use _wstati64, to handle 64-bit file sizes. svn path=/trunk/; revision=36547
2011-04-10Define ws_statb64 to be the appropriate "struct XXX" for aGuy Harris1-1/+1
64-bit-file-size-capable stat call, and use it for ws_fstat64(). svn path=/trunk/; revision=36545
2011-04-10Add ws_fstat64(), defined to be fstat on UN*X and _fstati64 on Windows.Guy Harris1-1/+1
Use it in some places where we're getting the file size. svn path=/trunk/; revision=36544
2011-04-10Use AC_SYS_LARGEFILE to turn on large file support on platforms thatGuy Harris2-17/+5
support it. Rename ws_lseek to ws_lseek64, as it should be given a 64-bit offset, and have it use _lseeki64 on Windows, to try to get 64-bit offset support; AC_SYS_LARGEFILE should cause lseek() to support 64-bit offsets on UN*X if possible. svn path=/trunk/; revision=36542
2011-04-10Point to RFC 1952 as a description of the gzip file format.Guy Harris1-0/+10
Point to pages for some other compressed file formats we might want to support. svn path=/trunk/; revision=36539
2011-04-10Move the definition of the structure pointed to by a FILE_T intoGuy Harris2-32/+32
wiretap/file_wrappers.c; nothing outside of file_wrappers.c needs to know what it looks like, it just passes around pointers to it. svn path=/trunk/; revision=36538
2011-04-08Just make the fh member of a wtap_dumper_t a void * for now, and, in allGuy Harris2-12/+14
calls that use it, cast it to whatever it's supposed to be. Making it a gzFile means you can't use any stdio macros that reach inside the structure; making it a FILE *, as it used to be, amounts to trying to use a FILE * as a void * if we're writing a compressed file out. svn path=/trunk/; revision=36521
2011-04-08Make wtap plugins build on windows again.Anders Broman1-0/+1
svn path=/trunk/; revision=36517
2011-04-08Change ng_file_read() to take only one size argument - and make it anGuy Harris1-27/+27
unsigned int - to match file_read(). Shrink some arguments, variables, and structure members appropriately. Fix an incorrect sizeof - sizeof a pointer is the size of the pointer, not the size of what it points to. svn path=/trunk/; revision=36515
2011-04-08To squelch some compiler warnings, temporarily cast the argument toGuy Harris1-2/+12
ws_lseek() to the appropriate type for the second argument to _lseek() for Windows or lseek() for UN*X; ultimately, we want to call the appropriate 64-bit-offset seek routine if available, otherwise cast the value down and hand it to the 32-bit-offset seek routine. svn path=/trunk/; revision=36514
2011-04-08From Jakub Zawadzki:Guy Harris5-229/+675
Steal file_wrappers functions from zlib v2. svn path=/trunk/; revision=36513
2011-04-07Be more picky about our sscanf integer field widths. Hopefully this willGerald Combs7-12/+12
help squelch Coverity CIDs 701-709. svn path=/trunk/; revision=36511
2011-04-07From Jakub Zawadzki:Guy Harris2-5/+8
Introduce file_clearerr I'm unsure of this patch, gzclearerr() is used to clear the end-of-file mark, but for FILE there's function which do the same (clearerr). I created test program if clearerr() is needed for tailing file. and it seems to work without it (at least on Linux, so for !HAVE_LIBZ I commented it out). For now this patch introduce file_clearerr macro, and define it only when EOF marking must be cleared (i.e. when HAVE_LIBZ and HAVE_GZCLEARERR are defined). So everything works like before, patch just to keep same prefix for file interface :) svn path=/trunk/; revision=36510
2011-04-06From Jakub Zawadzki:Guy Harris3-29/+10
file-wrappers.[ch] is used only for reading files, and mode is always "rb". Attached patch removes 'mode' argument from file_open() & filed_open(). svn path=/trunk/; revision=36493
2011-04-06From Jakub Zawadzki: fix the type of an argument.Guy Harris1-1/+1
svn path=/trunk/; revision=36492
2011-04-06From Jakub Zawadzki:Guy Harris32-199/+197
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-03-31Check return value of file_seek(). Fixes CID 338.Chris Maynard1-1/+2
svn path=/trunk/; revision=36425
2011-03-31Use BSWAP16 instead of BSWAP32 for 16-bit values. Fixes CID's 1179 and 1180.Chris Maynard1-2/+2
svn path=/trunk/; revision=36422
2011-03-29Don't put a 196808 byte variable on the stack: instead, malloc/free it.Jeff Morriss1-59/+83
Coverity 789-790. Since we've been keeping track of how many bytes we put in the buffer, use that value instead of calling strlen() find it again. Also, some white space/indentation cleanup. svn path=/trunk/; revision=36397
2011-03-29Don't put a 65536 byte variable on the stack: instead, malloc/free it.Jeff Morriss1-44/+78
Coverity 791-794. Also, some white space/indentation cleanup. svn path=/trunk/; revision=36394
2011-03-28More updates to the wtap_open_offline() comment.Guy Harris1-2/+4
svn path=/trunk/; revision=36384
2011-03-28Update a comment.Anders Broman1-4/+6
svn path=/trunk/; revision=36376