openSAFETY: Add byte offset of frame

Add the absolute byte offset of each openSAFETY frame to
dissection, so a change in the offset can be easily detected

Change-Id: Ib935eff7ba1e2e1169cb9071a5c9703cc58fc123
Reviewed-on: https://code.wireshark.org/review/16301
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Roland Knall 2016-07-05 16:01:10 +02:00 committed by Roland Knall
parent 5cc5ba625f
commit d2456988df
2 changed files with 10 additions and 0 deletions

View File

@ -140,6 +140,7 @@ static int hf_oss_msg_sender = -1;
static int hf_oss_msg_receiver = -1;
static int hf_oss_length= -1;
static int hf_oss_crc = -1;
static int hf_oss_byte_offset = -1;
static int hf_oss_crc_valid = -1;
static int hf_oss_crc2_valid = -1;
@ -1788,6 +1789,9 @@ dissect_opensafety_message(opensafety_packet_info *packet,
val_to_str(packet->msg_id, opensafety_message_type_values, "Unknown Message (0x%02X) "));
}
item = proto_tree_add_uint(opensafety_tree, hf_oss_byte_offset, packet->frame.frame_tvb, 0, 1, packet->frame.byte_offset);
PROTO_ITEM_SET_GENERATED(item);
if ( packet->msg_type == OPENSAFETY_SNMT_MESSAGE_TYPE )
{
proto_item_append_text(opensafety_item, ", SNMT");
@ -2181,6 +2185,7 @@ opensafety_package_dissector(const gchar *protocolName, const gchar *sub_diss_ha
packet->msg_type = type;
packet->frame.frame_tvb = next_tvb;
packet->frame.byte_offset = frameOffset + tvb_raw_offset(message_tvb);
packet->frame.subframe1 = frameStart1;
packet->frame.subframe2 = frameStart2;
packet->frame.length = frameLength;
@ -2420,6 +2425,9 @@ proto_register_opensafety(void)
{ "SCM UDID Valid", "opensafety.scm_udid.valid",
FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_oss_byte_offset,
{ "Byte Offset", "opensafety.msg.byte_offset",
FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_oss_msg,
{ "Message", "opensafety.msg.id",
FT_UINT8, BASE_HEX, VALS(opensafety_message_type_values), 0x0, NULL, HFILL } },

View File

@ -449,6 +449,8 @@ typedef struct _opensafety_packet_frame
guint length;
guint16 byte_offset;
tvbuff_t *frame_tvb;
} opensafety_packet_frame;