summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtps.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:18 +0000
commit1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f (patch)
tree9930fb4bb87cd6037f60efff9656f967121c8c2d /epan/dissectors/packet-rtps.c
parentAdding debian version 4.2.2-1.1. (diff)
downloadwireshark-1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f.tar.xz
wireshark-1da76b3706a6c9bd41bf8f219d7c97de5e1e5c7f.zip
Merging upstream version 4.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-rtps.c')
-rw-r--r--epan/dissectors/packet-rtps.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index f278368e..a6fb03d9 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -2859,7 +2859,7 @@ static gint dissect_crypto_algorithm_requirements(proto_tree *tree , tvbuff_t* t
return offset;
}
-static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * info, gboolean * is_end, gboolean show);
static gint get_native_type_cdr_length(guint64 member_kind) {
@@ -3008,7 +3008,8 @@ static dissection_info* lookup_dissection_info_in_custom_and_builtin_types(guint
}
/* this is a recursive function. _info may or may not be NULL depending on the use iteration */
-static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * _info, guint64 type_id, gchar * name,
RTICdrTypeObjectExtensibility extensibility, gint offset_zero,
guint16 flags, guint32 element_member_id, gboolean show) {
@@ -3064,6 +3065,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
//proto_item_append_text(tree, "(Before Switch 0x%016" PRIx64 ")", type_id);
+ increment_dissection_depth(pinfo);
switch (member_kind) {
case RTI_CDR_TYPE_OBJECT_TYPE_KIND_BOOLEAN_TYPE: {
gint length = get_native_type_cdr_length(member_kind);
@@ -3237,7 +3239,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
break;
}
}
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, temp_buff, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show_current_element);
}
@@ -3310,7 +3312,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
}
if (info != NULL && info->base_type_id > 0)
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, temp_buff, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show_current_element);
}
/* If reached the limit and there are remaining elements we need to show the message and
@@ -3351,7 +3353,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
if (info != NULL) {
base_type_id = info->base_type_id;
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
base_type_id, name, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show);
break;
}
@@ -3369,7 +3371,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" PRIx64 ")",
value, result->member_type_id);
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
} else {
/* the hashmap uses the type_id to index the objects. substracting -2 here to lookup the discriminator
@@ -3381,7 +3383,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" PRIx64 ")",
value, result->member_type_id);
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
}
}
@@ -3414,7 +3416,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
/* Updated only once */
first_skipped_element_offset = offset;
}
- offset = dissect_mutable_member(aux_tree, tvb, offset, encoding, encoding_version, info, &is_end, show_current_element);
+ offset = dissect_mutable_member(aux_tree, tvb, pinfo, offset, encoding, encoding_version, info, &is_end, show_current_element);
++num_elements;
if (show_current_element) {
++shown_elements;
@@ -3426,7 +3428,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
if (show) {
proto_item_append_text(tree, "(BaseId: 0x%016" PRIx64 ")", info->base_type_id);
}
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, info->member_name, EXTENSIBILITY_INVALID,
offset, 0, 0, show);
}
@@ -3445,7 +3447,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
first_skipped_element_offset = offset;
}
/* If a member is not shown all it children will inherit the "show_current_element" value */
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->elements[i].type_id, info->elements[i].member_name, info->extensibility,
offset_zero, info->elements[i].flags, info->elements[i].member_id, show_current_element);
}
@@ -3476,6 +3478,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
break;
}
}
+ decrement_dissection_depth(pinfo);
if (extensibility == EXTENSIBILITY_MUTABLE) {
offset_zero += member_length;
@@ -3485,7 +3488,8 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
}
-static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * info, gboolean * is_end, gboolean show) {
proto_tree * member;
@@ -3514,7 +3518,7 @@ static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offse
mapping = (mutable_member_mapping *) wmem_map_lookup(mutable_member_mappings, &(key));
if (mapping) { /* the library knows how to dissect this */
proto_item_append_text(member, "(base found 0x%016" PRIx64 ")", key);
- dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL, mapping->member_type_id,
+ dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL, mapping->member_type_id,
mapping->member_name, EXTENSIBILITY_INVALID, offset, 0, mapping->member_id, show);
proto_item_set_hidden(member);
return check_offset_addition(offset, member_length, tree, NULL, tvb);
@@ -3528,7 +3532,7 @@ static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offse
mapping = (mutable_member_mapping *) wmem_map_lookup(mutable_member_mappings, &(key));
if (mapping) { /* the library knows how to dissect this */
proto_item_append_text(member, "(found 0x%016" PRIx64 ")", key);
- dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL, mapping->member_type_id,
+ dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL, mapping->member_type_id,
mapping->member_name, EXTENSIBILITY_INVALID, offset, 0, mapping->member_id, show);
} else
@@ -4920,7 +4924,8 @@ static const char *rtps_util_typecode_id_to_string(guint32 typecode_id) {
/* Insert in the protocol tree the next bytes interpreted as typecode info
* Returns the number of bytes parsed
*/
-static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset, const guint encoding,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset, const guint encoding,
int indent_level, int is_pointer, guint16 bitfield, int is_key, const gint offset_begin,
char *name,
int seq_max_len, /* -1 = not a sequence field */
@@ -5064,9 +5069,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset = disc_offset_begin + disc_size;
#if 0
field_offset_begin = offset;
+ increment_dissection_depth(pinfo);
offset += rtps_util_add_typecode(
tree,
tvb,
+ pinfo,
offset,
encoding,
indent_level+1,
@@ -5078,6 +5085,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
-1,
NULL,
ndds_40_hack);
+ decrement_dissection_depth(pinfo);
#endif
/* Add the entry of the union in the tree */
@@ -5143,9 +5151,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
proto_item_set_len(case_item, retVal);
}
- offset += rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ offset += rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level+2, member_is_pointer, 0, 0, field_offset_begin,
member_name, -1, NULL, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
}
/* Finally prints the name of the struct (if provided) */
(void) g_strlcpy(type_name, "}", sizeof(type_name));
@@ -5313,9 +5323,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
member_is_key = tvb_get_guint8(tvb, offset);
offset++;
- offset += rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ offset += rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level+1, member_is_pointer, member_bitfield, member_is_key,
field_offset_begin, member_name, -1, NULL, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
}
}
/* Finally prints the name of the struct (if provided) */
@@ -5354,7 +5366,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset += 4;
/* Recursive decode seq typecode */
- /*offset += */rtps_util_add_typecode(tree, tvb, offset, encoding, indent_level,
+ /*offset += */rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding, indent_level,
is_pointer, bitfield, is_key, offset_begin, name,
seq_max_len2, NULL, ndds_40_hack);
/* Differently from the other typecodes, the line has been already printed */
@@ -5389,9 +5401,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
}
/* Recursive decode seq typecode */
- /*offset += */rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ /*offset += */rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level, is_pointer, bitfield, is_key, offset_begin,
name, -1, size, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
/* Differently from the other typecodes, the line has been already printed */
return retVal;
}
@@ -5981,6 +5995,7 @@ static void rtps_util_add_type_element_struct(proto_tree *tree,
static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding, guint32 size);
+// NOLINTNEXTLINE(misc-no-recursion)
static void rtps_util_add_type_element_module(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding) {
guint32 long_number;
@@ -5992,6 +6007,7 @@ static void rtps_util_add_type_element_module(proto_tree *tree, packet_info * pi
rtps_util_add_type_library(tree, pinfo, tvb, offset, encoding, -1);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint rtps_util_add_type_library_element(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding) {
proto_tree * element_tree;
@@ -6065,6 +6081,7 @@ static gint rtps_util_add_type_library_element(proto_tree *tree, packet_info * p
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding, guint32 size) {
proto_tree * library_tree;
@@ -6073,10 +6090,12 @@ static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
library_tree = proto_tree_add_subtree_format(tree, tvb, offset, size,
ett_rtps_type_library, NULL, "Type Library (%d elements)", long_number);
offset += 4;
+ increment_dissection_depth(pinfo);
for (i = 0; i < long_number; i++) {
offset = rtps_util_add_type_library_element(library_tree, pinfo, tvb,
offset, encoding);
}
+ decrement_dissection_depth(pinfo);
}
static void rtps_util_add_typeobject(proto_tree *tree, packet_info * pinfo,
@@ -6753,7 +6772,7 @@ static gboolean rtps_util_try_dissector(proto_tree *tree,
info = lookup_dissection_info_in_custom_and_builtin_types(type_mapping_object->type_id);
if (info != NULL) {
proto_item_append_text(tree, " (TypeId: 0x%016" PRIx64 ")", info->type_id);
- return dissect_user_defined(tree, tvb, offset, encoding, encoding_version, info,
+ return dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, info,
info->type_id, info->member_name, EXTENSIBILITY_INVALID, offset,
0 /* flags */, 0 /* member_id */, TRUE);
}
@@ -7498,6 +7517,7 @@ static gboolean dissect_parameter_sequence_rti_dds(proto_tree *rtps_parameter_tr
case PID_TYPECODE_RTPS2: {
rtps_util_add_typecode(rtps_parameter_tree,
tvb,
+ pinfo,
offset,
encoding,
0, /* indent level */
@@ -7714,6 +7734,7 @@ static gboolean dissect_parameter_sequence_toc(proto_tree *rtps_parameter_tree,
case PID_TYPECODE_RTPS2: {
rtps_util_add_typecode(rtps_parameter_tree,
tvb,
+ pinfo,
offset,
encoding,
0, /* indent level */
@@ -8608,7 +8629,7 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
* +---------------+---------------+---------------+---------------+
*/
case PID_TYPECODE:
- rtps_util_add_typecode(rtps_parameter_tree, tvb, offset, encoding,
+ rtps_util_add_typecode(rtps_parameter_tree, tvb, pinfo, offset, encoding,
0, /* indent level */
0, /* isPointer */
-1, /* bitfield */