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

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

From: Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Nov 2010 21:15:33 -0700
On Thu, Nov 18, 2010 at 12:21:36AM -0000, Alistair Evans wrote:

> 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.

In case you're not aware: there is functionality in Wireshark to build a 
basic statistics tree with information from a dissector (including 
plugins).  You can read about it in README.stats_tree in the doc 
directory of the source code.

The register_stat_menu_item() function is currently only called from 
code in the gtk directory, which can listen for tapped data from a 
dissector (for example, export_object_http.c).  Other plugins call gtk 
code, but not the stats menu.  Is it a requirement that you make your 
code a plugin?

You can write generic GTK code in a plugin, but not functions in our 
libui.  I suppose you could modify the plugin makefiles sufficiently to 
link in everything you need.  For example, look at the Wireshark 
libraries that are linked in to build Wireshark itself with automake 
(Unix):

wireshark_LDADD = \
        gtk/libui.a                     \
        codecs/libcodec.a               \
        wiretap/libwiretap.la           \
        epan/libwireshark.la            \
        wsutil/libwsutil.la             \

That should satisfy the dependencies that libui has for other Wireshark 
functions.

Someone else may have other ideas..