summaryrefslogtreecommitdiff
path: root/wiretap/ngsniffer.c
AgeCommit message (Collapse)AuthorFilesLines
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
2005-08-24EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry! Ulf Lamping1-6/+6
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ... What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere. As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon. Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way... As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number... svn path=/trunk/; revision=15520
2004-09-15Improve the heuristic for Frame Relay, and move that heuristic after theGuy Harris1-16/+37
checks for Wellfleet and Cisco HDLC. svn path=/trunk/; revision=11995
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2004-01-25Have the Wiretap open, read, and seek-and-read routines return, inGuy Harris1-30/+33
addition to an error code, an error info string, for WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with "g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed strings returned as the error info string, and change the callers of those routines to, for those errors, put the info string into the printed message or alert box for the error. Add messages for cases where those errors were returned without printing an additional message. Nobody uses the error code from "cf_read()" - "cf_read()" puts up the alert box itself for failures; get rid of the error code, so it just returns a success/failure indication. Rename "file_read_error_message()" to "cf_read_error_message()", as it handles read errors from Wiretap, and have it take an error info string as an argument. (That handles a lot of the work of putting the info string into the error message.) Make some variables in "ascend-grammar.y" static. Check the return value of "erf_read_header()" in "erf_seek_read()". Get rid of an unused #define in "i4btrace.c". svn path=/trunk/; revision=9852