aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/mime_file.c
Commit message (Collapse)AuthorAgeFilesLines
* Use an enum for the open-routine return value, as per Evan Huus's suggestion.Guy Harris2014-10-091-7/+7
| | | | | | | | Clean up some things we ran across while making those changes. Change-Id: Ic0d8943d36e6e120d7af0a6148fad98015d1e83e Reviewed-on: https://code.wireshark.org/review/4581 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Make the time stamp resolution per-packet.Guy Harris2014-09-281-1/+1
| | | | | | | | | | | | | | | | | | Pcap-ng files don't have a per-file time stamp resolution, they have a per-interface time stamp resolution. Add new time stamp resolution types of "unknown" and "per-packet", add the time stamp resolution to struct wtap_pkthdr, have the libwiretap core initialize it to the per-file time stamp resolution, and have pcap-ng do the same thing with the resolution that it does with the packet encapsulation. Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which means "use the packet's resolution to determine how many significant digits to display". Rename all the WTAP_FILE_TSPREC_XXX values to WTAP_TSPREC_XXX, as they're also used for per-packet values. Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69 Reviewed-on: https://code.wireshark.org/review/4349 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Only one buffer.c, please.Guy Harris2014-07-151-1/+1
| | | | | | | | | | | | | | | | | Otherwise, if you link with both libwiretap and libfiletap, it's anybody's guess which one you get. That means you're wasting memory with two copies of its routines if they're identical, and means surprising behavior if they're not (which showed up when I was debugging a double-free crash - fixing libwiretap's buffer_free() didn't fix the problem, because Wireshark happened to be calling libfiletap' unfixed buffer_free()). There's nothing *tap-specific about Buffers, anyway, so it really belongs in wsutil. Change-Id: I91537e46917e91277981f8f3365a2c0873152870 Reviewed-on: https://code.wireshark.org/review/3066 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris2014-05-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Get rid of extra trailing blank lines.Guy Harris2014-05-231-1/+0
| | | | | | Change-Id: I2cb1fdc3bc27c0075cc1e4910dc32088d2695bff Reviewed-on: https://code.wireshark.org/review/1754 Reviewed-by: Guy Harris <guy@alum.mit.edu>
* Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris2014-05-231-11/+9
| | | | | | | | | | 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>
* Allow wtap_read() and wtap_seek_read() to return non-packet records.Guy Harris2014-05-231-9/+11
| | | | | | | | | | | 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>
* Revert "Refactor Wiretap"Guy Harris2014-05-091-22/+18
| | | | | | | | | | 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>
* Refactor WiretapMichael Mann2014-05-091-18/+22
| | | | | | | | | | | 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>
* Remove all $Id$ from top of fileAlexis La Goutte2014-03-041-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>
* No seek-read routines use the length argument, so eliminate it fromGuy Harris2014-01-021-1/+1
| | | | | | wtap_seek_read(). svn path=/trunk/; revision=54570
* When reading MIME-encapsulated files, read the entire file at once,Guy Harris2013-12-311-46/+54
| | | | | | | | | don't break it into chunks. This means we don't need to do reassembly in the MIME-encapsulated-data dissector. svn path=/trunk/; revision=54525
* (Trivial) whitespace cleanup (mostly trailing whitespace).Bill Meier2013-11-081-1/+1
| | | | svn path=/trunk/; revision=53172
* The "file types" we have are actually combinations of types andGuy Harris2013-11-081-1/+1
| | | | | | | | | | 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
* From Michal Labedzki viaEvan Huus2013-10-231-1/+3
| | | | | | | | | | | https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8818 Add support for dissection ELF files. It opens as a "capture" file via wiretap at the moment for simplicity's sake, but the intention is eventually to have this (and other file types we dissect) open through some other program sharing much of the libwireshark infrastructure. svn path=/trunk/; revision=52775
* Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris2013-06-161-6/+3
| | | | | | | | | | 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
* Fill in the struct wtap_pkthdr in the seek-read routine.Guy Harris2013-05-181-11/+17
| | | | svn path=/trunk/; revision=49402
* Clean up white space.Guy Harris2013-01-301-4/+4
| | | | | | | Define the PNG magic number as a mixture of hex and ASCII, to make it a bit clearer what's going on. svn path=/trunk/; revision=47378
* Wiretap: Add support for files contain GIF, PNG images Michael Mann2013-01-301-2/+8
| | | | | | From Michal Labedzki, bug 8278 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8278) svn path=/trunk/; revision=47368
* Do not call wtap_file_read_unknown_bytes() orGuy Harris2012-12-271-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Squelch implicit 64-bit-to-32-bit conversion warnings.Guy Harris2012-12-211-1/+1
| | | | svn path=/trunk/; revision=46650
* Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki2012-10-161-1/+1
| | | | | | Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
* We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss2012-09-201-2/+0
| | | | svn path=/trunk/; revision=45015
* Update Free Software Foundation address.Jakub Zawadzki2012-06-281-1/+1
| | | | | | (COPYING will be updated in next commit) svn path=/trunk/; revision=43536
* file_seek() used to be a wrapper around fseek() or gzseek(), both ofGuy Harris2012-05-041-2/+1
| | | | | | | | | | | | | | | | 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
* Allow loading xml files (file MUST start with <?xml).Jakub Zawadzki2012-04-041-1/+5
| | | | | | | I needed it for testing (bug #7028) if you feel like it's stupid idea give me nfo :) svn path=/trunk/; revision=41944
* Add a presence flag field to the packet information structure filled inGuy Harris2012-02-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* Use guint8 rather than guchar for raw octets and pointers to arrays ofGuy Harris2011-09-011-3/+3
| | | | | | | | | | | 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
* Explain a bit more what this does.Guy Harris2011-07-041-0/+9
| | | | svn path=/trunk/; revision=37884
* Fix possible compilation errors.Jakub Zawadzki2011-06-091-10/+9
| | | | svn path=/trunk/; revision=37638
* - Add something to columns when using mime-encapJakub Zawadzki2011-06-091-2/+1
| | | | | | - Replace decoders in wiretap/CMakeLists.txt svn path=/trunk/; revision=37637
* - Replace jpeg_jfif decoder, with more generic mime_file (no more 64KB limit!).Jakub Zawadzki2011-06-091-0/+186
- Add new dissector packet-mime-encap which understands mime_file fragmentation. svn path=/trunk/; revision=37636