Commit Graph

32 Commits

Author SHA1 Message Date
João Valverde 7f32c90ab9 plugins: Add a codecs API level
Add a minimum and maximum API level. Backward-compatible changes to
the API only bump the maximum API level. Backward incompatible
changes bump the maximum API level and the mininum, to the
new (maximum) level.

This may allow codec plugins to continue working without recompilation,
possibly with reduced functionality.

The API level is only defined for codecs because it is a small
and easy to define API, and very stable.

Maybe we could do the same for wiretap (file type) plugins. For the
various epan plugin types it seems pointless and futile. I cannot
see a scenario where a new Wireshark minor release does not increase
the minimum API level.
2023-12-14 16:18:35 +00:00
João Valverde b52d9173f8 Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
    lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
    lib/plugins/{epan,wiretap,codecs}

Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.

This is a simplified filesystem layoutfor plugins some
important benefits such as:

 * improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
 * does not clash with Apple guidelines
 * simpler for users to understand and apply
 * just overall simpler and easier to maintain, removes a lot
of complexity from CMake code

It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.

It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.

Follow-up to 90b16b4092.
2023-12-14 14:28:30 +00:00
João Valverde 8486ba26c6 epan: Add plugin get_descriptions callback
Allow epan plugins to push descriptions for each individual
plugin or extension managed by the epan plugin interface.

For example a Lua or Python epan plugin can push
descriptions for each *.lua or *.py script it registers.
2023-12-12 14:43:37 +00:00
João Valverde 0bcd2b6e6f wslua: Add a scope field to lua plugin description 2023-12-08 15:44:07 +00:00
João Valverde 47376298a5 plugins: Remove an assertion 2023-12-08 11:58:48 +00:00
João Valverde a7827322fc plugins: Rename "dfilter" to "dfunction" 2023-12-08 00:45:36 +00:00
João Valverde c76a28fca4 Qt: Add Install Plugin to Tools menu
Add an option to the tools menu to copy a binary plugin file
(a .dll or .so) to the personal plugin folder.

This avoids the user having to create the paths manually and
knowning a lot of relatively unimportant details about where and
how Wireshark loads binary plugins.

It will also try to validate the plugin and do some sanity checks to
ensure the ABI is compatible.
2023-12-07 22:58:33 +00:00
João Valverde 51c6fa874d Qt: Replace plugin column "Path" with "Scope" in About dialog
Instead of using a Path field, that is really long and contains
a lot of redundant information, use a scope field that indicates
if the plugin is a personal plugin (loaded from the personal plugins
folder) or a global plugin (loaded from the global plugins folder).

Together with the plugin name this allows to construct the path
completely. By right-clicking on the row it is possible to open the file
browser in the correct plugin path and the personal/global plugin
folder path itself is displayed elsewhere.

Extcap and Lua scripts need to be enhanced to provide this
information too.
2023-12-07 02:07:51 +00:00
João Valverde 9c39c82cb1 Qt: Add plugin description/homepage fields to About dialog
Adds the description and homepage columns to the TableView in
the "About Wireshark" plugins tab.

Currently extcap and lua scripts lack this information, this
could be improved in the future.
2023-12-05 23:47:35 +00:00
João Valverde 869728143d Remove plugin license check
This removes the license check introduce with commit 90b16b4092.

After discussion and criticism received on the mailing list
I now think this license requirement is too permissive on
one hand about GPL compatibility and on the other it can be
a significant inconvenience for users who do not wish to distribute
the modified work, and so in its current form the change did
not advance the project's goals or GPL compliance.
2023-12-05 20:27:48 +00:00
João Valverde 0b2bb4fdb3 plugins: Remove unused "min_api_level" field
Remove currently unused minimum API level argument. Just pass
NULL to the module load function.
2023-12-04 15:53:08 +00:00
João Valverde 90b16b4092 Refactor plugin registration and add ABI/license check
Remove the boilerplate and multiple symbols required
to write and load a plugin and use a simpler
interface that is also much more featureful and
extensible.

This removes the major.minor ABI check in favor of an
ABI version number that is simpler and more flexible.

In practice our 3 separate ABI versions still increase
with each major.minor version number but this may change
in the future, particularly for codecs that have a much
narrower and stable codec API.

There is a new license compatibility check. Plugins
must declare if the use GPLv2 or later, or alternatively
an FSF compliant GPLv2 compatible license. Otherwise
Wireshark refuses to load the plugin. The SPDX ID is
just an ancillary field and not enforced currently.

Adds more metadata fields during plugin registration.
These are only used for display and debugging.

