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>
This commit is contained in:
Roland Knall 2015-09-21 10:33:24 +02:00 committed by Pascal Quantin
parent 961e0c0a25
commit 5f4bddad82
1 changed files with 13 additions and 1 deletions

View File

@ -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 )