Wireshark-dev: Re: [Wireshark-dev] When is the preference variable updated?
From: Anders Broman <anders.broman@xxxxxxxxxxxx>
Date: Thu, 12 Nov 2015 14:14:33 +0000

Hi,

If you look in epan/prefs.h you can see that the second argument is a callback function

prefs_register_protocol(int id, void (*apply_cb)(void));

 

In packet-sip.c

sip_module = prefs_register_protocol(proto_sip, proto_reg_handoff_sip);

 

So proto_reg_handoff_sip is called every time the preference is changed and at startup so you need to arrange

To handle the value there.

 

Regards

Anders

 

From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Paul Offord
Sent: den 12 november 2015 15:08
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] When is the preference variable updated?

 

Hi,

 

Frankly I feel a bit stupid asking this but I've been trying to figure it out for about 6 hours and I think I need help.  I have a dissector which I register like this:

 

static int tmsvc_port = 0;

 

void

proto_register_tmsvc(void)

{

    module_t *tmsvc_module;

 

    proto_tmsvc = proto_register_protocol("TM Syncro Service",

                                          "TmSyncro",

                                          "tmsvc");

 

    tmsvc_module = prefs_register_protocol(proto_tmsvc, NULL);

 

    prefs_register_uint_preference(tmsvc_module, "port",

                                   "TmSyncro service port",

                                   "When set to a value greater than 0 the TmSyncro service is started and accessible via the port number"

                                   10,

                                   &tmsvc_port);

 

}

 

Immediately after the prefs_register_uint_preference call I check the tmsvc_port value and its still 0 (and I've tried other initialisation values and they remain unchanged).  I was expecting tmsvc_port to be set to the value I last set by editing the preferences through the Wireshark menu system.

 

If I check with Menu -> Edit -> Preferences -> Protocols -> TmSyncro sure enough the value I last set is there.

 

When does my variable get updated?  Or alternatively, how can I retrieve the saved preference value?

 

Thanks and regards...Paul

 

Paul Offord FBCS CITP
Chief Technical Officer
Advance7

Phone:  01279 211 668
Mobile:  07764 931 431
Email:  paul.offord@xxxxxxxxxxxx
LinkedIn: 
https://uk.linkedin.com/in/paulofford

 


______________________________________________________________________

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
______________________________________________________________________