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-ldp.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-ldp.c')
-rw-r--r-- | epan/dissectors/packet-ldp.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c index 721a19a7d2..544025e93f 100644 --- a/epan/dissectors/packet-ldp.c +++ b/epan/dissectors/packet-ldp.c @@ -345,8 +345,6 @@ static expert_field ei_ldp_tlv_fec = EI_INIT; /* desegmentation of LDP over TCP */ static gboolean ldp_desegment = TRUE; -static guint32 global_ldp_udp_port = UDP_PORT_LDP; - /* * The following define all the TLV types I know about * http://www.iana.org/assignments/ldp-namespaces @@ -4275,8 +4273,7 @@ proto_register_ldp(void) module_t *ldp_module; expert_module_t* expert_ldp; - proto_ldp = proto_register_protocol("Label Distribution Protocol", - "LDP", "ldp"); + proto_ldp = proto_register_protocol("Label Distribution Protocol", "LDP", "ldp"); proto_register_field_array(proto_ldp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -4285,12 +4282,7 @@ proto_register_ldp(void) /* Register our configuration options for , particularly our port */ - ldp_module = prefs_register_protocol(proto_ldp, proto_reg_handoff_ldp); - - prefs_register_uint_preference(ldp_module, "udp.port", "LDP UDP Port", - "Set the UDP port for messages (if other" - " than the default of 646)", - 10, &global_ldp_udp_port); + ldp_module = prefs_register_protocol(proto_ldp, NULL); prefs_register_bool_preference(ldp_module, "desegment_ldp_messages", "Reassemble LDP messages spanning multiple TCP segments", @@ -4304,30 +4296,12 @@ proto_register_ldp(void) void proto_reg_handoff_ldp(void) { - static gboolean ldp_prefs_initialized = FALSE; - static dissector_handle_t ldp_tcp_handle, ldp_handle; - static int udp_port; - - if (!ldp_prefs_initialized) { - - ldp_tcp_handle = create_dissector_handle(dissect_ldp_tcp, proto_ldp); - ldp_handle = create_dissector_handle(dissect_ldp, proto_ldp); - dissector_add_uint_with_preference("tcp.port", TCP_PORT_LDP, ldp_tcp_handle); - - ldp_prefs_initialized = TRUE; - - } - else { - - dissector_delete_uint("udp.port", udp_port, ldp_handle); - - } - - /* Set our port number for future use */ - udp_port = global_ldp_udp_port; - - dissector_add_uint("udp.port", global_ldp_udp_port, ldp_handle); + dissector_handle_t ldp_tcp_handle, ldp_handle; + ldp_tcp_handle = create_dissector_handle(dissect_ldp_tcp, proto_ldp); + ldp_handle = create_dissector_handle(dissect_ldp, proto_ldp); + dissector_add_uint_with_preference("tcp.port", TCP_PORT_LDP, ldp_tcp_handle); + dissector_add_uint_with_preference("udp.port", UDP_PORT_LDP, ldp_handle); } /* |