Commit Graph

57 Commits

Author SHA1 Message Date
Michael Mann f2b8504740 Don't limit capture packet counts to a fixed set of protocols.
Kept backwards compatibility with GTK+ capture info dialog by keeping the protocols tracked hardcoded, but Qt should have more freedom.

Change-Id: I497be71ec761d53f312e14858daa7152d01b8c72
Reviewed-on: https://code.wireshark.org/review/12724
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-22 05:23:06 +00:00
Michael Mann 444dfda793 Allow "capture info data" to not be a singleton.
It was buried as a static variable in capture_info.c, and functions were refactored to allow a pointer to the info_data_t structure to be passed in. TShark and GTK will have their own single (global) copy of the structure, while it opens up Qt to have multiple instances.

Change-Id: Ic2d7a2ad574de43f457cb18b194d6bc3fffb6120
Reviewed-on: https://code.wireshark.org/review/12691
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-19 14:22:56 +00:00
Michael Mann f342fdcdb8 Create capture dissector "info" structure (capture_packet_info_t)
While it currently only contains packet_counts, it will hopefully stabilize the capture function signature if more fields are added.

Change-Id: I003552c58043c7c2d67aec458187b12b233057e2
Reviewed-on: https://code.wireshark.org/review/12690
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-17 04:01:56 +00:00
Michael Mann 0960ac4dfd Create capture dissector tables.
They are modeled after dissection dissector tables, but for the moment, don't have/need the flexibility.  They are intended to be much simpler/faster than full dissection.
The two most used/needed are "wtap_encap" and "ethertype", so they were the basis of starting to use and test capture dissector table API.  Others may be added in the future.

The "capture dissector" function signature needed a bit of tweeking to handling "claiming" of a packet.
The current application of this is capture functions returning TRUE if they affected a "type" of packet count.  Returning FALSE ends up considering the packet an "other" type.

Change-Id: I81d06a6ccb2c03665f087258a46b9d78d513d6cd
Reviewed-on: https://code.wireshark.org/review/12607
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-14 12:17:49 +00:00
Michael Mann 56aa05227f Create a way to register "capture" dissectors.
Capture dissectors could be architected like dissection dissectors, with tables and subtables and possibly using tvbs to pass there data instead of raw byte arrays.  This is a first step towards that by refactoring capture_info_packet() to work off of a "capture dissector table"

Registering the capture dissection functions instead of calling them directly also clears up a bunch of dissector header files who sole purpose was providing the capture dissection function definition.

Change-Id: I10e9b79e061f32d2572f009823601d4f048d37aa
Reviewed-on: https://code.wireshark.org/review/12581
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-13 14:34:13 +00:00
Guy Harris fea325d2ba Handle DLT_LOOP differently from DLT_NULL.
That's a little cleaner, and lets us preserve the LINKTYPE_ value for
DLT_LOOP captures.  ("Preserve" here doesn't mean "write files with a
link-layer header type of 12", as that's ambiguous; we write it with a
link-layer header type of LINKTYPE_LOOP, i.e. 108.  If programs on
OpenBSD don't recognize that as DLT_LOOP, that's a bug in OpenBSD's
libpcap or in the program.)

