aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsmael Mendez Matamoros <ismael@rti.com>2020-07-16 19:05:00 +0200
committerAnders Broman <a.broman58@gmail.com>2020-07-20 06:40:42 +0000
commit076a62a0919b62972c3b83d8947316f80e5a8571 (patch)
tree27f3252ed98f610e61b35eda16852b6ce1f31eaf
parent2a1431abdcbc6456e2f68d2dcbd211589a5dadf2 (diff)
RTPS: Added dissection of PID PID_UNICAST_LOCATOR6_EX
PID_UNICAST_LOCATOR6_EX extends the unicast locator PID by adding a sequence of encapsulations. Change-Id: I9583e3a61b1df6e6f83d7c65f37ae36b9b4c345e Reviewed-on: https://code.wireshark.org/review/37885 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-rtps.c75
-rw-r--r--epan/dissectors/packet-rtps.h10
2 files changed, 81 insertions, 4 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index 49cfac3df9..f879d41a69 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -993,6 +993,7 @@ static const value_string parameter_id_rti_vals[] = {
{ PID_VENDOR_BUILTIN_ENDPOINT_SET, "PID_VENDOR_BUILTIN_ENDPOINT_SET" },
{ PID_ENDPOINT_SECURITY_ATTRIBUTES, "PID_ENDPOINT_SECURITY_ATTRIBUTES" },
{ PID_TYPE_OBJECT_LB, "PID_TYPE_OBJECT_LB" },
+ { PID_UNICAST_LOCATOR_EX, "PID_UNICAST_LOCATOR_EX"},
{ 0, NULL }
};
static const value_string parameter_id_toc_vals[] = {
@@ -1087,6 +1088,8 @@ static const value_string encapsulation_id_vals[] = {
{ ENCAPSULATION_D_CDR2_LE, "D_CDR2_LE" },
{ ENCAPSULATION_PL_CDR2_BE, "PL_CDR2_BE" },
{ ENCAPSULATION_PL_CDR2_LE, "PL_CDR2_LE" },
+ { ENCAPSULATION_SHMEM_REF_PLAIN, "SHMEM_REF_PLAIN" },
+ { ENCAPSULATION_SHMEM_REF_FLAT_DATA, "SHMEM_REF_PLAIN" },
{ 0, NULL }
};
@@ -2020,15 +2023,16 @@ guint16 rtps_util_add_vendor_id(proto_tree *tree,
* octet[16] address;
* } Locator_t;
*/
-void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
+gint rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
const guint encoding, const char *label) {
proto_tree *ti;
proto_tree *locator_tree;
guint32 kind;
gint32 port;
+ const gint parameter_size = 24;
- locator_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_rtps_locator,
+ locator_tree = proto_tree_add_subtree(tree, tvb, offset, parameter_size, ett_rtps_locator,
NULL, label);
proto_tree_add_item_ret_uint(locator_tree, hf_rtps_locator_kind, tvb, offset, 4, encoding, &kind);
@@ -2102,7 +2106,18 @@ void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb
default:
break;
}
+ return offset + parameter_size;
+}
+
+gint rtps_util_add_locator_ex_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
+ const guint encoding, int param_length) {
+ gint locator_offset = 0;
+ locator_offset = rtps_util_add_locator_t(tree, pinfo, tvb,
+ offset, encoding, "locator");
+ offset += rtps_util_add_seq_short(tree, tvb, locator_offset, hf_rtps_encapsulation_id,
+ encoding, param_length - (locator_offset - offset), "encapsulations");
+ return offset;
}
/* ------------------------------------------------------------------------- */
@@ -2866,6 +2881,35 @@ gint rtps_util_add_seq_ulong(proto_tree *tree, tvbuff_t *tvb, gint offset, int h
return offset;
}
+/* ------------------------------------------------------------------------- */
+/* Insert in the protocol tree the next bytes interpreted as Sequence of
+ * unsigned shorts.
+ * The formatted buffer is: val1, val2, val3, ...
+ * Returns the new updated offset
+ */
+gint rtps_util_add_seq_short(proto_tree *tree, tvbuff_t *tvb, gint offset, int hf_item,
+ const guint encoding, int param_length _U_, const char *label) {
+ guint32 num_elem;
+ guint32 i;
+ proto_tree *string_tree;
+
+ num_elem = tvb_get_guint32(tvb, offset, encoding);
+ offset += 4;
+
+ /* Create the string node with an empty string, the replace it later */
+ string_tree = proto_tree_add_subtree_format(tree, tvb, offset, num_elem * 4,
+ ett_rtps_seq_ulong, NULL, "%s (%d elements)", label, num_elem);
+
+ for (i = 0; i < num_elem; ++i) {
+ proto_tree_add_item(string_tree, hf_item, tvb, offset, 2, encoding);
+ offset += 2;
+ }
+
+ return offset;
+}
+
+
+
/* ------------------------------------------------------------------------- */
static const char *rtps_util_typecode_id_to_string(guint32 typecode_id) {
@@ -5392,6 +5436,33 @@ static gboolean dissect_parameter_sequence_rti_dds(proto_tree *rtps_parameter_tr
break;
}/* End of case PID_LOCATOR_FILTER_LIST */
+ /* 0...2...........7...............15.............23...............31
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | PID_UNICAST_LOCATOR_EX | 0x8007 |
+ * +---------------+---------------+---------------+---------------+
+ * | long kind |
+ * +---------------+---------------+---------------+---------------+
+ * | long port |
+ * +---------------+---------------+---------------+---------------+
+ * | ipv6addr[0] | ipv6addr[1] | ipv6addr[2] | ipv6addr[3] |
+ * +---------------+---------------+---------------+---------------+
+ * | ipv6addr[4] | ipv6addr[5] | ipv6addr[6] | ipv6addr[7] |
+ * +---------------+---------------+---------------+---------------+
+ * | ipv6addr[8] | ipv6addr[9] | ipv6addr[10] | ipv6addr[11] |
+ * +---------------+---------------+---------------+---------------+
+ * | ipv6addr[12] | ipv6addr[13] | ipv6addr[14] | ipv6addr[15] |
+ * +---------------+---------------+---------------+---------------+
+ * | Locator Sequence Length |
+ * +---------------+---------------+---------------+---------------+
+ * | Locator 1 | Locator 2 |
+ * +---------------+---------------+---------------+---------------+
+ */
+ case PID_UNICAST_LOCATOR_EX: {
+ ENSURE_LENGTH(28);
+ rtps_util_add_locator_ex_t(rtps_parameter_tree, pinfo, tvb, offset, encoding, param_length);
+ break;
+ }
+
default: {
return FALSE;
}
diff --git a/epan/dissectors/packet-rtps.h b/epan/dissectors/packet-rtps.h
index 2a25b61dde..0d7fd53c84 100644
--- a/epan/dissectors/packet-rtps.h
+++ b/epan/dissectors/packet-rtps.h
@@ -336,6 +336,7 @@ static dissector_table_t rtps_type_name_table;
#define PID_SAMPLE_SIGNATURE (0x8019)/* inline QoS */
#define PID_EXTENDED (0x3f01)
#define PID_LIST_END (0x3f02)
+#define PID_UNICAST_LOCATOR_EX (0x8007)
#define PID_IDENTITY_TOKEN (0x1001)
#define PID_PERMISSIONS_TOKEN (0x1002)
@@ -539,7 +540,8 @@ static dissector_table_t rtps_type_name_table;
#define ENCAPSULATION_D_CDR2_LE (0x0009)
#define ENCAPSULATION_PL_CDR2_BE (0x000a)
#define ENCAPSULATION_PL_CDR2_LE (0x000b)
-
+#define ENCAPSULATION_SHMEM_REF_PLAIN (0xC000)
+#define ENCAPSULATION_SHMEM_REF_FLAT_DATA (0xC001)
/* Parameter Liveliness */
#define LIVELINESS_AUTOMATIC (0)
@@ -658,8 +660,10 @@ static int hf_rtps_dissection_string = -1;
/* Utilities to add elements to the protocol tree for packet-rtps.h and packet-rtps2.h */
extern guint16 rtps_util_add_protocol_version(proto_tree *tree, tvbuff_t* tvb, gint offset);
extern guint16 rtps_util_add_vendor_id(proto_tree *tree, tvbuff_t * tvb, gint offset);
-extern void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, gint offset,
+extern gint rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, gint offset,
const guint encoding, const char * label);
+extern gint rtps_util_add_locator_ex_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset,
+ const guint encoding, int param_length);
extern int rtps_util_add_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb,
gint offset, const guint8* label, const guint encoding);
extern int rtps_util_add_multichannel_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
@@ -691,6 +695,8 @@ extern gint rtps_util_add_seq_string(proto_tree *tree, tvbuff_t* tvb, gint offse
int hf_string, const char *label);
extern gint rtps_util_add_seq_octets(proto_tree *tree, packet_info *pinfo, tvbuff_t* tvb,
gint offset, const guint encoding, int param_length, int hf_id);
+extern gint rtps_util_add_seq_short(proto_tree *tree, tvbuff_t *tvb, gint offset, int hf_item,
+ const guint encoding, int param_length _U_, const char *label);
extern gint rtps_util_add_seq_ulong(proto_tree *tree, tvbuff_t * tvb, gint offset, int hf_item,
const guint encoding, int param_length, const char *label);