Cleanup from adding Decode As TCP preferences.

1. Fix bug caught by scan build (module not read)
2. Remove range preference call that should have been part of original patch.

Change-Id: I24b1fb253548bffddc4c8ebfc3ede666d8fd9dcd
Reviewed-on: https://code.wireshark.org/review/18143
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2016-10-10 23:36:25 -04:00
parent a1ecd5661f
commit 31a35aa9e6
3 changed files with 11 additions and 6 deletions

View File

@ -151,6 +151,7 @@
#include <epan/show_exception.h>
#include <epan/reassemble.h>
#include <epan/prefs.h>
#include <epan/prefs-int.h>
#include <epan/expert.h>
#include "packet-tcp.h"
@ -4222,6 +4223,13 @@ version_convert( gchar *result, guint32 hexver )
(hexver >> 24) & 0xFF, (hexver >> 16) & 0xFF, (hexver >> 8) & 0xFF, hexver & 0xFF);
}
static void
apply_tds_prefs(void) {
pref_t *tds_ports = prefs_find_preference(prefs_find_module("tds"), "tcp.port");
tds_tcp_ports = range_copy(*tds_ports->varp.range);
}
/* Register the protocol with Wireshark */
/* this format is required because a script is used to build the C function
@ -5604,7 +5612,7 @@ proto_register_tds(void)
/* Allow dissector to be found by name. */
tds_tcp_handle = register_dissector("tds", dissect_tds_message, proto_tds);
tds_module = prefs_register_protocol(proto_tds, NULL);
tds_module = prefs_register_protocol(proto_tds, apply_tds_prefs);
prefs_register_bool_preference(tds_module, "desegment_buffers",
"Reassemble TDS buffers spanning multiple TCP segments",
"Whether the TDS dissector should reassemble TDS buffers spanning multiple TCP segments. "
@ -5622,10 +5630,6 @@ proto_register_tds(void)
"TDS decode as",
"Hint as to whether to decode TDS protocol as little-endian or big-endian. (TDS7/8 always decoded as little-endian)",
&tds_little_endian, tds_endian_type_options, FALSE);
prefs_register_range_preference(tds_module, "tcp_ports",
"TDS TCP ports",
"Additional TCP ports to decode as TDS",
&tds_tcp_ports, 0xFFFF);
register_init_routine(tds_init);
register_cleanup_routine(tds_cleanup);

View File

@ -1063,7 +1063,7 @@ void dissector_add_uint_range_with_preference(const char *abbrev, const char* ra
/* Some preference callback functions use the proto_reg_handoff_
routine to apply preferences, which could duplicate the
registration of a preference. Check for that here */
else if (prefs_find_preference(module, abbrev) == NULL) {
if (prefs_find_preference(module, abbrev) == NULL) {
description = wmem_strdup_printf(wmem_epan_scope(), "%s %s(s)",
proto_get_protocol_short_name(handle->protocol), pref_dissector_table->ui_name);
title = wmem_strdup_printf(wmem_epan_scope(), "%s(s)", pref_dissector_table->ui_name);

View File

@ -4113,6 +4113,7 @@ deprecated_port_pref(gchar *pref_name, const gchar *value)
{"mrcpv2.tcp.port_range", "MRCPv2", "tcp.port", 10},
{"rtsp.tcp.port_range", "RTSP", "tcp.port", 10},
{"sip.tcp.ports", "SIP", "tcp.port", 10},
{"tds.tcp_ports", "TDS", "tcp.port", 10},
{"uma.tcp.ports", "UMA", "tcp.port", 10},
};