11.2. The directory for the plugin, and its files
Prev | Chapter 11. Plugins | Next

## 11.2. The directory for the plugin, and its files

The plugin should be placed in a new plugins/epan/foo directory which should contain at least the following files:

- CMakeLists.txt
- README

The README can be brief but it should provide essential information relevant to developers and users. Optionally AUTHORS and ChangeLog files can be added. Optionally you can add your own plugin.rc.in.

And of course the source and header files for your dissector.

Examples of these files can be found in plugins/epan/gryphon.

### 11.2.1. CMakeLists.txt

Your plugins/epan/foo/CMakeLists.txt file gives directions to CMake for compiling and linking your plugin. For simple cases, you can copy the corresponding file in plugins/epan/gryphon. Replace all occurrences of "gryphon" in those files with "foo" and add your source files to the DISSECTOR_SRC variable.

The important elements of this file are, in order of appearance:

include(WiresharkPlugin)
  Defines some important macros. Must be the first non-comment line in the file.
set_module_info(foo 0 0 1 0)
  Defines the name of your library and its major, minor, micro, and extra version numbers.
set(DISSECTOR_SRC …​)
  Defines all source code files that are directly involved in your plugin. Typically these are the files which include the actual registration of your dissector.
set(DISSECTOR_SUPPORT_SRC …​)
  Defines source code files which provide support functions used by your plugin. This is only needed if you have support functions are separate files from those in DISSECTOR_SRC.
set(DISSECTOR_HEADERS …​)
  If your dissector exposes any of its functions in header files, you can list those here. However, add_wireshark_epan_plugin_library() automatically finds and include all header files in the plugin directory, so this is not strictly necessary.
add_wireshark_epan_plugin_library(foo)
  Informs CMake that your foo plugin is a dissector plugin (ie, epan). This covers the most common cases for dissector plugins. If your plugin is a different type, use the appropriate macro, e.g. add_wireshark_wiretap_plugin_library() for a wiretap plugin. Also, if your plugin is a dissector plugin but it doesn’t fit the common case, you can use add_wireshark_epan_plugin_library() as a starting point and then modify the resulting CMake code as needed.

### 11.2.2. plugin.rc.in

Your plugins/epan/foo/plugin.rc.in is the Windows resource template file used to add the plugin specific information as resources to the DLL. If not provided the plugins/plugin.rc.in file will be used.

Prev | Up | Next
Chapter 11. Plugins | Home | 11.3. Changes to existing Wireshark files