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-nsip.c | |
parent | 4d8581d7e15fe4a80a53496b83a853271fc674b6 (diff) | |
download | wireshark-2eb7b05b8c9c6408268f0d1e81f0a18a02610f1c.tar.gz |
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-nsip.c')
-rw-r--r-- | epan/dissectors/packet-nsip.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index 93b9ce68a5..c43386e478 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -37,8 +37,7 @@ void proto_reg_handoff_nsip(void); #define NSIP_DEBUG 0 #define NSIP_SEP ", " /* Separator string */ -static range_t *global_nsip_udp_port_range; -#define DEFAULT_NSIP_PORT_RANGE "2157,19999" +#define DEFAULT_NSIP_PORT_RANGE "2157,19999" /* Not IANA registered */ /* Initialize the protocol and registered fields */ static int proto_nsip = -1; @@ -1140,8 +1139,7 @@ proto_register_nsip(void) module_t *nsip_module; /* Register the protocol name and description */ - proto_nsip = proto_register_protocol("GPRS Network Service", - "GPRS-NS", "gprs-ns"); + proto_nsip = proto_register_protocol("GPRS Network Service", "GPRS-NS", "gprs-ns"); /* Required function calls to register the header fields and subtrees used */ @@ -1150,36 +1148,19 @@ proto_register_nsip(void) register_dissector("gprs_ns", dissect_nsip, proto_nsip); - /* Set default UDP ports */ - range_convert_str(&global_nsip_udp_port_range, DEFAULT_NSIP_PORT_RANGE, MAX_UDP_PORT); - /* Register configuration options */ - nsip_module = prefs_register_protocol(proto_nsip, proto_reg_handoff_nsip); + nsip_module = prefs_register_protocol(proto_nsip, NULL); prefs_register_obsolete_preference(nsip_module, "udp.port1"); prefs_register_obsolete_preference(nsip_module, "udp.port2"); - prefs_register_range_preference(nsip_module, "udp.ports", "GPRS-NS UDP ports", - "UDP ports to be decoded as GPRS-NS (default: " - DEFAULT_NSIP_PORT_RANGE ")", - &global_nsip_udp_port_range, MAX_UDP_PORT); } void proto_reg_handoff_nsip(void) { - static gboolean nsip_prefs_initialized = FALSE; - static range_t *nsip_udp_port_range; - - if (!nsip_prefs_initialized) { - nsip_handle = find_dissector_add_dependency("gprs_ns", proto_nsip); - bssgp_handle = find_dissector_add_dependency("bssgp", proto_nsip); - nsip_prefs_initialized = TRUE; - } else { - dissector_delete_uint_range("udp.port", nsip_udp_port_range, nsip_handle); - g_free(nsip_udp_port_range); - } - nsip_udp_port_range = range_copy(global_nsip_udp_port_range); + nsip_handle = find_dissector_add_dependency("gprs_ns", proto_nsip); + bssgp_handle = find_dissector_add_dependency("bssgp", proto_nsip); - dissector_add_uint_range("udp.port", nsip_udp_port_range, nsip_handle); + dissector_add_uint_range_with_preference("udp.port", DEFAULT_NSIP_PORT_RANGE, nsip_handle); dissector_add_uint("atm.aal5.type", TRAF_GPRS_NS, nsip_handle); } |