aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/ethercat
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-10-07 16:25:01 -0400
committerMichael Mann <mmann78@netscape.net>2016-10-08 02:44:53 +0000
commit268841f3e00b7cf0f16c81dd2b3b952172130b8b (patch)
tree359e01cf5eba83308760531888713fe0ff0bc10b /plugins/ethercat
parent11d3224142c0531879fb8e415daf9639a4eace66 (diff)
Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for a (TCP) port, but the underlying data is actually part of Decode As functionality. For now the APIs are intentionally separate from the regular APIs that register a dissector within a dissector table. It may be possible to eventually combine the two so that all dissectors that register with a dissector table have an opportunity to "automatically" have a preference to adjust the "table value" through the preferences dialog. The tcp.port dissector table was used as the guinea pig. This will eventually be expanded to other dissector tables as well (most notably UDP ports). Some dissectors that "shared" a TCP/UDP port preference were also converted. It also removed the need for some preference callback functions (mostly when the callback function was the proto_reg_handoff function) so there is cleanup around that. Dissectors that has a port preference whose default was 0 were switched to using the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference Also added comments for TCP ports used that aren't IANA registered. Change-Id: I99604f95d426ad345f4b494598d94178b886eb67 Reviewed-on: https://code.wireshark.org/review/17724 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins/ethercat')
-rw-r--r--plugins/ethercat/packet-ams.c4
-rw-r--r--plugins/ethercat/packet-ethercat-frame.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/ethercat/packet-ams.c b/plugins/ethercat/packet-ams.c
index f142d6df8d..1b40275b08 100644
--- a/plugins/ethercat/packet-ams.c
+++ b/plugins/ethercat/packet-ams.c
@@ -33,6 +33,8 @@
void proto_register_ams(void);
void proto_reg_handoff_ams(void);
+#define AMS_TCP_PORT 48898 /* Not IANA registered */
+
/* Define the ams proto */
int proto_ams = -1;
@@ -1236,7 +1238,7 @@ void proto_reg_handoff_ams(void)
ams_handle = find_dissector("ams");
amstcp_handle = create_dissector_handle( dissect_amstcp, proto_ams );
- dissector_add_uint("tcp.port", 0xbf02, amstcp_handle);
+ dissector_add_uint_with_preference("tcp.port", AMS_TCP_PORT, amstcp_handle);
dissector_add_uint("ecatf.type", 2, ams_handle);
}
diff --git a/plugins/ethercat/packet-ethercat-frame.c b/plugins/ethercat/packet-ethercat-frame.c
index b9f01d03f1..e9c7c92c59 100644
--- a/plugins/ethercat/packet-ethercat-frame.c
+++ b/plugins/ethercat/packet-ethercat-frame.c
@@ -149,7 +149,7 @@ void proto_reg_handoff_ethercat_frame(void)
ethercat_frame_handle = find_dissector("ecatf");
dissector_add_uint("ethertype", ETHERTYPE_ECATF, ethercat_frame_handle);
dissector_add_uint("udp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
- dissector_add_uint("tcp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
+ dissector_add_uint_with_preference("tcp.port", ETHERTYPE_ECATF, ethercat_frame_handle);
}
/*