Commit Graph

55 Commits

Author SHA1 Message Date
Roland Knall 0640b711ea tap: Mark filtered packets instead of dropping them
Allows packets to be filtered but marked and not removed from the
tap listing. Additionally a total is calculated for all rx/tx frames
and bytes
2022-06-10 09:17:52 +02:00
Roland Knall 2cf938cfa8 tap: Adding flags for tap_packet
This allows flags to be passed by the registering listener
to the collection of information
2022-06-10 05:46:15 +00:00
Moshe Kaplan 1c3a9af869 Add files with WS_DLL_PUBLIC to Doxygen
Add @file markers for most files that
contain functions exported with
WS_DLL_PUBLIC so that Doxygen will
generate documentation for them.
2021-11-29 21:27:45 +00:00
João Valverde 89fee9321e Avoid exposing HAVE_PLUGINS in the public API
Instead *_register_plugin() is turned into a noop (with a warning).

The test suit is failing with ENABLE_PLUGINS=Off (it was already failing
before and this patch didn't affect that).

Closes #17202.
2021-02-06 16:35:51 +00:00
Guy Harris 1f15c0899e epan: have a routine to register all tap listeners.
Pull the code to register plugin taps, and the loop to register built-in
taps, into a single register_all_tap_listeners() routine.

This leaves it up to libwireshark, not to the programs using it, to know
how to register them.
2021-01-30 21:15:30 -08:00
Guy Harris 2d41b15495 Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.

We make the return value from the packet routine an enum.

Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.

One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".

Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".

Clean up some white space while we're at it.

Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01 05:03:42 +00:00
Jim Young a5a38daba0 Fix typo: aplications to applications
Change-Id: I14948f563a7638b5bd28f4450ffe1bd98a491e6a
Reviewed-on: https://code.wireshark.org/review/31243
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-29 08:19:49 +00:00
Nick Calus 0398e70b2c epan: add missing comment for function parameter on register_tap_listener
Added parameter documentation that was missing for parameter tap_finish
on function register_tap_listener in epan/tap.h

Bug: 15162
Change-Id: I2b9f2a8816c049647128b317433b7dc21cc44f91
Reviewed-on: https://code.wireshark.org/review/29995
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-10-03 14:07:14 +00:00
Guy Harris 9b731e2b32 Add a tap "finish" callback, called when a listener is removed.
Change-Id: Ic6c23dbd39d1adf8f730f1c866e409f731947475
Reviewed-on: https://code.wireshark.org/review/28786
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-21 00:51:13 +00:00
Peter Wu 802223829e tap: fix remaining potential memleaks with register_tap_listener
Additionally, add an attribute to the tap function to prevent future
callers from leaking this memory.

Change-Id: Ief6af2bbc74d19153628f09d7b273e85cb2284ab
Reviewed-on: https://code.wireshark.org/review/26642
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-27 04:51:00 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
João Valverde 995812c5f1 Refactor plugin registration and loading
Put different types of plugins (libwiretap, libwireshark) in different
subdirectories, give libwiretap and libwireshark init routines that
load the plugins, and have them scan the appropriate subdirectories
so that we don't even *try* to, for example, load libwireshark plugins
in programs that only use libwiretap.

Compiled plugins are stored in subfolders of the plugin folders, with
the subfolder name being the Wireshark minor version number (X.Y). There is
another hierarchical level for each Wireshark library (libwireshark, libwscodecs
and libwiretap).

The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}.

Currently we only distribute "epan" (libwireshark) plugins.

Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb
Reviewed-on: https://code.wireshark.org/review/23983
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-12-14 08:43:57 +00:00
Guy Harris 8aa14236f8 Have the frame_tvbuff.c routines not use the global cfile.
Have the routines that create them take a pointer to a struct
packet_provider_data, store that in the tvbuff data, and use it to get
the wtap from which packets are being read.

While we're at it, don't include globals.h in any header files, and
include it in source files iff the source file actually uses cfile.  Add
whatever includes that requires.

