ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] Call register_stat_menu_item from a plugin

From: "Alistair Evans" <evans_alistair@xxxxxxxxxxx>
Date: Thu, 18 Nov 2010 00:21:36 -0000

Hi,

I'm writing a plugin for a custom protocol. The dissector portion is working fine, as is adding a tap for that protocol. I would now like to add a menu item to the statistics menu that allows me to show a window with extra info created by the tap. I can build with GTK in order to generate the window I want to create, but I'm having problems adding the menu item.

After looking through some of the code in wireshark, I can see that I need to call register_stat_menu_item in order to create that menu item. With this in, the code compiles, but does not link. I believe this is because I need to link the ui library that the register_stat_menu_item method is compiled into (libui.lib), but doing so raises a massive number of other linker errors. This is the only method from the UI that I actually need to call in the plugin, since everything else can be created and managed separately.

Is there a way I can call that function from my plugin (even if it means manually calling the method by finding a pointer to it at runtime)?

Cheers