Wireshark-dev: Re: [Wireshark-dev] When is the preference variable updated?
Thanks Anders, That seems to be the answer. I modified the code to this: static int proto_tmsvc = -1; HANDLE h_thread = NULL; /* This is the handle to the service thread */ 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, proto_reg_handoff_tmsvc); 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); } void proto_reg_handoff_tmsvc(void) { dissector_handle_t dissect_tmsvc_handle; /* temp copde */ if (tmsvc_port > 0) { dissect_tmsvc_handle = create_dissector_handle(dissect_tmsvc, proto_tmsvc); register_postdissector(dissect_tmsvc_handle); /* ToDo: Add else condition to kill the thread and create a new one */ if (h_thread == NULL) h_thread = create_service_thread(); } return; } Best regards…Paul From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx]
On Behalf Of Anders Broman 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 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
______________________________________________________________________ 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 ______________________________________________________________________ |
- References:
- [Wireshark-dev] When is the preference variable updated?
- From: Paul Offord
- Re: [Wireshark-dev] When is the preference variable updated?
- From: Anders Broman
- [Wireshark-dev] When is the preference variable updated?
- Prev by Date: Re: [Wireshark-dev] When is the preference variable updated?
- Next by Date: Re: [Wireshark-dev] When is the preference variable updated?
- Previous by thread: Re: [Wireshark-dev] When is the preference variable updated?
- Next by thread: Re: [Wireshark-dev] When is the preference variable updated?
- Index(es):