Change-Id: I9f1ee391f951dc427ff62c80f67aa4877a37c229
Reviewed-on: https://code.wireshark.org/review/24733
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-08 08:31:41 +00:00
Guy Harris ccc55bc80c Put the structure of a capture_file back in cfile.h.
The split isn't necessary now that epan no longer uses the capture_file
structure.

Change-Id: Ia232712a2fb5db511865805518e8d03509b2167f
Reviewed-on: https://code.wireshark.org/review/24693
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-04 05:35:36 +00:00
Guy Harris eb8ffb74e2 Use cfile.h to define the capture_file type.
Have cfile-int.h declare the structure, and use it in files that
directly access the structure.

Have cfile.h just incompletely declare the structure and include it
rather than explicitly declaring it in source files or other header
files.

Never directly refer to struct _capture_file except when typedeffing
capture_file.

Add #includes as necessary, now that cfile.h doesn't drag in a ton of

Change-Id: I7931c8039d75ff7c980b0f2a6e221f20e602a556
Reviewed-on: https://code.wireshark.org/review/24686
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-03 18:54:37 +00:00
Dario Lombardo 0b25b1ab07 tap: add cleanup routine.
Change-Id: I460b053880ed43a7377b7696531bbaeb0fd0d68b
Reviewed-on: https://code.wireshark.org/review/19764
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-04 13:25:14 +00:00
Pascal Quantin a383e692c8 Revert "tap: change glib functions to wmem."
This reverts commit 2e9f3c5d36.

It breaks the registration of codec, dissector and libwiretap plugins.

Change-Id: I4ef91dd192f765adf87ea9fe9f3693e25dbd24de
Reviewed-on: https://code.wireshark.org/review/16012
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-19 10:47:10 +00:00
Dario Lombardo 2e9f3c5d36 tap: change glib functions to wmem.
Change-Id: I878ae6b121a669f9b7f4e1e57bc079f0cb44c0bf
Reviewed-on: https://code.wireshark.org/review/15270
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-17 15:38:03 +00:00
Stig Bjørlykke fa40025a7e Recompile dfilter for all tap listeners when fields changed
When fields have changed the compiled display filter may be invalid
or need a recompile to be valid.

Filters which are not valid after a recompile is set to a filter
matching no packets (frame.number == 0) to indicate that this does
no longer match anything.  We should probably have a better filter
matching no packet for this purpose.

Change-Id: Id27efa9f46e77e20df50d7366f26d5cada186f93
Reviewed-on: https://code.wireshark.org/review/10123
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-19 08:55:19 +00:00
AndersBroman a3e3d60310 Align comments
Change-Id: Iab59ba51700b018337552018c76e30dcbd41f3f6
Reviewed-on: https://code.wireshark.org/review/9993
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-12 11:27:38 +00:00
Evan Huus 85f38f9f75 tap: Add ability to reject/ignore "error" packets in tap
ICMP (and a few other protocols) can carry "error packets" as payloads in
certain cases. In the same way that we don't (by default) call TCP reassembly
code on TCP packets we know are out-of-order, we also shouldn't call tap code on
frames carried in ICMP error packets.

Bug: 11184
Change-Id: Ie83dbb505c8fdc15c5554705488c16fa0274a06a
Reviewed-on: https://code.wireshark.org/review/8446
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-05-16 12:13:45 +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
Evan Huus d5c437e8e5 Fix function prototypes.
Functions with no parameters must be written func(void). Fixes (some) of the
buildbots.

Change-Id: I1a6e5c0553e032e99419fe67eb4b573bbdfe7fe6
Reviewed-on: https://code.wireshark.org/review/388
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-25 21:46:55 +00:00
Hadriel Kaplan 860747e1e7 Adds some Lua helper functions: some commonly used functions, and to help troubleshooting Lua scripts
There are some common things people need to do, such as convert to/from hex or get
the raw binary string in a ByteArray/Tvb/TvbRange. These have been added, as well
as some tests for them in the testsuites. Also, functions have been added to allow
a script to get all the available tap types and filter fields, since they are
not exactly what one can see in the Wireshark gui.

