Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] wiretap plugin

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 12 May 2017 23:18:26 +0200
Hi List,

Thanks to Anders for the additional information provided (off list). There are
clearly problems in make-dissector-reg.py with respect to handling wiretap
plugins. I've nailed one, but found some others which I will have to address
later on.

In short make-dissector-reg.py has to handle epan/dissectors/*.c registrations
and various plugin type combinations. Plugin types currently used are dissector,
(lib)wiretap and tap. Note that these types can be combined in a single plugin.
I'm not sure the current architecture of make-dissector-reg.py supports this
easily. I would consider breaking out make-plugin-reg.py, which deals explicitly
with plugins, unless there's strong opposition against it.

Oh, and this only works with CMake so far. Autotool build is broken as well.

Thanks,
Jaap


On 12-05-17 08:00, Jaap Keuter wrote:
> Hi Anders,
> 
> What symbol do you add your wiretap plugin path to?
> I added mine to CMakeLists.txt, like so:
> 
> if(ENABLE_PLUGINS)
> 	...
> 	set(PLUGIN_SRC_DIRS
> 		...
> 		plugins/unistim
>                 plugins/usbdump
> 		...
> 
> 
> But that results in this build failure:
> 
> Scanning dependencies of target unistim
> [ 97%] Building C object plugins/unistim/CMakeFiles/unistim.dir/plugin.c.o
> [ 97%] Building C object plugins/unistim/CMakeFiles/unistim.dir/packet-unistim.c.o
> [ 97%] Linking C shared module ../../run/plugins/unistim.so
> [ 97%] Built target unistim
> [ 97%] Generating plugin.c
> No protocol registrations found
> plugins/usbdump/CMakeFiles/usbdump.dir/build.make:62: recipe for target
> 'plugins/usbdump/plugin.c' failed
> make[2]: *** [plugins/usbdump/plugin.c] Error 1
> CMakeFiles/Makefile2:12269: recipe for target
> 'plugins/usbdump/CMakeFiles/usbdump.dir/all' failed
> make[1]: *** [plugins/usbdump/CMakeFiles/usbdump.dir/all] Error 2
> Makefile:149: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> 
> While my plugin code has this registration function:
> 
> void wtap_register_usbdump(void)
> {
> 	...
> }
> 
> 
> Thanks,
> Jaap
> 
> 
> On 10-05-17 12:03, Jaap Keuter wrote:
>> Hi Anders,
>>
>> That is good to know. I’ll setup a cmake build as well (on Debian GNU/Linux).
>>
>> Thanks,
>> Jaap
>>
>>
>>> On 10 May 2017, at 10:53, Anders Broman <anders.broman@xxxxxxxxxxxx> wrote:
>>>
>>> Hi,
>>> Plugin.c is generated but with make it does not generate 
>>>
>>> WS_DLL_PUBLIC_DEF void
>>> register_wtap_module(void)
>>> {
>>>
>>> It looks like, it works with cmake...(at least on Wimdows)
>>> Regards
>>> Anders
>>>
>>>
>>> -----Original Message-----
>>> From: Wireshark-dev [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Jaap Keuter
>>> Sent: den 9 maj 2017 17:14
>>> To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
>>> Subject: Re: [Wireshark-dev] wiretap plugin
>>>
>>> Hi Anders,
>>>
>>> Thanks for having a look. This all seems quite in order. 
>>> Was this carried over from an older build, ie. is that plugin.c file recent? Does it get regenerated when moved out of the way?
>>> I’ll try testing this further tonight.
>>>
>>> Thanks,
>>> Jaap
>>>
>>>
>>>> On 9 May 2017, at 16:46, Anders Broman <anders.broman@xxxxxxxxxxxx> wrote:
>>>>
>>>> Hi,
>>>> In the folder where I have the plugin, plugin.c has the line
>>>> * Generated automatically from C:\Development\ewireshark\trunk\tools\make-dissector-reg.py.
>>>> It also has
>>>> WS_DLL_PUBLIC_DEF void
>>>> register_wtap_module(void)
>>>> {
>>>> :
>>>>
>>>> I think I have modified the following files:
>>>> CMakeListsCustom.txt
>>>> plugins/CMakeListsCustom.txt
>>>> plugins/Custom.m4
>>>> plugins/Custom.make ( 3 places)
>>>> packaging/nsis/custom_plugins.txt
>>>>
>>>>
>>>> The Cmake file in the plugin folder has:
>>>> register_dissector_files(plugin.c
>>>> 	plugin_wtap
>>>> 	${DISSECTOR_SRC}
>>>> )
>>>>
>>>>
>>>> Regards
>>>> Anders
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Wireshark-dev [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On 
>>>> Behalf Of Jaap Keuter
>>>> Sent: den 9 maj 2017 13:48
>>>> To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
>>>> Subject: Re: [Wireshark-dev] wiretap plugin
>>>>
>>>> Hi Anders,
>>>>
>>>> Are you sure? I’m concerned about the generation of plugin.c. From 
>>>> reading plugins/Makefile.am.inc it seems that it only generates for 
>>>> dissector plugins (keyword: plugin), not for wiretap plugins (keyword: 
>>>> plugins_wtap)
>>>>
>>>> #
>>>> plugin.c: $(REGISTER_SRC_FILES) $(top_srcdir)/tools/make-dissector-reg.py
>>>>       @echo Making plugin.c
>>>>       @$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
>>>>               plugin $(REGISTER_SRC_FILES)
>>>>
>>>>
>>>> Thanks,
>>>> Jaap
>>>>
>>>>
>>>>
>>>>
>>>>> On 9 May 2017, at 12:08, Anders Broman <anders.broman@xxxxxxxxxxxx> wrote:
>>>>>
>>>>> Hi,
>>>>> It's in the same files as other custom plugins. Top level 
>>>>> CMakeListCustom.txt etc Regards Anders
>>>>>
>>>>> -----Original Message-----
>>>>> From: Wireshark-dev [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On 
>>>>> Behalf Of Jaap Keuter
>>>>> Sent: den 9 maj 2017 11:12
>>>>> To: Developer support list for Wireshark 
>>>>> <wireshark-dev@xxxxxxxxxxxxx>
>>>>> Subject: [Wireshark-dev] wiretap plugin
>>>>>
>>>>> Hi list,
>>>>>
>>>>> Does anyone currently have a wiretap plugin setup for building in current master?
>>>>> It seems that the plugin Makefile abstractions (plugins/Makefile.am.inc) are geared to dissector plugins, while tools/make-dissector-reg is still capable of making a plugin_wtap as well. And I haven’t even looked at CMake yet. 
>>>>> Can anyone share an example collection of current build files for a wiretap plugin?
>>>>>
>>>>> Thanks,
>>>>> Jaap