aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap-int.h
AgeCommit message (Collapse)AuthorFilesLines
2016-02-23Making wiretap option blocks more generic.Michael Mann1-4/+6
This was inspired by https://code.wireshark.org/review/9729/, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom". It should be easier to add "custom" options in this design. Some, but not all blocks have been converted. Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks. Also what could be added/refactored is registering block behavior. Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a Reviewed-on: https://code.wireshark.org/review/13667 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-29No need for a routine to return a GSList of extensions for compressed files.Guy Harris1-2/+5
Just use the table - or an empty table if we're not including the compressed file extensions. Change-Id: I0b3ef3987e1986953f2957c27c84b2ee59b90bc0 Reviewed-on: https://code.wireshark.org/review/13611 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Add a comment for is_stdout.Guy Harris1-1/+1
Change-Id: I88abb5a37a00ebc1a2a742ff36c8d6be75420dbe Reviewed-on: https://code.wireshark.org/review/11677 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-10Skip only the actual file descriptor close when writing to stdout.Guy Harris1-0/+1
Have a "this is stdout" flag for a wtap_dumper, and have "open the standard output for dumping" routines that set that flag. When closing a wtap_dumper, do most of the work regardless of whether we're writing to the standard output or not (so that everything gets written out) and only skip the closing of the underlying file descriptor. Change-Id: I9f7e4d142b3bd598055d806b7ded1cb4c378de8e Reviewed-on: https://code.wireshark.org/review/11673 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-09Call the dumper routine to finish write a file the "finish" routine.Guy Harris1-8/+8
It doesn't actually *close* any handle, so it's best called a "finish" routine rather than a "close" routine. In libwiretap modules, don't bother setting the finish routine pointer to null - it's already initialized to null (it's probably best not to require modules to set it). Change-Id: I19554f3fb826db495f17b36600ae36222cbc21b0 Reviewed-on: https://code.wireshark.org/review/11659 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-08More unnecessary <stdio.h> includes.Guy Harris1-1/+0
libwiretap no longer uses standard I/O routines to read files; those includes are left over from when it did. Change-Id: Ia46c5e24ed25c6bd254cd271746ace539a37e590 Reviewed-on: https://code.wireshark.org/review/11634 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-20Remove unused struct member from wtapHadriel Kaplan1-1/+0
The 'number_of_interfaces' member of struct wtap is not used - nor is it needed since the interface_data is a GArray with its own 'len' member. Change-Id: Id0fb25248dea4bea9fc88a8ea35c09ba55029d89 Reviewed-on: https://code.wireshark.org/review/10138 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-06Pcapng: support Name Resolution Block optionsHadriel Kaplan1-3/+5
Make pcapng decode options in an NRB during read, and store the comment option, and write it back out as well. Also make it handle plugin handlers for unknown options in received NRB(s). Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f Reviewed-on: https://code.wireshark.org/review/9723 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-28Remove some unneeded includes of <sys/time.h>.Guy Harris1-4/+0
Change-Id: I9e4e6efa9f8c7dbff7627f8d5fc3278ab383618d Reviewed-on: https://code.wireshark.org/review/7441 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Handle "I can't map this for that file format" better.Guy Harris1-1/+1
For cases where record (meta)data is something that can't be written out in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along with an err_info string. Report (and free) that err_info string in cases where WTAP_ERR_UNWRITABLE_REC_DATA is returned. Clean up some other error reporting cases, and flag with an XXX some cases where we aren't reporting errors at all, while we're at it. Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3 Reviewed-on: https://code.wireshark.org/review/5823 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07Add some higher-level file-read APIs and use them.Guy Harris1-27/+37
Add wtap_read_bytes(), which takes a FILE_T, a pointer, a byte count, an error number pointer, and an error string pointer as arguments, and that treats a short read of any sort, including a read that returns 0 bytes, as a WTAP_ERR_SHORT_READ error, and that returns the error number and string through its last two arguments. Add wtap_read_bytes_or_eof(), which is similar, but that treats a read that returns 0 bytes as an EOF, supplying an error number of 0 as an EOF indication. Use those in file readers; that simplifies the code and makes it less likely that somebody will fail to supply the error number and error string on a file read error. Change-Id: Ia5dba2a6f81151e87b614461349d611cffc16210 Reviewed-on: https://code.wireshark.org/review/4512 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28Make the time stamp resolution per-packet.Guy Harris1-4/+12
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>
2014-05-23Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris1-4/+4
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-4/+4
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-17wiretap: remove unused code, drop number_of_interfacesPeter Wu1-1/+0
While investigating an ASAN issue (fixed in commit dcdd076ab0965c346efe90051678ba790eaf7a02), I got greatly confused by three different types having the same "interface_data" field name: * pcapng_t *pn stores an array of interface_data_t objects. * wtap *wth stores an array of wtapng_if_descr_t objects. * pcapng_dump_t should store an array of interface_data_t objects. pcapng_dump_t and friends are unused since commit c7f1a431d23e17a15777652b1252e139f182b0e6, so drop it. To fix the confusion, rename the interface_data_t type to interface_info_t type and use the local variable "iface_info" everywhere. Rename interface_data of pcapng_t to "interfaces" and add a comment what this exactly means (interfaces listed in the capture file). Drop the number_of_interfaces field for interfaces as the array length is already available from GArray. Now interface_data is always initialized for wth (which also gets copied to idb). s/int/guint/g and replace cast at some places. There are no regressions for the in-tree test suite. Change-Id: I2d5985c9f1e43f8230dbb4a73bd1e243c4858170 Reviewed-on: https://code.wireshark.org/review/1656 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-09Revert "Refactor Wiretap"Guy Harris1-0/+54
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-54/+0
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-19Add capture file reader/writer support for Lua so scripts can implement new ↵Michael Mann1-5/+8
capture file formats. This enables a Lua script to implement a brand new capture file format reader/writer, so that for example one could write a script to read from vendor-specific "logs" of packets, and show them as normal packets in wireshark. Change-Id: Id394edfffa94529f39789844c382b7ab6cc2d814 Reviewed-on: https://code.wireshark.org/review/431 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-01-02No seek-read routines use the length argument, so eliminate it fromGuy Harris1-1/+1
wtap_seek_read(). svn path=/trunk/; revision=54570
2013-12-03wiretap: start using <wsutil/pint.h>Jakub Zawadzki1-71/+2
svn path=/trunk/; revision=53764
2013-11-29Replace macros: BSWAP16, BSWAP32, BSWAP64 with glib-version.Jakub Zawadzki1-19/+0
XXX, people are not aware that expression of this macros might be evaluated multiple times, like: - BSWAP16(tvb_get_letohs(tvb, off)) : \ + GUINT16_SWAP_LE_BE(tvb_get_letohs(tvb, off)) : \ Should be tvb_get_ntohs() called? svn path=/trunk/; revision=53653
2013-11-29Expand macros: htoles(), htolel(), htolell()Jakub Zawadzki1-5/+0
svn path=/trunk/; revision=53651
2013-11-08The "file types" we have are actually combinations of types andGuy Harris1-2/+2
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-09-22Get rid of struct addrinfo, use the hastables for name resolution instead.Anders Broman1-1/+1
svn path=/trunk/; revision=52176
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-1/+14
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-03-17From beroset:Anders Broman1-2/+2
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
2013-03-01Export libwireshark symbols using WS_DLL_PUBLIC defineBalint Reczey1-3/+0
Also remove old WS_VAR_IMPORT define and related Makefile magic everywhere in the project. svn path=/trunk/; revision=47992
2013-02-28Export libwiretap symbols using WS_DLL_PUBLIC defineBalint Reczey1-1/+5
TODO: hide flex-generated functions svn path=/trunk/; revision=47948
2012-10-18Wrap lines a little differently.Guy Harris1-2/+3
svn path=/trunk/; revision=45654
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-3/+1
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
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-2/+0
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-26Put the pseudo-header information for Veriwave packets into the bufferGuy Harris1-0/+10
in little-endian byte order, as that's what the dissector expects. Add a pletohl() macro for that purpose. Fix comments (the Veriwave code is *not* writing data to a file!) and clean up indentation. svn path=/trunk/; revision=42255
2012-04-18Fix some indentation errors from the previous change.Guy Harris1-3/+3
svn path=/trunk/; revision=42118
2012-04-18Get rid of tabs, so we don't have to worry about 4-space vs. 8-space tabs.Guy Harris1-160/+161
svn path=/trunk/; revision=42117
2012-02-20Handle reading and writing of multiple IDB:s, write IDB options and use ↵Anders Broman1-3/+11
correct lengt for strings, handle more than 100 char comment svn path=/trunk/; revision=41082
2012-02-15Make it possible to get inforamtion from the read SHB to the one to write out.Anders Broman1-3/+5
svn path=/trunk/; revision=41032
2012-02-13White space changes.Anders Broman1-4/+4
svn path=/trunk/; revision=41015
2012-02-11Add the abillity to read and write option comments unedited.Anders Broman1-21/+21
This is POC we may want to have more efficient use of the frame data structure etc. But this allows for work to be done on the GUI to actually add comments. svn path=/trunk/; revision=40969
2012-02-09Add pcapng variables to wtap_pkthdr.Anders Broman1-4/+6
svn path=/trunk/; revision=40947
2012-01-21Replace wtap_file_extensions_string() with a routine that returns aGuy Harris1-0/+3
GSList of extensions for a file type, including extensions for the compressed versions of those file types that we can read. svn path=/trunk/; revision=40623
2011-11-17Rename pletonll() to reflect what it actually does, namely convert aGuy Harris1-2/+2
host-byte-order 64-bit integral quantity to little-endian byte order. svn path=/trunk/; revision=39900
2011-11-17A new macro needed by the WTAP_ENCAP_PER_PACKET support for writingGuy Harris1-0/+8
NetMon files. svn path=/trunk/; revision=39899
2011-09-21Fix ex "modeline" so it works;Bill Meier1-1/+1
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748 svn path=/trunk/; revision=39081
2011-09-01Use guint8 rather than guchar for raw octets and pointers to arrays ofGuy Harris1-1/+1
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-06-09The only place where we care about zlib is file_wrappers.c; includeGuy Harris1-4/+0
<zlib.h> there, rather than wtap-int.h. That obviates the need to include config.h earlier in ascend_scanner.l; revert the previous change, so we don't require a version of Flex that supports %top. svn path=/trunk/; revision=37640
2011-06-04Fix wiretap headers to allow error-free ABI dumping.Balint Reczey1-2/+0
svn path=/trunk/; revision=37543
2011-05-31Declare the snapshot_length as unsigned.Chris Maynard1-1/+1
svn path=/trunk/; revision=37479
2011-05-09Get rid of the fd member of a wth structure; the FILE_T's in thatGuy Harris1-1/+4
structure include a file descriptor. Add a wtap_fstat() for the file readers that use file times to generate time stamps (we really need a way to say "this file has no time stamps" or "this file has only relative time stamps). svn path=/trunk/; revision=37026