Thanks Pascal – that’s just what I needed to know.
Best regards…Paul
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx]
On Behalf Of Pascal Quantin
Sent: 26 August 2016 17:27
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: Re: [Wireshark-dev] C equivalent of LUA proto.init
Hi Paul,
2016-08-26 18:01 GMT+02:00 Paul Offord <Paul.Offord@xxxxxxxxxxxx>:
Hi All,
I’m slowly porting the TRANSUM post-dissector from LUA to C. My LUA dissector has a transum.init() function that is called each time a new trace file is opened. Is there an equivalent
mechanism in the C dissector functions.
Have a look at this function allowing you to register a callback:
/**
* Allow protocols to register "init" routines, which are called before
* we make a pass through a capture file and dissect all its packets
* (e.g., when we read in a new capture file, or run a "filter packets"
* or "colorize packets" pass over the current capture file or when the
* preferences are changed).
*/
WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
If you need to cleanup memory (for example) when closing a file, you can register another callback with:
/**
* Allows protocols to register "cleanup" routines which are called
* after closing a capture file (or when preferences are changed, in
* that case these routines are called before the init routines are
* executed). It can be used to release resources that are allocated in
* register_init_routine.
*/
WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
______________________________________________________________________
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
______________________________________________________________________
|