aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/ngsniffer.c
AgeCommit message (Collapse)AuthorFilesLines
2013-12-03wiretap: start using <wsutil/pint.h>Jakub Zawadzki1-32/+32
svn path=/trunk/; revision=53764
2013-11-29Expand macros: htoles(), htolel(), htolell()Jakub Zawadzki1-7/+7
svn path=/trunk/; revision=53651
2013-11-08The "file types" we have are actually combinations of types andGuy Harris1-5/+5
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-07-16The new frame-based tvbuff code found that the DOS Sniffer code forGuy Harris1-8/+51
compressed sniffer files failed if the very first read involves seeking past the first blob; fix that. svn path=/trunk/; revision=50679
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-14/+17
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-03file_skip() only needs to return a Boolean; if anybody cares what theGuy Harris1-3/+1
seek offset is after calling it, they can use file_tell(). (Some routines were already assuming it returned a gboolean.) svn path=/trunk/; revision=49733
2013-01-06Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-1/+0
svn path=/trunk/; revision=46979
2013-01-04Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8105 :Pascal Quantin1-1/+1
Allow use of huges values for localtime / ctime / gmtime with MSVC 2008 or later svn path=/trunk/; revision=46930
2012-12-27Do not call wtap_file_read_unknown_bytes() orGuy Harris1-11/+10
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-05Add a bunch of #defines for converting between tm_year/tm_mon/tm_mday toGuy Harris1-7/+22
a DOS date. Use them - which fixes a bug, bug 7998, wherein we were doing the wrong check to see whether tm_year would fit in a DOS date or not. svn path=/trunk/; revision=46387
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-8/+10
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45015
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-06-02Try to squelch warningsAnders Broman1-7/+7
svn path=/trunk/; revision=43000
2012-06-02Try to squelch warningsAnders Broman1-20/+20
svn path=/trunk/; revision=42999
2012-05-04ng_file_seek_rand() is supposed to return a Boolean; make it do so.Guy Harris1-3/+3
svn path=/trunk/; revision=42424
2012-05-04file_seek() used to be a wrapper around fseek() or gzseek(), both ofGuy Harris1-66/+40
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-02-28Some more details about REC_HEADER1 and REC_V2DESC; REC_HEADER1 doesn'tGuy Harris1-2/+14
appear to contain anything of use to us - too random - but REC_V2DESC might be worth converting into a comment. svn path=/trunk/; revision=41215
2012-02-25Add a presence flag field to the packet information structure filled inGuy Harris1-0/+1
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
2011-12-22The encapsulation following WTAP_ENCAP_ARCNET isGuy Harris1-0/+1
WTAP_ENCAP_ARCNET_LINUX; update various tables mapping Wiretap encapsulations to file-type encapsulations. Get rid of some trailing "sorry, that's not supported" entries while we're at it. svn path=/trunk/; revision=40274
2011-12-13Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports anyGuy Harris1-4/+4
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-11-17Put back the check for dates that can be represented in DOS format theGuy Harris1-1/+1
way it was *supposed* to be done, rather than backwards. svn path=/trunk/; revision=39895
2011-11-17Revert part of r39883 to avoid dereferencing a NULL pointer. Thanks Clang.Chris Maynard1-1/+1
svn path=/trunk/; revision=39894
2011-11-16Another place where we have to protect against MSVC's time-conversionGuy Harris1-1/+9
routines blowing up if handed a too-large time_t. While we're at it, also check for dates that can't be represented in DOS format (pre-1980 dates). svn path=/trunk/; revision=39883
2011-09-01Use guint8 rather than guchar for raw octets and pointers to arrays ofGuy Harris1-7/+7
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-05-10file_read() can return -1; don't just blindly add it to a previousGuy Harris1-3/+10
file_read() return value. Use wtap_file_read_expected_bytes() in a number of places. svn path=/trunk/; revision=37053
2011-04-27From Yaniv Kaul: some 'set but not used' compilation fixes;Bill Meier1-650/+652
From me: - #include <stdlib.h> not needed; - Use consistent indentation; - use #if 0/#endif to comment out code rather than /* */ svn path=/trunk/; revision=36884
2011-04-21Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discoveredGuy Harris1-51/+63
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-12"This file format can't be written to a pipe" and "this file formatGuy Harris1-1/+1
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-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-06From Jakub Zawadzki:Guy Harris1-10/+10
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-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-02-16Return an error value for the new error return; it "can't happen" (butGuy Harris1-1/+7
either the VC++ analyzer can't determine that or it *can*, in fact, happen). Pick an error code that's not too far off. svn path=/trunk/; revision=35957
2011-02-16Fix errors found by the Visual C++ analyzer.Gerald Combs1-1/+3
svn path=/trunk/; revision=35954
2010-06-06Don't use fwrite directly when writing a dump file; call it throughGuy Harris1-55/+9
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-02-26Move the definitions of all the private data structures out ofGuy Harris1-10/+9
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-24Define the private data structures for some particular capture fileGuy Harris1-56/+96
types in the modules for those capture file types, not in wtap-int.h, so wtap-int.h doesn't have to change when the code to handle that particular capture type changes, or a new capture file type is added. (Ultimately, we should do this for all the private data structures.) svn path=/trunk/; revision=31974
2009-04-24[Trivial] Constify a few thingsBill Meier1-1/+1
svn path=/trunk/; revision=28144
2009-04-22Clean up some 64-bit issues.Guy Harris1-1/+1
svn path=/trunk/; revision=28117
2009-03-10Another iteration of 64-bit-support-by-successive-approximation.Gerald Combs1-5/+5
svn path=/trunk/; revision=27690
2009-03-10ng_file_read and SnifferDecompress need to be able to return negativeGerald Combs1-14/+18
values, so adjust accordingly. svn path=/trunk/; revision=27688
2009-03-09More 64-bit fixes.Gerald Combs1-1/+1
svn path=/trunk/; revision=27685
2009-03-09Convert a bunch of ints to size_t in ngsniffer.c, and make sure file_readGerald Combs1-14/+14
can accept size_t's. svn path=/trunk/; revision=27684
2008-02-12Add a cast.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=24307
2008-02-10Do the time calculations with 64-bit integers, rather than in floatingGuy Harris1-52/+110
point, so we don't have issues with numbers not being exactly representable; that makes it less likely that the change described below will change a time stamp if it's not fixing the time stamp (i.e., if time_day is 0). The Sniffer manual "Expert Sniffer(R) Network Analyzer Operations, Release 5.50" says that a frame2_rec has a time stamp with an 8-bit time_high field and an 8-bit time_day field. Interpreting the time stamp that way fixes the time stamps in at least some captures; see, for example, bug 2251. Fix/update some comments (for example, the Sniffer documentation is no longer at that URL). svn path=/trunk/; revision=24296
2006-11-05change all file offsets from long to gint64 so we can - theoretically - ↵Ulf Lamping1-16/+16
handle files > 2GB correct. Please distclean Win32 builds! svn path=/trunk/; revision=19814
2006-03-09Fix a possible NULL dereference (Coverity CID 33).Gerald Combs1-2/+2
svn path=/trunk/; revision=17556
2005-10-22Update URL for Sniffer manual, and expand a comment a bit.Guy Harris1-3/+4
svn path=/trunk/; revision=16285
2005-10-22Add #defines for the DOS Sniffer network types and for various frameGuy Harris1-22/+126
status field bits". Check for "Internetwork analyzer" captures by checking the Sniffer network type, and save that type rather than just an "ATM or not" flag in the private data. svn path=/trunk/; revision=16283
2005-08-25timestamp display precision:Ulf Lamping1-0/+2
- automatic adjustment depending on file format - manual adjustment through menu items save the setting in the recent file svn path=/trunk/; revision=15534