Change-Id: I92e5e4eae713bb90d79b0c024eaa4e55b99cc96b
Reviewed-on: https://code.wireshark.org/review/249
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25 21:06:21 +00:00
Pascal Quantin a9725030e5 Make it possible to use have_tap_listener() in a plugin
svn path=/trunk/; revision=54663
2014-01-08 15:58:49 +00:00
Gerald Combs 5be6dd5feb Remove config.h includes from proto.h and tap.h.
svn path=/trunk/; revision=53913
2013-12-10 20:23:33 +00:00
Jakub Zawadzki 5fa7d37e37 Fix epan building with undefined HAVE_PLUGINS
+ guard prototypes with HAVE_PLUGINS in .h files to get errors before linking.

svn path=/trunk/; revision=53909
2013-12-10 19:13:09 +00:00
Guy Harris 0cc1545d05 Move most of the plugin code from epan to wsutil and remove all
knowledge of particular types of plugins.  Instead, let particular types
of plugins register with the common plugin code, giving a name and a
routine to recognize that type of plugin.

In particular applications, only process the relevant plugin types.

Add a Makefile.common to the codecs directory.

svn path=/trunk/; revision=53710
2013-12-02 08:30:29 +00:00
Anders Broman 9b2e608670 Add doxygen comments.
svn path=/trunk/; revision=49146
2013-05-03 17:33:13 +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
Gerald Combs 576b24c96e Move ui-independent object export routines to the common ui directory.
Implement DICOM, HTTP, and SMB object exports. Rename the GTK+ export
files. C++-ize epan/tap.h. Fix an apparent memory leak in
eo_save_all_clicked_cb.

The Qt dialog has an indeterminate progress bar. I tried adding
something similar to the GTK+ dialog but event processing led down a
rabbit hole.

svn path=/trunk/; revision=45647
2012-10-18 21:14:43 +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
Jeff Morriss 009156289f Fix the test.sh failures based on Guy's suggestion in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5445#c15 :
Add a new tap flag to indicate that a tap listener is just a "dissector helper",
that is, a tap which is used by a dissector to help it do its dissection but
does not, itself, require dissection.

Use this new flag in the dissectors which register taps.

Remove the (now-unused) have_tap_listeners() function.

svn path=/trunk/; revision=37069
2011-05-12 03:18:34 +00:00
Chris Maynard 595e5e1c1d Add ICMP tap support, and add a tshark tap to measure such things as:
* Number of ICMP echo requests, replies, lost replies and percent loss.
  * Min, Max, Average SRT (Service Response Time), and standard deviation.
(This is my first tap, so hopefully I didn't miss something, but we'll see ...)
TODO: Add a Wireshark tap.


svn path=/trunk/; revision=36480
2011-04-05 20:21:59 +00:00
Anders Broman 05642bcab3 Add doxygen coments.
svn path=/trunk/; revision=34053
2010-09-03 07:28:51 +00:00
Stig Bjørlykke e162470d6b Prime interesting fields when selecting a package, so Lua's ProtoField
can extract the field value correctly.

This fixes bug 4058.

svn path=/trunk/; revision=30252
2009-10-02 19:55:43 +00:00
Kovarththanan Rajaratnam 2046b144d9 Sanitize epan includes
svn path=/trunk/; revision=29502
2009-08-21 20:51:13 +00:00
Guy Harris cf91fdf16b Have tap listeners specify whether the "packet" routine requires
a protocol tree;

	the column values.

This includes stats-tree listeners.

Have the routines to build the packet list, and to retap packets, honor
those requirements.  This means that cf_retap_packets() no longer needs
an argument to specify whether to construct the column values or not, so
get rid of that argument.

