Resources which one should read while considering compiling and exporting dissectors are:
Compiling the dissector
Assuming that you have Wireshark built from source code and not using sudo apt-get.
Suppose your plugin dissector name is "foo" (typically, that would
be a short name for your protocol, in all lower case)
The directory for the plugin, and its files
The plugin should be placed in a new plugins/foo directory which should
contain at least the following files:
- AUTHORS
- COPYING
- ChangeLog
- CMakeLists.txt
- Makefile.am
- moduleinfo.h
- plugin.rc.in
Details about these files can be found in README.plugins
Now jump back to plugins directory.
For Custom extension
Go to the plugins directory and copy the Custom.m4.example and
Custom.make.example files to files of the same name but without the ".example"
suffix. Now you have two Custom files ready for building a plugin with the
name "foo". Replace the name if you so require.
For CMake builds, either pass the custom plugin dir on the CMake generation
step command line:
CMake ... -DCUSTOM_PLUGIN_SRC_DIR="plugins/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/foo)
Go to the directory Wireshark-2.4.X
Run
$ ./autogen.sh
and ./configure
to setup your build environment.
The good news is that if you are working on a single plugin then you will
find recompiling the plugin MUCH faster than recompiling a dissector and
then linking it back into Wireshark. Use "make -C plugins" to compile just
your plugins.
The bad news is that Wireshark will not use the plugins unless the plugins
are installed in one of the places it expects them to find.
One way of dealing with this problem is to set an environment variable
when running Wireshark: WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1.
Distribution of your plugin
To distribute your plugin you need to provide users with the binaries of your dissector (the .so file produced on compilation of dissector)
The users need to place these files in their Wireshark installation personal plugins folder and restart Wireshark.
To find the plugins folder, open Wireshark and go to Help -> About -> Folders. If the path mentioned in the personal plugins folder doesn't exist then create the same.
Distributing Lua dissectors is fairly easy.
Just copy paste the Lua scripts into the personal plugins folder and your plugin is ready to go.