aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanjo Martin <juanjo@rti.com>2017-11-23 16:31:43 +0100
committerAnders Broman <a.broman58@gmail.com>2017-11-29 04:51:26 +0000
commit9cd82c3753d9d0241b89801dc10f9baaa4dd5d4f (patch)
treec3a0d16388b5456d5e70de26ffb3706bbf3e040d
parentf10237f0a512139c44f840bf363353c755aa8818 (diff)
RTPS: Added DataWriter QoS to topic information feature
Change-Id: Ib8d9c4f75543ed05c1bf69589069ed2425e3394e Reviewed-on: https://code.wireshark.org/review/24555 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.c56
-rw-r--r--epan/dissectors/packet-rtps.h14
2 files changed, 58 insertions, 12 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index 4b56ece..a579ca5 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -497,6 +497,7 @@ static gint ett_rtps_product_version = -1;
static gint ett_rtps_property_list = -1;
static gint ett_rtps_property = -1;
static gint ett_rtps_topic_info = -1;
+static gint ett_rtps_topic_info_dw_qos = -1;
static gint ett_rtps_type_object = -1;
static gint ett_rtps_type_library = -1;
static gint ett_rtps_type_element = -1;
@@ -1562,12 +1563,19 @@ typedef struct _endpoint_guid {
guint32 entity_id;
} endpoint_guid;
+typedef struct _datawriter_qos {
+ guint32 reliability_kind;
+ guint32 durability_kind;
+ guint32 ownership_kind;
+} datawriter_qos;
+
#define MAX_TOPIC_AND_TYPE_LENGTH 256
typedef struct _type_mapping {
endpoint_guid guid;
gchar type_name[MAX_TOPIC_AND_TYPE_LENGTH];
gchar topic_name[MAX_TOPIC_AND_TYPE_LENGTH];
gint fields_visited;
+ datawriter_qos dw_qos;
} type_mapping;
static wmem_map_t * registry = NULL;
@@ -3804,7 +3812,7 @@ static int rtps_util_add_fragment_number_set(proto_tree *tree, packet_info *pinf
static void rtps_util_store_type_mapping(tvbuff_t *tvb, gint offset,
type_mapping * type_mapping_object, const gchar * value,
- gint topic_info_add_id) {
+ gint topic_info_add_id, const guint encoding) {
if (enable_topic_info && type_mapping_object) {
switch (topic_info_add_id) {
case TOPIC_INFO_ADD_GUID: {
@@ -3828,6 +3836,27 @@ static void rtps_util_store_type_mapping(tvbuff_t *tvb, gint offset,
type_mapping_object->fields_visited | TOPIC_INFO_ADD_TYPE_NAME;
break;
}
+ case TOPIC_INFO_ADD_RELIABILITY: {
+ type_mapping_object->dw_qos.reliability_kind =
+ tvb_get_guint32(tvb, offset, encoding);
+ type_mapping_object->fields_visited =
+ type_mapping_object->fields_visited | TOPIC_INFO_ADD_RELIABILITY;
+ break;
+ }
+ case TOPIC_INFO_ADD_DURABILITY: {
+ type_mapping_object->dw_qos.durability_kind =
+ tvb_get_guint32(tvb, offset, encoding);
+ type_mapping_object->fields_visited =
+ type_mapping_object->fields_visited | TOPIC_INFO_ADD_DURABILITY;
+ break;
+ }
+ case TOPIC_INFO_ADD_OWNERSHIP: {
+ type_mapping_object->dw_qos.ownership_kind =
+ tvb_get_guint32(tvb, offset, encoding);
+ type_mapping_object->fields_visited =
+ type_mapping_object->fields_visited | TOPIC_INFO_ADD_OWNERSHIP;
+ break;
+ }
default:
break;
}
@@ -3875,7 +3904,7 @@ static void rtps_util_format_typename(gchar * type_name, gchar ** output) {
static void rtps_util_topic_info_add_tree(proto_tree *tree, tvbuff_t *tvb,
gint offset, endpoint_guid * guid) {
if (enable_topic_info) {
- proto_tree * topic_info_tree;
+ proto_tree * topic_info_tree, * dw_qos_tree;
proto_item * ti;
type_mapping * type_mapping_object = rtps_util_get_topic_info(guid);
if (type_mapping_object != NULL) {
@@ -3887,6 +3916,12 @@ static void rtps_util_topic_info_add_tree(proto_tree *tree, tvbuff_t *tvb,
ti = proto_tree_add_string(topic_info_tree, hf_rtps_param_type_name, tvb, offset, 0,
type_mapping_object->type_name);
PROTO_ITEM_SET_GENERATED(ti);
+ dw_qos_tree = proto_tree_add_subtree_format(topic_info_tree, tvb, 0, 0,
+ ett_rtps_topic_info_dw_qos, NULL, "DataWriter QoS: %s, %s, %s",
+ val_to_str(type_mapping_object->dw_qos.reliability_kind, reliability_qos_vals, "%02x"),
+ val_to_str(type_mapping_object->dw_qos.durability_kind, durability_qos_vals, "%02x"),
+ val_to_str(type_mapping_object->dw_qos.ownership_kind, ownership_qos_vals, "%02x"));
+ PROTO_ITEM_SET_GENERATED(dw_qos_tree);
}
}
}
@@ -4740,7 +4775,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
retVal = (gchar*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, str_size, ENC_ASCII);
- rtps_util_store_type_mapping(tvb, offset, type_mapping_object, retVal, TOPIC_INFO_ADD_TOPIC_NAME);
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object,
+ retVal, TOPIC_INFO_ADD_TOPIC_NAME, encoding);
rtps_util_add_string(rtps_parameter_tree, tvb, offset, hf_rtps_param_topic_name, encoding);
break;
@@ -4775,7 +4811,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
retVal = (gchar*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, str_size, ENC_ASCII);
- rtps_util_store_type_mapping(tvb, offset, type_mapping_object, retVal, TOPIC_INFO_ADD_TYPE_NAME);
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object,
+ retVal, TOPIC_INFO_ADD_TYPE_NAME, encoding);
rtps_util_add_string(rtps_parameter_tree, tvb, offset, hf_rtps_param_type_name, encoding);
break;
@@ -4857,7 +4894,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
case PID_RELIABILITY:
ENSURE_LENGTH(4);
proto_tree_add_item(rtps_parameter_tree, hf_rtps_reliability_kind, tvb, offset, 4, encoding);
-
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object, NULL,
+ TOPIC_INFO_ADD_RELIABILITY, encoding);
/* Older version of the protocol (and for PID_RELIABILITY_OFFERED)
* this parameter was carrying also a NtpTime called
* 'maxBlockingTime'.
@@ -4897,6 +4935,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
case PID_DURABILITY:
ENSURE_LENGTH(4);
proto_tree_add_item(rtps_parameter_tree, hf_rtps_durability, tvb, offset, 4, encoding);
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object, NULL,
+ TOPIC_INFO_ADD_DURABILITY, encoding);
break;
/* 0...2...........7...............15.............23...............31
@@ -4934,6 +4974,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
case PID_OWNERSHIP:
ENSURE_LENGTH(4);
proto_tree_add_item(rtps_parameter_tree, hf_rtps_ownership, tvb, offset, 4, encoding);
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object, NULL,
+ TOPIC_INFO_ADD_OWNERSHIP, encoding);
break;
/* 0...2...........7...............15.............23...............31
@@ -5862,7 +5904,8 @@ static gboolean dissect_parameter_sequence_v2(proto_tree *rtps_parameter_tree, p
*/
case PID_ENDPOINT_GUID:
ENSURE_LENGTH(16);
- rtps_util_store_type_mapping(tvb, offset, type_mapping_object, NULL, TOPIC_INFO_ADD_GUID);
+ rtps_util_store_type_mapping(tvb, offset, type_mapping_object,
+ NULL, TOPIC_INFO_ADD_GUID, encoding);
rtps_util_add_generic_guid_v2(rtps_parameter_tree, tvb, offset,
hf_rtps_endpoint_guid, hf_rtps_param_host_id, hf_rtps_param_app_id,
hf_rtps_param_instance_id, hf_rtps_param_entity, hf_rtps_param_entity_key,
@@ -11832,6 +11875,7 @@ void proto_register_rtps(void) {
&ett_rtps_property_list,
&ett_rtps_property,
&ett_rtps_topic_info,
+ &ett_rtps_topic_info_dw_qos,
&ett_rtps_type_object,
&ett_rtps_type_library,
&ett_rtps_type_element,
diff --git a/epan/dissectors/packet-rtps.h b/epan/dissectors/packet-rtps.h
index 6507900..6a7c87f 100644
--- a/epan/dissectors/packet-rtps.h
+++ b/epan/dissectors/packet-rtps.h
@@ -558,12 +558,14 @@ typedef struct _rtps_dissector_data {
#define NDDS_TRANSPORT_CLASSID_ITP (13)
#define NDDS_TRANSPORT_CLASSID_SHMEM (0x01000000)
-#define TOPIC_INFO_ADD_GUID (1)
-#define TOPIC_INFO_ADD_TYPE_NAME (2)
-#define TOPIC_INFO_ADD_TOPIC_NAME (4)
-#define TOPIC_INFO_ALL_SET (TOPIC_INFO_ADD_GUID | \
- TOPIC_INFO_ADD_TYPE_NAME | \
- TOPIC_INFO_ADD_TOPIC_NAME)
+#define TOPIC_INFO_ADD_GUID (0x01)
+#define TOPIC_INFO_ADD_TYPE_NAME (0x02)
+#define TOPIC_INFO_ADD_TOPIC_NAME (0x04)
+#define TOPIC_INFO_ADD_RELIABILITY (0x08)
+#define TOPIC_INFO_ADD_DURABILITY (0x10)
+#define TOPIC_INFO_ADD_OWNERSHIP (0x20)
+#define TOPIC_INFO_ALL_SET (0x3f)
+
/* 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);