aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-opensafety.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-10-30 09:56:10 +0100
committerMichael Mann <mmann78@netscape.net>2015-10-30 12:39:09 +0000
commit7a381cbcc826e53ad905bb9713dd0e64adf88a3f (patch)
tree54515c492c57f0461a9d3aa4aca0a522e6359c2b /epan/dissectors/packet-opensafety.c
parenta4b1cde7937d971f77131204cf3d6e9332835c08 (diff)
openSAFETY: Remove need for SIII dissector register
Remove the need for the registration of a dedicated SIII dissector, as this might interfere with "Decode As" handling, as well as being redundant and no longer needed. The udpdata dissector can handle both and gate to the correct sub-dissector if necessary. Change-Id: I756cd845e7e8d64848d9928ad9ff04d571434835 Reviewed-on: https://code.wireshark.org/review/11421 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-opensafety.c')
-rw-r--r--epan/dissectors/packet-opensafety.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c
index f0507898f8..cb16f9cb43 100644
--- a/epan/dissectors/packet-opensafety.c
+++ b/epan/dissectors/packet-opensafety.c
@@ -2288,7 +2288,7 @@ dissect_opensafety_siii(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *t
* a dissector loop. */
if ( bDissector_Called_Once_Before == FALSE )
{
- udp = pinfo->srcport == OPENSAFETY_UDP_PORT_SIII;
+ udp = pinfo->destport == OPENSAFETY_UDP_PORT_SIII;
bDissector_Called_Once_Before = TRUE;
/* No frames can be sent in AT messages, therefore those get filtered right away */
@@ -2345,6 +2345,9 @@ dissect_opensafety_udpdata(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree
static guint32 frameNum = 0;
static guint32 frameIdx = 0;
+ if ( pinfo->destport == OPENSAFETY_UDP_PORT_SIII )
+ return dissect_opensafety_siii(message_tvb, pinfo, tree, data);
+
if ( ! global_enable_udp )
return result;
@@ -2360,10 +2363,8 @@ dissect_opensafety_udpdata(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree
frameNum = pinfo->fd->num;
}
- result = opensafety_package_dissector((pinfo->destport == OPENSAFETY_UDP_PORT_SIII ? "openSAFETY/SercosIII" : "openSAFETY/UDP" ),
- "", pinfo->destport == OPENSAFETY_UDP_PORT_SIII ? global_siii_udp_frame2_first : global_udp_frame2_first,
- FALSE, frameIdx, message_tvb, pinfo, tree,
- pinfo->destport == OPENSAFETY_UDP_PORT_SIII ? OPENSAFETY_ACYCLIC_DATA : 0 );
+ result = opensafety_package_dissector("openSAFETY/UDP", "", global_udp_frame2_first,
+ FALSE, frameIdx, message_tvb, pinfo, tree, OPENSAFETY_ACYCLIC_DATA );
if ( result )
frameIdx++;
@@ -2375,7 +2376,6 @@ static void
apply_prefs ( void )
{
static dissector_handle_t opensafety_udpdata_handle = NULL;
- static dissector_handle_t opensafety_siii_handle = NULL;
static guint opensafety_udp_port_number;
static guint opensafety_udp_siii_port_number;
static gboolean opensafety_init = FALSE;
@@ -2384,28 +2384,22 @@ apply_prefs ( void )
if ( !opensafety_init )
{
opensafety_udpdata_handle = find_dissector("opensafety_udpdata");
- opensafety_siii_handle = find_dissector("opensafety_siii");
opensafety_init = TRUE;
}
else
{
/* Delete dissectors in preparation of a changed config setting */
dissector_delete_uint ("udp.port", opensafety_udp_port_number, opensafety_udpdata_handle);
- dissector_delete_uint ("udp.port", opensafety_udp_siii_port_number, opensafety_siii_handle);
+ dissector_delete_uint ("udp.port", opensafety_udp_siii_port_number, opensafety_udpdata_handle);
}
-
/* Storing the port numbers locally, to being able to delete the old associations */
opensafety_udp_port_number = global_network_udp_port;
opensafety_udp_siii_port_number = global_network_udp_port_sercosiii;
- /* Default UDP only based dissector */
+ /* Default UDP only based dissector, will hand traffic to SIII dissector if needed */
dissector_add_uint("udp.port", opensafety_udp_port_number, opensafety_udpdata_handle);
-
- /* Sercos III dissector does not handle UDP transport, has to be handled
- * separately, everything else should be caught by the heuristic dissector
- */
- dissector_add_uint("udp.port", opensafety_udp_siii_port_number, opensafety_siii_handle);
+ dissector_add_uint("udp.port", opensafety_udp_siii_port_number, opensafety_udpdata_handle);
}
@@ -2826,7 +2820,6 @@ proto_register_opensafety(void)
/* Registering default and ModBus/TCP dissector */
new_register_dissector("opensafety_udpdata", dissect_opensafety_udpdata, proto_opensafety );
new_register_dissector("opensafety_mbtcp", dissect_opensafety_mbtcp, proto_opensafety );
- new_register_dissector("opensafety_siii", dissect_opensafety_siii, proto_opensafety );
new_register_dissector("opensafety_pnio", dissect_opensafety_pn_io, proto_opensafety);
}