aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/netxray.c
AgeCommit message (Collapse)AuthorFilesLines
2014-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris1-0/+13
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be REC_TYPE_PACKET, for a record containing a packet, or REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific data. Modify code that reads packets to be able to handle non-packet records, even if that just means ignoring them. Rename some routines to indicate that they handle more than just packets. We don't yet have any libwiretap code that supplies records other than REC_TYPE_PACKET or that supporting writing records other than REC_TYPE_PACKET, or any code to support plugins for handling REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug 8590. Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813 Reviewed-on: https://code.wireshark.org/review/1773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris1-16/+16
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Allow wtap_read() and wtap_seek_read() to return non-packet records.Guy Harris1-16/+16
This is the first step towards implementing the mechanisms requestd in bug 8590; currently, we don't return any records other than packet records from libwiretap, and just ignore non-packet records in the rest of Wireshark, but this at least gets the ball rolling. Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574 Reviewed-on: https://code.wireshark.org/review/1736 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09Revert "Refactor Wiretap"Guy Harris1-70/+67
This reverts commit 1abeb277f5e6bd27fbaebfecc8184e37ba9d008a. This isn't building, and looks as if it requires significant work to fix. Change-Id: I622b1bb243e353e874883a302ab419532b7601f2 Reviewed-on: https://code.wireshark.org/review/1568 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-09Refactor WiretapMichael Mann1-67/+70
Start of refactoring Wiretap and breaking structures down into "generally useful fields for dissection" and "capture specific". Since this in intended as a "base" for Wiretap and Filetap, the "wft" prefix is used for "common" functionality. The "architectural" changes can be found in cfile.h, wtap.h, wtap-int.h and (new file) wftap-int.h. Most of the other (painstaking) changes were really just the result of compiling those new architecture changes. bug:9607 Change-Id: Ife858a61760d7a8a03be073546c0e7e582cab2ae Reviewed-on: https://code.wireshark.org/review/1485 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-06Make some routines take a struct wtap_pkthdr * as an argument.Guy Harris1-4/+2
For some routines that take multiple arguments that come from a struct wtap_pkthdr, pass a pointer to the struct wtap_pkthdr in question, rather than the separate arguments. Do this even if we're passing expressions that were earlier assigned to the struct wtap_pkthdr fields in question. This simplifies the calling sequences and ensures that the right values are picked up by the called routine; in at least one case we were *not* passing the right values (the code to handle Simple Packet Blocks in pcap-ng files). Also, call the byte-swapping routines for pseudo-header fields only if we need to do byte-swapping. Change-Id: I3a8badfcfeb0237dfc1d1014185a67f18c0f2ebe Reviewed-on: https://code.wireshark.org/review/119 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-01-22Don't write out packets that have a "captured length" bigger than we'reGuy Harris1-0/+13
willing to read or that's bigger than will fit in the file format; instead, report an error. For the "I can't write a packet of that type in that file type" error, report the file type in question. svn path=/trunk/; revision=54882
2014-01-02No seek-read routines use the length argument, so eliminate it fromGuy Harris1-3/+2
wtap_seek_read(). svn path=/trunk/; revision=54570
2014-01-02Have a routine that reads and processes the record header, and use it inGuy Harris1-74/+58
both the read and seek-read routines. Use the packet length read from the packet header when reading packets randomly. svn path=/trunk/; revision=54549
2013-12-30Add an "ATM reassembly failed" flag for capture file readers to provide,Guy Harris1-1/+4
and set it in NetXRay/Windows Sniffer files if the putative "ATM reassembly failed" flag is set and, if reassembly failed, don't attempt to dissect the packet. svn path=/trunk/; revision=54503
2013-12-30Fix a couple of old typos;Bill Meier1-20/+43
Use a consistent formatting style for function defs; Add editor modelines. svn path=/trunk/; revision=54501
2013-12-30Squelch compiler warnings.Guy Harris1-8/+5
svn path=/trunk/; revision=54500
2013-12-30More reverse engineering.Guy Harris1-64/+298
svn path=/trunk/; revision=54497
2013-12-03wiretap: start using <wsutil/pint.h>Jakub Zawadzki1-17/+17
svn path=/trunk/; revision=53764
2013-11-29Expand macros: htoles(), htolel(), htolell()Jakub Zawadzki1-20/+20
svn path=/trunk/; revision=53651
2013-11-09Replace wtap_nstime with nstime_t, remove wtap_nstime_to_sec.Jakub Zawadzki1-1/+1
After r50154 nstime_t is inside wsutil/ so wiretap don't need it's own copy. svn path=/trunk/; revision=53184
2013-11-08(Trivial) whitespace cleanup (mostly trailing whitespace).Bill Meier1-2/+2
svn path=/trunk/; revision=53172
2013-11-08The "file types" we have are actually combinations of types andGuy Harris1-12/+12
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-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-33/+11
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-06Set the entire struct wtap_pkthdr, not just the pseudo-header, in theGuy Harris1-95/+93
seek-read routine. Pull the code to do that into netxray_set_pseudo_header(), and rename it netxray_set_phdr(). svn path=/trunk/; revision=49800
2013-03-25Wiretap file open routines should not free wth->priv on error, since thatEvan Huus1-1/+0
leads to a double-free in wtap_close. Fix all the instances I found via manual code review, and add a brief comment to the list of open routines in file_access.c Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8518 svn path=/trunk/; revision=48552
2013-03-17From beroset:Anders Broman1-14/+17
implemented wtap_dump_file_seek() and _tell() implemented the previously declared but unimplemented wtap_dump_file_seek() and wtap_dump_file_tell() functions and used them in the seven files that had previously used a plain ftell or fseek and added error checking as appropriate. I also added a new error WTAP_ERR_CANT_SEEK_COMPRESSED and put it next to WTAP_ERR_CANT_SEEK causing renumbering of two of the existing error codes. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48348
2012-12-27Do not call wtap_file_read_unknown_bytes() orGuy Harris1-11/+14
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-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-7/+7
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-07-18Set the 802.11 "already decrypted" flag to FALSE for file formats otherGuy Harris1-0/+2
than Network Instruments Observer files, as we don't know whether they are already decrypted. svn path=/trunk/; revision=43796
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-05-04file_seek() used to be a wrapper around fseek() or gzseek(), both ofGuy Harris1-14/+9
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-04-18Get the Windows build going again. The Netxray "fix" cast to guint8 may not ↵Anders Broman1-1/+1
be OK. svn path=/trunk/; revision=42125
2012-02-25Add a presence flag field to the packet information structure filled inGuy Harris1-0/+2
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-09-01Use guint8 rather than guchar for raw octets and pointers to arrays ofGuy Harris1-6/+6
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-04-28#include <stdlib.h> not needed;Bill Meier1-306/+305
use consistent indentation. svn path=/trunk/; revision=36921
2011-04-21Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discoveredGuy Harris1-14/+15
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-18/+2
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-06From Jakub Zawadzki:Guy Harris1-4/+4
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-02-25From Robert Bullen: ... code is not incrementing wtap_dumper.bytes_dumped.Bill Meier1-0/+6
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5666 Fro me: use 4 -space indentation (not tab) to match surrounding code lines. svn path=/trunk/; revision=36074
2010-08-08Add a note.Guy Harris1-0/+4
svn path=/trunk/; revision=33741
2010-06-06Don't use fwrite directly when writing a dump file; call it throughGuy Harris1-68/+8
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-51/+73
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
2009-04-24[Trivial] Constify a few thingsBill Meier1-5/+5
svn path=/trunk/; revision=28144
2009-04-22Clean up some 64-bit issues.Guy Harris1-5/+5
svn path=/trunk/; revision=28117
2009-01-06Fix a typo in a commentBill Meier1-1/+1
svn path=/trunk/; revision=27164
2009-01-04Oops: Revert SVN #27152: There weren't actually any memory leaks ...Bill Meier1-6/+0
svn path=/trunk/; revision=27155
2009-01-04Fix a few minor memory leaks...Bill Meier1-0/+6
svn path=/trunk/; revision=27152
2007-08-17At least some LAPB Windows Sniffer captures have 4 bytes of extra stuffGuy Harris1-0/+23
at the ends of packets. svn path=/trunk/; revision=22540
2007-06-11Note invalidity of realtick for Bill Meier1-5/+7
captypes ETH_CAPTYPE_OTHERPOD2 and ETH_CAPTYPE_GIGPOD2 in comments for the associated TpS tables. svn path=/trunk/; revision=22074
2007-05-31Note realtick's invalidity for ETH_CAPTYPE_OTHERPOD in the comment forGuy Harris1-0/+4
TpS_otherpod[]. Ask about its validity for ETH_CAPTYPE_OTHERPOD2 and ETH_CAPTYPE_GIGPOD2. svn path=/trunk/; revision=22016
2007-05-31My comment is redundant with Bill's more-detailed comment; remove it.Guy Harris1-3/+0
svn path=/trunk/; revision=22015
2007-05-30Update CommentsBill Meier1-3/+9
svn path=/trunk/; revision=22005