Change-Id: I48a2e04aed41c013823ffb5c588d2a8e8b376e15
Reviewed-on: https://code.wireshark.org/review/7143
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-15 22:47:03 +00:00
Guy Harris 0885d29451 Make sure err_info is always set, and print it iff it's non-null.
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b
Reviewed-on: https://code.wireshark.org/review/5830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 04:04:19 +00:00
Guy Harris 6011a047d3 WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.
Check for them *only* on opening for writing and writes.

Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067
Reviewed-on: https://code.wireshark.org/review/5827
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18 00:41:43 +00:00
Guy Harris db4232a69a This code is used in Wireshark, not TShark; fix messages.
Change-Id: I3c6b7686de478e42eeeb9c51c8bdb5b6843666af
Reviewed-on: https://code.wireshark.org/review/5814
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 20:39:15 +00:00
Guy Harris d2eddde5bd Report WTAP_ERR_UNSUPPORTED correctly.
WTAP_ERR_FILE_UNKNOWN_FORMAT is reported if the file is in a format that
libwiretap doesn't know about (either because it's not a capture file at
all or because it's a capture file in a format it doesn't support).
WTAP_ERR_UNSUPPORTED is for files in a *known* format that are using
features or file format elements (record type, link-layer header type,
etc.) that libwireshark doesn't support.  Fix some copy-and-pasteos
causing WTAP_ERR_UNSUPPORTED to be reported with a message appropriate
for WTAP_ERR_FILE_UNKNOWN_FORMAT.

Change-Id: Ic675ffd501c52838d8944a6c61e1b01041b73098
Reviewed-on: https://code.wireshark.org/review/5799
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:47:59 +00:00
Guy Harris ddcc2aee3d Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442
Reviewed-on: https://code.wireshark.org/review/5798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 08:31:49 +00:00
Guy Harris dbdcae80ba Rename WTAP_ERR_UNSUPPORTED_ENCAP to WTAP_ERR_UNWRITABLE_ENCAP.
That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: Icc5c9cff43be6c073f0467607555fa7138c5d074
Reviewed-on: https://code.wireshark.org/review/5797
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17 06:41:45 +00:00
Bill Meier 1b8b2a8aa8 Add editor modelines; Adjust whitespace as needed.
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad
Reviewed-on: https://code.wireshark.org/review/4626
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-12 18:58:32 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Reviewed-on: https://code.wireshark.org/review/3798
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-24 08:04:08 +00:00
Guy Harris a344c9736e Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c.

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-23 10:50:10 +00:00
Guy Harris c0c480d08c Allow wtap_read() and wtap_seek_read() to return non-packet records.
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-23 03:02:32 +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
Guy Harris a5a692c4ec Handle DLT_USER2 as PKTAP, to handle Mavericks.
Change-Id: Ic58c3584994f822d5d5a1434050aaa61f86ba17c
Reviewed-on: https://code.wireshark.org/review/937
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-03 06:55:18 +00:00
Guy Harris 618c27b5e6 Add a capture_pktap() routine and use it.
That way, the packet counts are will be valid when capturing.

Change-Id: I0a21cc817d918e7f849620db5ca6dfd84bd2cd87
Reviewed-on: https://code.wireshark.org/review/936
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-03 06:45:46 +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
Michal Labedzki 579e7e19ce Wireshark: Add option to choose format type of capture file
The best heuristic can fail, so add possibility to manually choose
capture file format type, so not correctly recognize file format can be
loaded in Wireshark.

On the other side now it is possible to open capture file
as file format to be dissected.

Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a
Reviewed-on: https://code.wireshark.org/review/16
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-25 17:43:13 +00:00
Jakub Zawadzki deb2b236f2 Add missing includes
svn path=/trunk/; revision=54332
2013-12-21 17:23:17 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Guy Harris 853da2eb9b The "file types" we have are actually combinations of types and
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-11-08 09:53:01 +00:00
Guy Harris 8596d17d7f Pull the capture-session state information out of capture_opts and put
it into a separate capture_session structure.  capture_opts should
contain only user-specified option information (and stuff directly
derived from it, such as the "capturing from a pipe" flag).

svn path=/trunk/; revision=49493
2013-05-22 07:44:28 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Guy Harris 835111692f From Richard Stearn: support for AX.25, including support for
LINKTYPE_AX25.

svn path=/trunk/; revision=44211
2012-08-02 16:54:43 +00:00
Guy Harris 4fc130af79 From Richard Stearn: AX.25 KISS protocol support.
Part 1 of the fix for bug 7529.

