diff options
author | Michael Mann <mmann78@netscape.net> | 2016-10-05 16:33:54 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-13 02:51:18 +0000 |
commit | 2eb7b05b8c9c6408268f0d1e81f0a18a02610f1c (patch) | |
tree | bd0a909e3d506ea2e61c446aa8a809b6f728af3b /epan/dissectors/packet-synphasor.c | |
parent | 4d8581d7e15fe4a80a53496b83a853271fc674b6 (diff) |
Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".
More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.
Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-synphasor.c')
-rw-r--r-- | epan/dissectors/packet-synphasor.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index a581bfaf82..885a5d5701 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -28,7 +28,6 @@ #include <epan/packet.h> #include <epan/crc16-tvb.h> -#include <epan/prefs.h> #include <epan/expert.h> #include <epan/proto_data.h> #include "packet-tcp.h" @@ -49,7 +48,7 @@ static int proto_synphasor = -1; /* user preferences */ #define SYNPHASOR_TCP_PORT 4712 /* Not IANA registered */ -static guint global_pref_udp_port = 4713; +#define SYNPHASOR_UDP_PORT 4713 /* Not IANA registered */ /* the ett... variables hold the state (open/close) of the treeview in the GUI */ static gint ett_synphasor = -1; /* root element for this protocol */ @@ -1348,7 +1347,6 @@ void proto_register_synphasor(void) { &ei_synphasor_checksum, { "synphasor.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; - module_t *synphasor_module; expert_module_t* expert_synphasor; /* register protocol */ @@ -1364,38 +1362,18 @@ void proto_register_synphasor(void) expert_synphasor = expert_register_protocol(proto_synphasor); expert_register_field_array(expert_synphasor, ei, array_length(ei)); - /* register preferences */ - synphasor_module = prefs_register_protocol(proto_synphasor, proto_reg_handoff_synphasor); - - /* the port numbers of the lower level protocols */ - prefs_register_uint_preference(synphasor_module, "udp_port", "Synchrophasor UDP port", - "Set the port number for synchrophasor frames over UDP" \ - "(if other than the default of 4713)", - 10, &global_pref_udp_port); - } /* proto_register_synphasor() */ /* called at startup and when the preferences change */ void proto_reg_handoff_synphasor(void) { - static gboolean initialized = FALSE; - static dissector_handle_t synphasor_tcp_handle; - static guint current_udp_port; - - if (!initialized) { - synphasor_tcp_handle = create_dissector_handle(dissect_tcp, proto_synphasor); - dissector_add_for_decode_as("rtacser.data", synphasor_udp_handle); - dissector_add_uint_with_preference("tcp.port", SYNPHASOR_TCP_PORT, synphasor_tcp_handle); - initialized = TRUE; - } - else { - /* update preferences */ - dissector_delete_uint("udp.port", current_udp_port, synphasor_udp_handle); - } + dissector_handle_t synphasor_tcp_handle; - current_udp_port = global_pref_udp_port; + synphasor_tcp_handle = create_dissector_handle(dissect_tcp, proto_synphasor); + dissector_add_for_decode_as("rtacser.data", synphasor_udp_handle); + dissector_add_uint_with_preference("udp.port", SYNPHASOR_UDP_PORT, synphasor_udp_handle); + dissector_add_uint_with_preference("tcp.port", SYNPHASOR_TCP_PORT, synphasor_tcp_handle); - dissector_add_uint("udp.port", current_udp_port, synphasor_udp_handle); } /* proto_reg_handoff_synphasor() */ /* |