There is an extra API level number in the registration API
that is reserved for future use.
2023-12-03 23:20:39 +00:00
João Valverde 8f28a0e9f3 plugins: Make flags unsigned 2023-10-30 09:37:29 +00:00
João Valverde d99efed280 dfilter: Add display filter plugins
Allow writing display filter plugins in C. Plugins can
register one or more display filter functions.

This should lower the barrier for implementing and sharing
new display feature extensions.

An example plugin will be provided in a follow-up commit.

TODO: Put some work into refactoring display filter headers.
Right now some plugin-related APIs are implemented in dfilter-int.h,
which we'd rather not install to the system.
2023-10-26 00:13:30 +01:00
João Valverde 7fbed5b306 plugins: Allow multiple types in description
Allow plugins to declare their type, for the purpose of inserting
a description in the UI. The type consist of one or more bit ORed
flags.

This fixes the 'stats_tree' plugin description in the UI.
The plugin is not a dissector type plugin, as was being displayed
before. Now it correctly shows "tap listener" plugin.
2023-10-25 23:12:21 +00:00
Gerald Combs 8285a9775f Convert wsutil to C99 types
Ping #19116
2023-09-24 19:05:10 +00:00
João Valverde b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +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 59c082c046 Add new global header wireshark.h with guideline
Remove ws_diag_control.h from config.h because that was a workaround
for the lack of a public global header. Fix the resultant build errors.
2021-10-22 06:41:44 +00:00
Guy Harris e434d404d0 Move even more headers outside extern "C".
If a header declares a function, or anything else requiring the extern
"C" decoration, have it wrap the declaration itself; don't rely on the
header itself being included inside extern "C".
2021-03-16 04:33:00 -07:00
Michal Ruprich c8246c9973 Moving glib.h out of extern C 2021-02-10 17:49:09 +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
Gerald Combs 5639b8014a Use an enum for plugin types.
Make plugins.c the source of truth for plugin names. Where plugins
reside and what they do are two different things, so split the plugin
directory and description into two separate elements.

CMake creates portable[1] builds on Windows and macOS. That is, the
build-time directory layout is the same as the installation directory
layout. Adjust various plugin paths macOS accordingly.

[1] You have to run osx-app.sh on macOS to prepare the application
bundle, but the goal is to create a directory/bundle that can be moved
or copied to a different system and run in the new location.

Change-Id: Icf9d02e61918fdf1404468baf52542910edf2743
Reviewed-on: https://code.wireshark.org/review/25166
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-11 00:58:43 +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
Michael Mann 3d673da88c Convert to using use SPDX identifier on wsutil directory
Change-Id: Id73e641499e75bc1afc1dea29682418156f461fe
Reviewed-on: https://code.wireshark.org/review/24751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-10 04:36:29 +00:00
João Valverde 14e687c1dd Make plugin support a runtime property
Keep the option to disable at compile-time but use AC_ARG_ENABLE instead.

Change-Id: Ie8c3f5ba0db1eb6d9d4ffd742cd3aa049ead5007
Reviewed-on: https://code.wireshark.org/review/24026
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-23 20:04:14 +00:00
João Valverde 0b76a4957d plugins: Sort the descriptions
Change-Id: I8113ba9782962856ce86475cddf40d69ed267fb4
Reviewed-on: https://code.wireshark.org/review/23733
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26 09:50:14 +00:00
João Valverde 8615081a09 plugins: Fix crash loading binary module twice
If a plugin is repeated we destroy the GModuleHandle in plugins_scan_dir()
but we have already added the entry points to the list of registered
plugins.

Check for repeated plugins before adding it to the list of registered
plugins, not after.

Don't check for both name and version, check only for repeated names.

Give the plugin callback a more descriptive name.

Change-Id: I22cbbb059b8029877580fc33517310496c93e5d5
Reviewed-on: https://code.wireshark.org/review/23726
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-25 16:45:23 +00:00
Dario Lombardo 6d79055ba6 wsutil: remove leaks from filesystem and plugins code.
Change-Id: Iac2805c0130bd2ba6cdb3c9dd997050274d58d99
Reviewed-on: https://code.wireshark.org/review/20020
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 13:45:14 +00:00
Guy Harris 2a38dc74ed Have scan_plugins() take an argument specify what to do on load failures.
That's a less gross hack to suppress load failures due to not having
libwiretap than providing a no-op failure-message routine, as it at
least allows other code using a failure-message routine, such as
cmdarg_err() and routines that call it, to be used.

We really should put libwiretap and libwireshark plugins into separate
subdirectories of the plugin directories, and avoid even looking at
libwireshark plugins in programs that don't use libwireshark.

Change-Id: I0a6ec01ecb4e718ed36233cfaf638a317f839a73
Reviewed-on: https://code.wireshark.org/review/17506
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-05 23:27:02 +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 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