aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtps.c
diff options
context:
space:
mode:
authorJuanjo Martin <juanjo@rti.com>2016-03-31 12:05:58 +0200
committerMichael Mann <mmann78@netscape.net>2016-04-17 12:03:05 +0000
commit9a7a54c0b7d7f76c1f889960f2f183cebc81fb3e (patch)
treeb31e39783ad6a0e512322e0c876fa37ad75c2a2d /epan/dissectors/packet-rtps.c
parent450c0d518bda19479a4770ad0e28a55ee0a08cab (diff)
RTPS: Added an analysis field to the ACKNACK dissection
A lot of people fail when interpreting ACKNACKs. I added a new field that interprets the numeric values and shows a brief sentence with the analysis. Bug: 12312 Change-Id: I89a33f04c52ebd5ca486d2e23bddb7a6646945e7 Reviewed-on: https://code.wireshark.org/review/14724 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-rtps.c')
-rw-r--r--epan/dissectors/packet-rtps.c94
1 files changed, 57 insertions, 37 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index 41208faec1..9a9c4d7902 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -276,6 +276,7 @@ static int hf_rtps_encapsulation_kind = -1;
static int hf_rtps_octets_to_inline_qos = -1;
static int hf_rtps_filter_signature = -1;
static int hf_rtps_bitmap = -1;
+static int hf_rtps_acknack_analysis = -1;
static int hf_rtps_property_name = -1;
static int hf_rtps_property_value = -1;
static int hf_rtps_union = -1;
@@ -2756,27 +2757,49 @@ static int rtps_util_add_bitmap(proto_tree *tree,
tvbuff_t *tvb,
gint offset,
gboolean little_endian,
- const char *label _U_) {
+ const char *label) {
gint32 num_bits;
guint32 data;
wmem_strbuf_t *temp_buff = wmem_strbuf_new_label(wmem_packet_scope());
- int i, j, idx;
+ wmem_strbuf_t *analysis_buff = wmem_strbuf_new_label(wmem_packet_scope());
+ gint i, j, idx;
gchar *last_one;
- proto_item *ti;
+ proto_item *ti = NULL, *ti_tree = NULL;
proto_tree *bitmap_tree;
const gint original_offset = offset;
guint32 datamask;
+ guint64 first_seq_number;
+ gboolean first_nack = TRUE;
- bitmap_tree = proto_tree_add_subtree(tree, tvb, original_offset, offset-original_offset, ett_rtps_bitmap, &ti, label);
+ bitmap_tree = proto_tree_add_subtree(tree, tvb, original_offset, offset-original_offset,
+ ett_rtps_bitmap, &ti_tree, label);
/* Bitmap base sequence number */
- rtps_util_add_seq_number(bitmap_tree, tvb, offset, little_endian, "bitmapBase");
+ first_seq_number = rtps_util_add_seq_number(bitmap_tree, tvb, offset, little_endian, "bitmapBase");
offset += 8;
/* Reads the bitmap size */
num_bits = NEXT_guint32(tvb, offset, little_endian);
proto_tree_add_uint(bitmap_tree, hf_rtps_bitmap_num_bits, tvb, offset, 4, num_bits);
offset += 4;
+ /* bitmap base 0 means that this is a preemptive ACKNACK */
+ if (first_seq_number == 0) {
+ ti = proto_tree_add_uint_format(bitmap_tree, hf_rtps_acknack_analysis, tvb, 0, 0,
+ 1, "Acknack Analysis: Preemptive ACKNACK");
+ PROTO_ITEM_SET_GENERATED(ti);
+ }
+
+ if (first_seq_number > 0 && num_bits == 0) {
+ ti = proto_tree_add_uint_format(bitmap_tree, hf_rtps_acknack_analysis, tvb, 0, 0,
+ 2, "Acknack Analysis: Expecting sample %" G_GINT64_MODIFIER "u", first_seq_number);
+ PROTO_ITEM_SET_GENERATED(ti);
+ }
+
+ if (num_bits > 0) {
+ ti = proto_tree_add_uint_format(bitmap_tree, hf_rtps_acknack_analysis, tvb, 0, 0,
+ 3, "Acknack Analysis: Lost samples");
+ PROTO_ITEM_SET_GENERATED(ti);
+ }
/* Reads the bits (and format the print buffer) */
idx = 0;
@@ -2786,6 +2809,12 @@ static int rtps_util_add_bitmap(proto_tree *tree,
for (j = 0; j < 32; ++j) {
datamask = (1U << (31-j));
wmem_strbuf_append_c(temp_buff, ((data & datamask) == datamask) ? '1':'0');
+ if ((data & datamask) == datamask) {
+ proto_item_append_text(ti,
+ first_nack ? " %" G_GINT64_MODIFIER "u" : ", %" G_GINT64_MODIFIER "u",
+ first_seq_number + idx);
+ first_nack = FALSE;
+ }
++idx;
if ((idx >= num_bits) || (wmem_strbuf_get_len(temp_buff) >= (ITEM_LABEL_LENGTH - 1))) {
break;
@@ -2800,11 +2829,19 @@ static int rtps_util_add_bitmap(proto_tree *tree,
}
if (wmem_strbuf_get_len(temp_buff) > 0) {
- proto_tree_add_bytes_format_value(bitmap_tree, hf_rtps_bitmap, tvb, original_offset + 12, offset - original_offset - 12,
- NULL, "%s", wmem_strbuf_get_str(temp_buff));
+ proto_tree_add_bytes_format_value(bitmap_tree, hf_rtps_bitmap, tvb,
+ original_offset + 12, offset - original_offset - 12,
+ NULL, "%s", wmem_strbuf_get_str(temp_buff));
+ }
+
+ proto_item_set_len(ti_tree, offset-original_offset);
+
+ /* Add analysis of the information */
+ if (num_bits > 0) {
+ proto_item_append_text(ti, "%s in range [%" G_GINT64_MODIFIER "u,%" G_GINT64_MODIFIER "u]",
+ wmem_strbuf_get_str(analysis_buff), first_seq_number, first_seq_number + num_bits - 1);
}
- proto_item_set_len(ti, offset-original_offset);
return offset;
}
@@ -5921,11 +5958,7 @@ static void dissect_ACKNACK(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
proto_tree_add_bitmask_value(tree, tvb, offset + 1, hf_rtps_sm_flags, ett_rtps_flags, ACKNACK_FLAGS, flags);
- octet_item = proto_tree_add_item(tree,
- hf_rtps_sm_octets_to_next_header,
- tvb,
- offset + 2,
- 2,
+ octet_item = proto_tree_add_item(tree, hf_rtps_sm_octets_to_next_header, tvb, offset + 2, 2,
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
if (octets_to_next_header < 20) {
@@ -5937,36 +5970,17 @@ static void dissect_ACKNACK(tvbuff_t *tvb, packet_info *pinfo, gint offset, guin
original_offset = offset;
/* readerEntityId */
- rtps_util_add_entity_id(tree,
- tvb,
- offset,
- hf_rtps_sm_rdentity_id,
- hf_rtps_sm_rdentity_id_key,
- hf_rtps_sm_rdentity_id_kind,
- ett_rtps_rdentity,
- "readerEntityId",
- NULL);
+ rtps_util_add_entity_id(tree, tvb, offset, hf_rtps_sm_rdentity_id, hf_rtps_sm_rdentity_id_key,
+ hf_rtps_sm_rdentity_id_kind, ett_rtps_rdentity, "readerEntityId", NULL);
offset += 4;
/* writerEntityId */
- rtps_util_add_entity_id(tree,
- tvb,
- offset,
- hf_rtps_sm_wrentity_id,
- hf_rtps_sm_wrentity_id_key,
- hf_rtps_sm_wrentity_id_kind,
- ett_rtps_wrentity,
- "writerEntityId",
- NULL);
+ rtps_util_add_entity_id(tree, tvb, offset, hf_rtps_sm_wrentity_id, hf_rtps_sm_wrentity_id_key,
+ hf_rtps_sm_wrentity_id_kind, ett_rtps_wrentity, "writerEntityId", NULL);
offset += 4;
/* Bitmap */
- offset = rtps_util_add_bitmap(tree,
- tvb,
- offset,
- little_endian,
- "readerSNState");
-
+ offset = rtps_util_add_bitmap(tree, tvb, offset, little_endian, "readerSNState");
/* RTPS 1.0 didn't have count: make sure we don't decode it wrong
* in this case
@@ -9297,6 +9311,12 @@ void proto_register_rtps(void) {
NULL, HFILL }
},
+ { &hf_rtps_acknack_analysis,
+ { "Acknack Analysis", "rtps.sm.acknack_analysis",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL }
+ },
+
{ &hf_rtps_param_partition_num,
{ "Size", "rtps.param.partition_num",
FT_INT32, BASE_DEC, NULL, 0,