aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-enttec.c
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 /epan/dissectors/packet-enttec.c
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 'epan/dissectors/packet-enttec.c')
-rw-r--r--epan/dissectors/packet-enttec.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/epan/dissectors/packet-enttec.c b/epan/dissectors/packet-enttec.c
index 48a4561bb7..4b55e6b085 100644
--- a/epan/dissectors/packet-enttec.c
+++ b/epan/dissectors/packet-enttec.c
@@ -37,7 +37,7 @@
/* Define UDP/TCP ports for ENTTEC */
#define UDP_PORT_ENTTEC 0x0D05
-#define TCP_PORT_ENTTEC 0x0D05
+#define TCP_PORT_ENTTEC 0x0D05 /* Not IANA registered */
#define ENTTEC_HEAD_ESPR 0x45535052
@@ -108,7 +108,6 @@ static int ett_enttec = -1;
*/
static guint global_udp_port_enttec = UDP_PORT_ENTTEC;
-static guint global_tcp_port_enttec = TCP_PORT_ENTTEC;
static gint global_disp_chan_val_type = 0;
static gint global_disp_col_count = 16;
@@ -552,11 +551,6 @@ proto_register_enttec(void)
"The UDP port on which ENTTEC packets will be sent",
10,&global_udp_port_enttec);
- prefs_register_uint_preference(enttec_module, "tcp_port",
- "ENTTEC TCP Port",
- "The TCP port on which ENTTEC packets will be sent",
- 10,&global_tcp_port_enttec);
-
prefs_register_enum_preference(enttec_module, "dmx_disp_chan_val_type",
"DMX Display channel value type",
"The way DMX values are displayed",
@@ -582,22 +576,19 @@ proto_reg_handoff_enttec(void) {
static gboolean enttec_initialized = FALSE;
static dissector_handle_t enttec_udp_handle, enttec_tcp_handle;
static guint udp_port_enttec;
- static guint tcp_port_enttec;
if(!enttec_initialized) {
enttec_udp_handle = create_dissector_handle(dissect_enttec_udp,proto_enttec);
enttec_tcp_handle = create_dissector_handle(dissect_enttec_tcp,proto_enttec);
+ dissector_add_uint_with_preference("tcp.port",TCP_PORT_ENTTEC,enttec_tcp_handle);
enttec_initialized = TRUE;
} else {
dissector_delete_uint("udp.port",udp_port_enttec,enttec_udp_handle);
- dissector_delete_uint("tcp.port",tcp_port_enttec,enttec_tcp_handle);
}
udp_port_enttec = global_udp_port_enttec;
- tcp_port_enttec = global_tcp_port_enttec;
dissector_add_uint("udp.port",global_udp_port_enttec,enttec_udp_handle);
- dissector_add_uint("tcp.port",global_tcp_port_enttec,enttec_tcp_handle);
}
/*