Commit Graph

29 Commits

Author SHA1 Message Date
Moshe Kaplan 34454a5037 wiretap: Add header files to Doxygen
Add @file markers for wiretap
headers so that Doxygen will
generate documentation for them.
2021-11-29 21:59:23 -05:00
Guy Harris 166159f15d wiretap: eliminate the pcap/nspcap/pcapng WTAP_FILE_TYPE_SUBTYPE_ values.
Register the pcap and pcapng file types/subtypes rather than hardwiring
them into the table.

Call the registration routines for them directly, rather than through a
generated table; they're always supposed to be there, as some code in
Wireshark either writes only one of those formats or defaults to writing
one of those formats.  Don't run their source code through the
registration-routine-finder script.

Have the file type/subtype codes for them be directly exported to the
libwiretap core, and provide routines to return each of them, to be used
by the aforementioned code.

When reporting errors with cfile_write_failure_message(), use
wtap_dump_file_type_subtype() to get the file type/subtype value for the
wtap_dumper to which we're writing, rather than hardcoding it.

Have the "export PDU" code capable of supporting arbitrary file
types/subtypes, although we currently only use pcapng.

Get rid of declarations of now-static can_write_encap and
dump_open routines in various headers.
2021-02-23 21:56:20 +00:00
Guy Harris f9129721b2 Get rid of unused flag argument.
We always tell pcap_process_pseudo_header() to check to make sure the
pseudo-header isn't bigger than the captured data; no need for a flag
argument to tell it to do so.

Change-Id: I8310bb06a390a7f4a7a232ad140ae07955d52da1
Reviewed-on: https://code.wireshark.org/review/29833
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-25 23:20:39 +00:00
Guy Harris 1f5f63f8ef Generalize wtap_pkthdr into a structure for packet and non-packet records.
Separate the stuff that any record could have from the stuff that only
particular record types have; put the latter into a union, and put all
that into a wtap_rec structure.

Add some record-type checks as necessary.

Change-Id: Id6b3486858f826fce4b096c59231f463e44bfaa2
Reviewed-on: https://code.wireshark.org/review/25696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-09 00:29:51 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Dario Lombardo c440a24b1b wiretap: use SPDX identifiers (partial work).
Change-Id: I28436e003ce7fe31d53e6663f3cc7aca00845e4b
Reviewed-on: https://code.wireshark.org/review/25392
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-20 17:23:08 +00:00
Guy Harris af0f49e80d Use pcapng as the name of the file format.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.

Make Wireshark reflect that.

Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a
Reviewed-on: https://code.wireshark.org/review/25214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 00:38:51 +00:00
Guy Harris d0865fd619 Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures.  Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size.  See

	https://bugs.freedesktop.org/show_bug.cgi?id=100220

for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.

Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".

In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary.  When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.

Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 05:28:26 +00:00
Guy Harris e63a3f5d81 Don't use <wtap.h> to refer to the main libwiretap header file.
Either use "wtap.h", if it's only for files in the wiretap directory, or
<wiretap/wtap.h>, if it's also a header that stuff outside libwiretap
can include.

Change-Id: If1c71b3dae9a3c0d64661ae1734f925319e447d1
Reviewed-on: https://code.wireshark.org/review/14788
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-03 14:29:25 +00:00
Guy Harris a1b1c8bed5 Revert "Refactor Wiretap"
This reverts commit 1abeb277f5.

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-09 05:21:01 +00:00
Michael Mann 1abeb277f5 Refactor Wiretap
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-05-09 03:04:39 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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-03-04 14:27:33 +00:00
Guy Harris 63479adf63 Make some routines take a struct wtap_pkthdr * as an argument.
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-02-06 21:35:58 +00:00
Guy Harris 33e1232f23 In the pcapng seek-read routine, *don't* fill in wth->phdr; seek-read
routines are passed a separate struct wtap_pkthdr to be filled in.

Get rid of the pseudo_header member of the wblock structure - the
pseudo-header is part of the struct wtap_pkthdr.