This also means that there's no need for a tap to have a fake filter
to ensure that the protocol tree will be built, so don't set up a fake
"frame" filter.

While we're at it, clean up some cases where "no filter" was represented
as a null string rather than a null pointer.

Have a routine to return an indication of the number of tap listeners
with filters; use that rather than the global num_tap_filters.

Clean up some indentation and some gboolean vs. gint items.

svn path=/trunk/; revision=28645
2009-06-05 22:42:47 +00:00
Guy Harris 31cae6e4ef Require GLib 2.4 or later.
That means that G_GINT64_MODIFIER will be defined, so don't check
whether it's defined.

We don't use the PRI[douxX]64 macros, as we use the GLib print routines
and thus use G_GINT64_MODIFIER instead.  Get rid of the checks for
whether inttypes.h defines PRI[douxX]64; just check whether it exists at
all.

That means we don't set INTTYPES_H_DEFINES_FORMATS, so don't check for
it.

svn path=/trunk/; revision=25243
2008-05-05 22:47:32 +00:00
Stig Bjørlykke 43272f9435 Added an option to Conversations and Endpoints to limit the list to match
the current display filter.

Some Hosts -> Endpoints cleanup.

svn path=/trunk/; revision=24368
2008-02-17 00:35:55 +00:00
Jeff Morriss 1295039ee9 Wireshark now requires support for 64-bit types so there's no need to #ifdef
around them.  Print 64-bit types using the PRI macros; add inttypes.h to
tap.h (if necessary) to pick up those macros for all the taps.

svn path=/trunk/; revision=21442
2007-04-16 04:34:07 +00:00
Stephen Fisher 8d8452b419 Introduce a new function called have_tap_listener(int tap_id) to
tell if a specific tap id is currently listening for data.
This complements the function have_tap_listeners(), which checks
to see if any tap is currently listening.


svn path=/trunk/; revision=20979
2007-03-06 00:35:35 +00:00
Jeff Morriss f2e0f951f7 fetch_tapped_data() returns a const pointer, so declare the function as returning such
svn path=/trunk/; revision=20861
2007-02-19 12:24:32 +00:00
Gerald Combs f7e38bd5e6 Change ETH_VAR_IMPORT to WS_VAR_IMPORT. Try to fix a duplicate variable
definition in the Catapult DCT2000 code.

svn path=/trunk/; revision=18524
2006-06-20 18:30:54 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Ronnie Sahlberg d12b09b886 new function fetch_tapped_data()
This function can be called from a dissector to fetch (if any) tapped data from a tap.
This can offer an alternative method of passing data between different dissectors much cleaner than the pinfo pollition and private_data design mistake.


The SMB2 dissector uses this method to extract vital data such as Account_Name from the ntlmssp dissector (that is 3 leveld down from smb2)




svn path=/trunk/; revision=16722
2005-12-07 13:12:39 +00:00
Guy Harris b2807e2ab6 Move the APIs for registering and processing "-z" command-line arguments
and "Statistics" menu items into "stat.h" and "stat.c", to separate them
from the core tapping APIs.  A tap could conceivably not register as a
"-z" command-line argument or "Statistics" menu item, and a stat could
conceivably not be implemented as a tap, and dissectors that implement
tapping points don't need the UI-related stuff from "stat.h", they just
want the tap-related stuff in <epan/tap.h>.

svn path=/trunk/; revision=15427
2005-08-19 09:29:41 +00:00
Guy Harris 5fb6e97fb4 Squelch more const warnings (and fix some memory leaks that found).
_U_-ify some unused arguments, rather than assigning them to themselves.

Un-constify one variable that gets assigned a mallocated pointer.

Clean up indentation.

svn path=/trunk/; revision=15236
2005-08-06 03:44:55 +00:00
Jörg Mayer 69dcb66cd9 More char -> const char warning fixes
svn path=/trunk/; revision=15218
2005-08-05 00:23:22 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00