aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/ngsniffer.c
AgeCommit message (Collapse)AuthorFilesLines
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
2003-10-25Add a new WTAP_ENCAP_CHDLC_WITH_PHDR type, to distinguish Cisco HDLCGuy Harris1-3/+3
captures with packet direction information from captures without it. Use them appropriately. svn path=/trunk/; revision=8780
2003-10-01Have a pseudo-header for Ethernet packets, giving the size of the FCS -Guy Harris1-7/+27
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
2003-03-03Handle packet direction information for SDLC Sniffer captures.Guy Harris1-1/+2
Add a bunch of capture types discovered by stuffing them into Windows Sniffer captures and seeing what a Sniffer thought they were. Add support for writing at least some of them. svn path=/trunk/; revision=7265
2003-01-31Add WTAP_ENCAP_FRELAY_WITH_PHDR for use with Frame Relay capture filesGuy Harris1-5/+5
that have direction information. Support writing WTAP_ENCAP_FRELAY_WITH_PHDR and WTAP_ENCAP_PPP_WITH_PHDR captures out in libpcap format - we throw away the direction information, but so it goes. When reading/writing Windows Sniffer format, read and write the direction flag. svn path=/trunk/; revision=7052
2003-01-14We don't know what, in captures with a major version number of 3,Guy Harris1-10/+30
indicates the subtype of an "Internetwork analyzer" capture; we've seen only one such capture, and it was a frame relay capture, so we just wire it to frame relay for now. svn path=/trunk/; revision=6923
2003-01-11If it doesn't begin with FF 00 it can't be LANE LE Control; if it'sGuy Harris1-5/+29
LANE, claimed to be LE Control, but doesn't begin with FF 00, call it 802.3. svn path=/trunk/; revision=6901
2003-01-10Rename the "version" argument to "process_header_records()" "maj_vers",Guy Harris1-48/+66
as it's the major version number. Try using the first word of "rsvd" to determine whether a capture is an ISDN capture or not in version 1 captures. Version 1 captures look as if they might also have a REC_HEADER2 record - it's longer than the ones in version 4 and 5 captures, but it still appears to have a network subtype in the 5th byte. Get rid of the heuristic that checks for WTAP_ENCAP_ISDN by looking at the packet data; if we fail to recognize an ISDN capture, we should look for stuff in the headers to determine whether the capture is one or not. svn path=/trunk/; revision=6894
2003-01-10It looks as if a value of 0xfa in the second byte of a REC_HEADER2Guy Harris1-50/+48
record might indicate an ISDN capture; treat that as an indication that a capture is an ISDN capture. svn path=/trunk/; revision=6893
2003-01-10The Sniffer file formats include a file to identify raw cells; exportGuy Harris1-1/+10
that flag in the ATM pseudo-header, and use it to determine whether a frame is a raw cell or a reassembled frame, rather than using the AAL, as you can have raw AAL5 cells in a capture. svn path=/trunk/; revision=6889
2003-01-09The checksum in DOS ATM Sniffer files appears to be stored in big-endianGuy Harris1-2/+2
format. svn path=/trunk/; revision=6885
2003-01-09It appears that ATM sniffer files with 4.x versions 4.95 and greaterGuy Harris1-11/+19
have a bogus record length for type 4 records, but earlier 4.x versions, and 5.x versions, don't. svn path=/trunk/; revision=6880
2003-01-07If the Windows Sniffer writes out one of its ATM capture files in DOSGuy Harris1-52/+57
Sniffer format, it doesn't distinguish between LE Control and LANE encapsulated LAN frames, so we can't rely on the ATM subtype being correct even when reading DOS Sniffer captures - we force it to TRAF_ST_LANE_LE_CTRL for LANE frames that begin with 0xff 0x00. Move the calls to "infer_pkt_encap()" into "fix_pseudo_header()". svn path=/trunk/; revision=6869
2003-01-06Don't interpret NET_HDLC as LAPB/X.25 - sometimes it's some otherGuy Harris1-22/+34
HDLC-flavored encapsulation (or, at least, it was in at least one capture). Instead, treat it as WTAP_ENCAP_PER_PACKET, and infer the packet type, as we do for NET_ROUTER. For NET_ROUTER captures, if the ISDN channel number is zero, infer the packet type from the contents, rather than wiring it to PPP - it might be, for example, Cisco or Wellfleet HDLC. Fix the check for Cisco HDLC to look for 0x0F 0x00 and 0x8F 0x00, as 0x0F, not 0x08, is the unicast address in Cisco HDLC. When fixing the pseudo-header, fix it for WTAP_ENCAP_WFLEET_HDLC, WTAP_ENCAP_CHDLC, and WTAP_ENCAP_PPP_WITH_PHDR, as well as for WTAP_ENCAP_ISDN, as the three ones listed don't use x25.flags, they use p2p.sent. svn path=/trunk/; revision=6850