Hi Roland,
To avoid a plugin corrupting any of the main Wireshark structures, I’d like to
use a mechanism just like Plugin IF. The more I look at it I realise that I
would basically need to create all the same functionality as Plugin IF, and so
duplicate things like the callback registration function etc. I’d like to
re-use what you have done if I could and so my revised proposal is:
1. Add a structure type to plugin_if.h to contain capture file status
information
* Below is the information I would like to expose
2. Create the function that does the work in main_window.cpp
* static void plugin_if_mainwindow_get_cf_status(_cf_status *status_info)
3. Create plugin_if hook in main_window.cpp
* plugin_if_register_gui_cb(PLUGIN_IF_GET_CF_STATUS,
plugin_if_mainwindow_get_cf_status);
4. Add an entry to the typedef enum for plugin_if_callback_t in plugin_if.h
* PLUGIN_IF_GET_CF_STATUS
5. Add a function to plugin_if.c such as:
* extern void get_current_cf_status(_cf_status *status_info)
6. Make this function available to plugins by adding the following to
plugin_if.h
* WS_DLL_PUBLIC void plugin_if_get_framenr(_cf_status *status_info);
struct _cf_status
{
file_state state; /* Current state of capture file */
gchar *filename; /* Name of capture file */
guint32 count; /* Total number of frames */
guint32 num; /**< Frame number */
unsigned int passed_dfilter; /**< 1 = display, 0 = no display */
};
If you don’t think this is acceptable, is it OK if I just copy the plugin_if
code (renaming as necessary)?
Thanks and regards…Paul
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul Offord
Sent: 04 January 2016 15:51
To: Developer support list for Wireshark <[email protected]>
Subject: Re: [Wireshark-dev] Add plugin_if_get_framenr()
Thanks for the prompt response Roland.
Your proposed way sounds better, so I’ll rethink it in the way you describe.
Thanks and regards…Paul
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Roland Knall
Sent: 04 January 2016 15:43
To: Developer support list for Wireshark
<[email protected]<mailto:[email protected]>>
Subject: Re: [Wireshark-dev] Add plugin_if_get_framenr()
Hi
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.
regards,
Roland
On Mon, Jan 4, 2016 at 4:32 PM, Paul Offord
<[email protected]<mailto:[email protected]>> wrote:
Hi,
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()
1. Create plugin_if hook in main_window.cpp
* plugin_if_register_gui_cb(PLUGIN_IF_GET_FRAMENR,
plugin_if_mainwindow_get_framenr);
1. Add an entry to the typedef enum for plugin_if_callback_t in plugin_if.h
* PLUGIN_IF_GET_FRAMENR
1. Add a function to plugin_if.c such as:
* extern guint32 get_current_framenr()
1. 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]<mailto:[email protected]>>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]<mailto:[email protected]>?subject=unsubscribe
______________________________________________________________________
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
______________________________________________________________________
______________________________________________________________________
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