svn path=/trunk/; revision=44202
2012-08-02 06:45:51 +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 ec69aa8d27 Rename the NetMon 802.11 radio header and radiotap 802.11 radio header
dissector source files to match the "packet-ieee80211-XXX" pattern used
for other 802.11 radio header dissectors.

svn path=/trunk/; revision=42380
2012-05-02 04:03:49 +00:00
Guy Harris 0275247b97 Use WTAP_ENCAP_IEEE_802_11_xxx for all the "802.11 plus radio header"
encapsulations.

For pre-V9 AiroPeek captures, leave the radio information in the packet
data, just as we do with the Prism, AVS, radiotap, and NetMon headers. 
Add a dissector for it.

svn path=/trunk/; revision=42379
2012-05-02 03:11:00 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
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-12-13 09:53:50 +00:00
Michael Tüxen 89599bbb9b Fix the capture info dialog. Reset the EOF state such that the
number get actually updated.

svn path=/trunk/; revision=37279
2011-05-19 04:56:04 +00:00
Guy Harris 6cbf6ce16c Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discovered
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-21 09:41:52 +00:00
Stig Bjørlykke 75568093eb Rewrote error reporting to avoid using a 2048 bytes stack buffer.
Coverity 726.

svn path=/trunk/; revision=36245
2011-03-22 11:25:12 +00:00
Bill Meier 2e4f755e13 Define some vars & fcns as static;
Also: do some minor reformmating and cleanup of whitespace.

svn path=/trunk/; revision=34492
2010-10-12 19:26:07 +00:00
Anders Broman 3eadb385c3 From Alexey Neyman:
Implement dissector for IPMB (DLT_IPMB_LINUX, 209).

svn path=/trunk/; revision=25986
2008-08-12 04:44:35 +00:00
Guy Harris f441b8941e Add gtk/capture_globals.h, to declare global_capture_opts, so files that
don't need global_capture_opts don't need to have it declared and thus
don't need capture_options defined.

Include gtk/capture_globals in the files in question.

Change some more capture_opts references to refer to
global_capture_opts.

Change some global_capture_opts references in routines with a
capture_opts argument to refer to capture_opts.

The structure type is capture_options, not capture_opts; fix some
references.

Include <sys/types.h>, if it's present, in capture_opts.h, so we get
gid_t defined.

Clean up indentation.

svn path=/trunk/; revision=25574
2008-06-24 03:38:15 +00:00
Guy Harris 2a691a0aec Have capture_info_ui_create() and capture_info_open() take a pointer to
the capture_opts structure as an argument, rather than just a pointer to
the interface name.

Don't declare a global "capture_opts" pointer, as we don't define it any
more.

svn path=/trunk/; revision=25570
2008-06-24 01:23:33 +00:00
Guy Harris 9198a2a166 Fold the Prism and AVS header dissectors into packet-ieee80211.c, and
have them use least some of the radio-information fields, so that the
same field name can be used for multiple radio header types.  The AVS
header can supply the data rate in bits/second, so have that field be in
those units, and make it 64 bits to leave room for the future, Just In
Case.  Display it as Mb/s, however.

svn path=/trunk/; revision=23911
2007-12-18 08:01:11 +00:00
Jeff Morriss 25409eb349 If wtap_open_offline() fails, print the errno too
svn path=/trunk/; revision=23077
2007-10-05 22:39:06 +00:00
Stig Bjørlykke cb8dab02be And include packet-wlancap.h
svn path=/trunk/; revision=22752
2007-08-30 11:52:30 +00:00
Stig Bjørlykke d25d82405e Count IEEE 802.11 WLAN AVS packets.
svn path=/trunk/; revision=22750
2007-08-30 11:28:27 +00:00
Gerald Combs 0c4cb64c57 Add capture counts for PPI.
svn path=/trunk/; revision=22195
2007-06-26 19:38:44 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Gerald Combs 8958bab6de Tethereal/tethereal -> TShark/tshark.
svn path=/trunk/; revision=18268
2006-05-31 17:38:42 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00