11.3. Changes to existing Wireshark files

There are two ways to add your plugin dissector to the build: as a custom extension or as a permanent addition. The custom extension is easy to configure, but won’t be used for inclusion in the distribution if that’s your goal. Setting up the permanent addition is somewhat more involved.

11.3.1. Custom extension

To integrate your plugin with CMake, either pass the custom plugin dir on the CMake generation step command line:

cmake ... -DCUSTOM_PLUGIN_SRC_DIR="plugins/epan/foo"

or copy the top-level file CMakeListsCustom.txt.example to CMakeListsCustom.txt (also in the top-level source dir) and edit so that CUSTOM_PLUGIN_SRC_DIR is set() to the relative path of your plugin, e.g.

set(CUSTOM_PLUGIN_SRC_DIR plugins/epan/foo)

and re-run the CMake generation step.

To build the plugin, run your normal Wireshark build step.

If you want to add the plugin to your own Windows installer add a text file named custom_plugins.txt to the packaging/nsis directory, with a "File" statement for NSIS:

File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\foo.dll"

11.3.2. Permanent addition

In order to be able to permanently add a plugin take the following steps. You will need to change the following files:

  • CMakeLists.txt
  • packaging/nsis/wireshark.nsi

You might also want to search your Wireshark development directory for occurrences of an existing plugin name, in case this document is out of date with the current directory structure. For example,

grep -rl gryphon .

could be used from a shell prompt.

11.3.2.1. Changes to CMakeLists.txt

Add your plugin (in alphabetical order) to the PLUGIN_SRC_DIRS:

if(ENABLE_PLUGINS)
    ...
    set(PLUGIN_SRC_DIRS
        ...
        plugins/epan/ethercat
        plugins/epan/foo
        plugins/epan/gryphon
        plugins/epan/irda
        ...

11.3.2.2. Changes to the installers

If you want to include your plugin in an installer you have to add lines in the NSIS installer wireshark.nsi file.

11.3.2.3. Changes to packaging/nsis/wireshark.nsi

Add the relative path of your plugin DLL (in alphabetical order) to the list of "File" statements in the "Dissector Plugins" section:

File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\ethercat.dll" File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\foo.dll" File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\gryphon.dll" File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\irda.dll"

11.3.2.4. Other installers

The PortableApps installer copies plugins from the build directory and should not require configuration.