Get rid of the union wtap_pseudo_header * argument to
pcap_process_pseudo_header() - it's passed a pointer to a struct
pcap_pkthdr, and that structure contains the union in question.

Have libpcap_read_header() take a FILE_T argument, rather than using
only the "sequential" handle of the wtap it's handed.  Have the libpcap
read routine return the offset of the beginning of the pcap record, and
have the seek-read routine read the header and fill in the struct
wtap_pkthdr handed to it.

svn path=/trunk/; revision=49401
2013-05-18 02:36:00 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Balint Reczey aa659985a5 Export libwiretap symbols using WS_DLL_PUBLIC define
TODO: hide flex-generated functions

svn path=/trunk/; revision=47948
2013-02-28 19:35:59 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 6ac265b512 Merge pcap_fill_in_pseudo_header() into pcap_read_post_process().
svn path=/trunk/; revision=38844
2011-09-01 19:58:25 +00:00
Guy Harris e9fc1b72aa Use guint8 rather than guchar for raw octets and pointers to arrays of
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-09-01 09:43:10 +00:00
Balint Reczey 311f9acfd5 Fix wiretap headers to allow error-free ABI dumping.
svn path=/trunk/; revision=37543
2011-06-04 21:20:57 +00:00
Guy Harris 21a210b777 From Chris Maynard:
Support PPP-over-USB.

	Don't remove the USB pseudo-header from the packet data for
	Linux USB packets, just byte-swap it if necessary and have the
	USB dissector fetch the pseudo-header from the raw packet data.

	Update USB language ID values.

svn path=/trunk/; revision=32534
2010-04-21 20:51:22 +00:00
Guy Harris c85899e946 Move the declarations of wtap_pcap_encap_to_wtap_encap() and
wtap_wtap_encap_to_pcap_encap() to wiretap/pcap-encap.h.  Include it
where it's needed; don't include other Wiretap headers where they're not
needed.

Include pcapng.h in pcapng.c, to declare the functions defined in
pcapng.c.  Add some casts to squelch some warnings, and add to a comment
to indicate one of the problems.

svn path=/trunk/; revision=31960
2010-02-23 03:50:42 +00:00
Michael Tüxen dce1889fd7 Cleanup. Should be included in Wireshark 1.2.1 and higher to keep
merging future bug fixes simple.

svn path=/trunk/; revision=28863
2009-06-27 16:08:18 +00:00
Michael Tüxen 6ce8546ecd This patch
* adds an encapsulation argument to pcap_write_phdr.
* writes the pseudo header when writing pcapng files.

This fixes a bug where you could not write pcapng files
when using encapsulations requiring pseudo headers.

svn path=/trunk/; revision=28859
2009-06-27 12:41:06 +00:00
Michael Tüxen 267df8e183 This commit
* adds an encap argument to pcap_process_pseudo_header.
* adds support for reading pseudo headers.
It fixes Bug 3560.
Thanks to Tyson Key for reporting the bug and providing
trace files. This fix will be scheduled for inclusion in
Wireshark 1.2.1 and higher.

svn path=/trunk/; revision=28857
2009-06-27 11:39:47 +00:00
Guy Harris 7d5afce08f When doing a seek-and-read, don't check the packet size, as we don't
have it (we have the size with the pseudo-header length already
removed); we've already read the packet, and thus have already checked
it.  Fixes bug 3501.

svn path=/trunk/; revision=28607
2009-06-02 19:06:05 +00:00
Guy Harris e637af376a pcap_to_wtap_map is not used outside wiretap/pcap-common.c, so make it
static.

svn path=/trunk/; revision=28186
2009-04-27 22:07:11 +00:00
Guy Harris a60cae6935 Move pseudo-header routines from libpcap.c to pcap-common.c, for use
with pcap-NG files.

svn path=/trunk/; revision=28184
2009-04-27 19:39:06 +00:00
Guy Harris 18a3b0659c Have the libpcap and pcap-NG code share the LINKTYPE_-to-WTAP_ENCAP_
mapping table - they should be using the same values.  Share the mapping
routines as well.

svn path=/trunk/; revision=28173
2009-04-27 09:28:28 +00:00