aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Uhlmann <Hendrik.Uhlmann@rheinmetall.com>2016-07-05 14:16:48 +0200
committerJaap Keuter <jaap.keuter@xs4all.nl>2016-07-06 06:58:39 +0000
commitf5eaf538b046c3da3313e6b5e64c3a73b4ef5b39 (patch)
treeb0cad93b4e877643add96f6b3bcac5248c4eed44
parent4b062227c7e0c41dc76780da9c7e5612733ef911 (diff)
DIS: Introduced support of Collision PDU
Parse all Attributes of Collision PDU and display them in wireshark HMI. Change-Id: I3003c6dd709498cc6c1adf784800047d0984bafa Reviewed-on: https://code.wireshark.org/review/16299 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: Jaap Keuter <jaap.keuter@xs4all.nl>
-rw-r--r--epan/dissectors/packet-dis.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c
index e2665f85e5..00ab7f2021 100644
--- a/epan/dissectors/packet-dis.c
+++ b/epan/dissectors/packet-dis.c
@@ -1813,6 +1813,21 @@ static const value_string DIS_PDU_PO_ObjectClass_Strings[] =
static value_string_ext DIS_PDU_PO_ObjectClass_Strings_Ext = VALUE_STRING_EXT_INIT(DIS_PDU_PO_ObjectClass_Strings);
+typedef enum
+{
+ DIS_CollisionType_Inelastic = 0,
+ DIS_CollisionType_Elastic = 1
+} DIS_PDU_CollisionType;
+
+static const value_string DIS_PDU_CollisionType_Strings[] =
+{
+ { DIS_CollisionType_Inelastic, "Inelastic" },
+ { DIS_CollisionType_Elastic, "Elastic" },
+ { 0, NULL }
+};
+
+static value_string_ext DIS_PDU_CollisionType_Strings_Ext = VALUE_STRING_EXT_INIT(DIS_PDU_CollisionType_Strings);
+
static const value_string DIS_PDU_EmitterName_Strings[] =
{
{ 10, "1RL138" },
@@ -3696,6 +3711,13 @@ static int hf_dis_designator_spot_location_x = -1;
static int hf_dis_designator_spot_location_y = -1;
static int hf_dis_designator_spot_location_z = -1;
+/* Collision */
+static int hf_dis_collision_type = -1;
+static int hf_dis_collision_mass = -1;
+static int hf_dis_collision_location_x = -1;
+static int hf_dis_collision_location_y = -1;
+static int hf_dis_collision_location_z = -1;
+
/* More DIS global */
static int hf_dis_capabilities = -1;
static int hf_dis_variable_parameter_type = -1;
@@ -5283,6 +5305,51 @@ static int dissect_DIS_PARSER_ENTITY_STATE_PDU(tvbuff_t *tvb, packet_info *pinfo
return offset;
}
+/* DIS Collision PDUs
+ */
+static int dissect_DIS_PARSER_COLLISION_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
+{
+ proto_tree *sub_tree;
+
+ offset = parseField_Entity(tvb, tree, offset, "Issuing Entity ID");
+ offset = parseField_Entity(tvb, tree, offset, "Colliding Entity ID");
+ offset = dissect_DIS_FIELDS_EVENT_ID(tvb, tree, offset, "Event ID");
+
+ /* 8 Bit Collision Type */
+ proto_tree_add_item(tree, hf_dis_collision_type, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+
+ /* 8 Bit Padding */
+ proto_tree_add_item(tree, hf_dis_padding, tvb, offset, 1, ENC_NA);
+ offset++;
+
+ /* Velocity */
+ sub_tree = proto_tree_add_subtree(tree, tvb, offset, 12, ett_linear_velocity, NULL, "Velocity");
+
+ proto_tree_add_item(sub_tree, hf_dis_linear_velocity_x, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(sub_tree, hf_dis_linear_velocity_y, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(sub_tree, hf_dis_linear_velocity_z, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+
+ /* Mass */
+ proto_tree_add_item(tree, hf_dis_collision_mass, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+
+ /* Location (with respect to entity) */
+ sub_tree = proto_tree_add_subtree(tree, tvb, offset, 12, ett_ua_location, NULL, "Location (with respect to entity)"); /* TODO: ett_ua_location ==> ett_location? */
+
+ proto_tree_add_item(sub_tree, hf_dis_collision_location_x, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(sub_tree, hf_dis_collision_location_y, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(sub_tree, hf_dis_collision_location_z, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+
+ return offset;
+}
+
/* DIS Distributed Emission Regeneration PDUs
*/
static int dissect_DIS_PARSER_ELECTROMAGNETIC_EMISSION_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
@@ -7205,6 +7272,9 @@ static gint dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
case DIS_PDUTYPE_ENTITY_STATE:
pduFunc = &dissect_DIS_PARSER_ENTITY_STATE_PDU;
break;
+ case DIS_PDUTYPE_COLLISION:
+ pduFunc = &dissect_DIS_PARSER_COLLISION_PDU;
+ break;
/* DIS Distributed Emission Regeneration PDUs */
case DIS_PDUTYPE_ELECTROMAGNETIC_EMISSION:
@@ -9476,6 +9546,31 @@ void proto_register_dis(void)
FT_INT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
+ { &hf_dis_collision_type,
+ { "Collision Type", "dis.collision.type",
+ FT_UINT8, BASE_DEC|BASE_EXT_STRING, &DIS_PDU_CollisionType_Strings_Ext, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_dis_collision_mass,
+ { "Mass", "dis.collision.mass",
+ FT_FLOAT, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }
+ },
+ { &hf_dis_collision_location_x,
+ {"X", "dis.collision.location.x",
+ FT_FLOAT, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_dis_collision_location_y,
+ {"Y", "dis.collision.location.y",
+ FT_FLOAT, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ },
+ { &hf_dis_collision_location_z,
+ {"Z", "dis.collision.location.z",
+ FT_FLOAT, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}
+ }
};
/* Setup protocol subtree array */