aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-opensafety.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2015-09-21 10:33:24 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-09-22 20:27:40 +0000
commit5f4bddad82da30c4f5e28ca0a3b7747bd664495c (patch)
tree7cd6581092b35ca13d0fa5007776375cf701259e /epan/dissectors/packet-opensafety.c
parent961e0c0a25a0f1ef00448b261a1713446e110740 (diff)
openSAFETY: Handle SPDO message types differently
SPDOs code the 0x04 bit differently, as it is not part of the message type, but rather a flag for connection validation I do not want to introduce a second message type, as this would break compatibility with existing stored filters, also adding the bitmask to the hf field, would alter the byte value, as it would shift the value to the right. Change-Id: I6b70bec29a55dfb556652d9dc940a896b864943b Reviewed-on: https://code.wireshark.org/review/10595 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net> 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/dissectors/packet-opensafety.c')
-rw-r--r--epan/dissectors/packet-opensafety.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c
index aa6874cb04..c8c30d90f9 100644
--- a/epan/dissectors/packet-opensafety.c
+++ b/epan/dissectors/packet-opensafety.c
@@ -386,9 +386,21 @@ static proto_item *
opensafety_packet_response(tvbuff_t *message_tvb, proto_tree *sub_tree, opensafety_packet_info *packet, gboolean isResponse)
{
proto_item *item = NULL;
+ guint8 b_id = 0;
- proto_tree_add_item(sub_tree, hf_oss_msg, message_tvb,
+ if ( packet->msg_type != OPENSAFETY_SPDO_MESSAGE_TYPE )
+ {
+ proto_tree_add_item(sub_tree, hf_oss_msg, message_tvb,
OSS_FRAME_POS_ID + packet->frame.subframe1, 1, ENC_NA );
+ }
+ else
+ {
+ /* SPDOs code the connection valid bit on offset 0x04. SSDO and SNMT frames use this
+ * bit for messages. Therefore setting a bitmask on the hf-field would not work. */
+ b_id = OSS_FRAME_ID_T(message_tvb, packet->frame.subframe1) & 0xF8;
+ proto_tree_add_uint(sub_tree, hf_oss_msg, message_tvb, OSS_FRAME_POS_ID + packet->frame.subframe1, 1, b_id);
+ }
+
item = proto_tree_add_item(sub_tree, packet->msg_type != OPENSAFETY_SPDO_MESSAGE_TYPE ? hf_oss_msg_direction : hf_oss_spdo_direction,
message_tvb, OSS_FRAME_POS_ID + packet->frame.subframe1, 1, ENC_NA);
if ( ! isResponse )