Wireshark mailing list archives
Re: When is the preference variable updated?
From: Pascal Quantin <pascal.quantin () gmail com>
Date: Thu, 12 Nov 2015 15:15:06 +0100
2015-11-12 15:07 GMT+01:00 Paul Offord <Paul.Offord () advance7 com>:
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
Hi Paul, the variable should be set according to the preference content when the proto_reg_handoff_tmsvc function (that you register thanks to the prefs_register_protocol function) is called. Alternatively (if you do not need the reg_handoff function at all) the variable should be set when your dissector code is called. Best regards, Pascal.
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- When is the preference variable updated? Paul Offord (Nov 12)
- Re: When is the preference variable updated? Anders Broman (Nov 12)
- Re: When is the preference variable updated? Paul Offord (Nov 12)
- Re: When is the preference variable updated? Pascal Quantin (Nov 12)
- Re: When is the preference variable updated? Paul Offord (Nov 12)
- Re: When is the preference variable updated? Pascal Quantin (Nov 12)
- Re: When is the preference variable updated? Paul Offord (Nov 12)
- Re: When is the preference variable updated? Paul Offord (Nov 12)
- Re: When is the preference variable updated? Anders Broman (Nov 12)