Wireshark-dev: Re: [Wireshark-dev] Add plugin_if_get_framenr()
From: Roland Knall <[email protected]>
Date: Mon, 4 Jan 2016 16:42:59 +0100

The plugin_if functionality exists, because methods called by plugins run in a different thread context than the gui. Therefore, if you want to gui to act in a certain way, you have to somehow cross the context to achieve whatever you want to do. 

Your proposed idea goes in the other direction. You just want the gui to provide you with information about the currently selected frame nr. The approach here would be to add such a functionality in a ui/*.h file, which exposes this information for both gtk and qt interfaces (for now you would need to implement both) and allow anyone to get this information without a thread change. 

The plugin if functions also by default do not return anything, as they can (at least theoratically) be bound to multiple outputs. the plugin_if_goto_frame could not only trigger the callback for the qt interface, but for a simultanously running gtk interface as well. In reality, this will not happen, but it could. So if you would ask the interface to give you the current frame number and 2-3 different systems are connected, which of the returned values (and it must be returned by a ref-parameter not return value) will you accept?

So, to summarize, no, the plugin-if is not the right thing to use, this is a funcionality best exposed in some ui/*.h file, maybe a new one, and an interface the gui implementations provide.


On Mon, Jan 4, 2016 at 4:32 PM, Paul Offord <[email protected]> wrote:



I’d like to add a new Plugin IF function to get the currently displayed frame number.  I believe I can do it like this:

  1. Create the function that does the work in main_window.cpp
    • static guint32 plugin_if_mainwindow_get_framenr()
  2. Create plugin_if hook in main_window.cpp
    • plugin_if_register_gui_cb(PLUGIN_IF_GET_FRAMENR, plugin_if_mainwindow_get_framenr);
  3. Add an entry to the typedef enum for plugin_if_callback_t in plugin_if.h
  4. Add a function to plugin_if.c such as:
    • extern guint32 get_current_framenr()
  5. Make this function available to plugins by adding the following to plugin_if.h
    • WS_DLL_PUBLIC guint32 plugin_if_get_framenr();

Before I get carried away writing code


·        Would this be acceptable as an addition to Wireshark?

·        Is the above correct?


Thanks and regards…Paul


This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

Any views or opinions expressed are solely those of the author and do not necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour House, Coopers End Lane, Stansted, Essex CM24 1SJ

This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com

Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe