Wireshark-dev: Re: [Wireshark-dev] Call register_stat_menu_item from a plugin
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 17 Nov 2010 20:30:03 -0800

On Nov 17, 2010, at 8:15 PM, Stephen Fisher wrote:

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.

That mechanism also means that the statistics tree works in both Wireshark *AND* TShark - the GUI code is all in the Wireshark executable, and the tty code is in the TShark executable, and no GUI or tty code needs to be in the plugin itself.  As the README.stats_tree file says:

Let's suppose that you want to write a tap only to keep counters, and you don't want to get involved with GUI programming or maybe you'd like to make it a plugin. A stats_tree might be the way to go. The stats_tree module takes care of the representation (GUI for wireshark and text for tshark) of the tap data. So there's very little code to write to make a tap listener usable from both wireshark and tshark.

You can write generic GTK code in a plugin,

...and a plugin can be a tap plugin as well as a dissector plugin.