aboutsummaryrefslogtreecommitdiffstats
path: root/epan/prefs.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-12-24 17:54:36 -0500
committerAnders Broman <a.broman58@gmail.com>2016-12-25 08:06:53 +0000
commit78d56e5dd74ca22bbfbbf94ba8a74becc15b23d3 (patch)
tree003a8724b0c97cd800ee670daf7040472a24c3ce /epan/prefs.c
parent2563503301aa4321a9a7a1ed392c9cbbe147fd2f (diff)
Cleanup transum post-dissector.
1. Enable/disable preference not needed - just use Enabled Protocol dialog interface. Added support for backwards compatibility of preference. 2. Add value_string for calculation values 3. Create an structured array of "hfs of interest" so they can more easily be extended. 4. Convert a bunch of arrays into hash tables and lists. For the amount of wasted space they were taking up, we can live with the very slight performance degrade. Also puts less limits on number of things to process. Change-Id: I7399789d62432b507062ed9cdc20ad974b9dde1b Reviewed-on: https://code.wireshark.org/review/19406 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/prefs.c')
-rw-r--r--epan/prefs.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index f165e64a04..34fe245864 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -4122,6 +4122,36 @@ deprecated_heur_dissector_pref(gchar *pref_name, const gchar *value)
}
static gboolean
+deprecated_enable_dissector_pref(gchar *pref_name, const gchar *value)
+{
+ struct dissector_pref_name
+ {
+ const char* pref_name;
+ const char* short_name;
+ };
+
+ struct dissector_pref_name dissector_prefs[] = {
+ {"transum.tsumenabled", "TRANSUM"},
+ };
+
+ unsigned int i;
+ int proto_id;
+
+ for (i = 0; i < sizeof(dissector_prefs)/sizeof(struct dissector_pref_name); i++)
+ {
+ if (strcmp(pref_name, dissector_prefs[i].pref_name) == 0)
+ {
+ proto_id = proto_get_id_by_short_name(dissector_prefs[i].short_name);
+ if (proto_id >= 0)
+ proto_set_decoding(proto_id, ((g_ascii_strcasecmp(value, "true") == 0) ? TRUE : FALSE));
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static gboolean
deprecated_port_pref(gchar *pref_name, const gchar *value)
{
struct port_pref_name
@@ -4437,6 +4467,8 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_,
}
} else if (deprecated_heur_dissector_pref(pref_name, value)) {
/* Handled within deprecated_heur_dissector_pref() if found */
+ } else if (deprecated_enable_dissector_pref(pref_name, value)) {
+ /* Handled within deprecated_enable_dissector_pref() if found */
} else if (deprecated_port_pref(pref_name, value)) {
/* Handled within deprecated_port_pref() if found */
} else {