diff options
-rw-r--r-- | epan/dissectors/packet-rtps.c | 2397 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps.h | 81 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps2.c | 2378 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps2.h | 125 |
4 files changed, 1167 insertions, 3814 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 2706b3f498..f15622c30a 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -128,11 +128,11 @@ static int hf_rtps_sm_wrentity_id_key = -1; static int hf_rtps_sm_wrentity_id_kind = -1; static int hf_rtps_sm_seq_number = -1; +static int hf_rtps_info_src_ip = -1; +static int hf_rtps_info_src_unused = -1; + static int hf_rtps_parameter_id = -1; static int hf_rtps_parameter_length = -1; -static int hf_rtps_param_ntpt = -1; -static int hf_rtps_param_ntpt_sec = -1; -static int hf_rtps_param_ntpt_fraction = -1; static int hf_rtps_param_topic_name = -1; static int hf_rtps_param_strength = -1; static int hf_rtps_param_type_name = -1; @@ -143,6 +143,51 @@ static int hf_rtps_param_content_filter_name = -1; static int hf_rtps_param_related_topic_name = -1; static int hf_rtps_param_filter_name = -1; static int hf_rtps_issue_data = -1; +static int hf_rtps_durability_service_cleanup_delay = -1; +static int hf_rtps_liveliness_lease_duration = -1; +static int hf_rtps_participant_lease_duration = -1; +static int hf_rtps_time_based_filter_minimum_separation = -1; +static int hf_rtps_reliability_max_blocking_time= -1; +static int hf_rtps_deadline_period = -1; +static int hf_rtps_latency_budget_duration = -1; +static int hf_rtps_lifespan_duration = -1; +static int hf_rtps_persistence = -1; +static int hf_rtps_info_ts_timestamp = -1; +static int hf_rtps_locator_kind = -1; +static int hf_rtps_locator_port = -1; +static int hf_rtps_locator_ipv4 = -1; +static int hf_rtps_locator_ipv6 = -1; +static int hf_rtps_participant_builtin_endpoints= -1; +static int hf_rtps_participant_manual_liveliness_count = -1; +static int hf_rtps_history_depth = -1; +static int hf_rtps_resource_limit_max_samples = -1; +static int hf_rtps_resource_limit_max_instances = -1; +static int hf_rtps_resource_limit_max_samples_per_instances = -1; +static int hf_rtps_filter_bitmap = -1; +static int hf_rtps_type_checksum = -1; +static int hf_rtps_queue_size = -1; +static int hf_rtps_acknack_counter = -1; +static int hf_rtps_durability_service_history_kind = -1; +static int hf_rtps_durability_service_history_depth = -1; +static int hf_rtps_durability_service_max_samples = -1; +static int hf_rtps_durability_service_max_instances = -1; +static int hf_rtps_durability_service_max_samples_per_instances = -1; +static int hf_rtps_liveliness_kind = -1; +static int hf_rtps_manager_key = -1; +static int hf_rtps_locator_udp_v4 = -1; +static int hf_rtps_locator_udp_v4_port = -1; +static int hf_param_ip_address = -1; +static int hf_rtps_param_port = -1; +static int hf_rtps_expects_inline_qos = -1; +static int hf_rtps_presentation_coherent_access = -1; +static int hf_rtps_presentation_ordered_access = -1; +static int hf_rtps_expects_ack = -1; +static int hf_rtps_reliability_kind = -1; +static int hf_rtps_durability = -1; +static int hf_rtps_ownership = -1; +static int hf_rtps_presentation_access_scope = -1; +static int hf_rtps_destination_order = -1; +static int hf_rtps_history_kind = -1; /* Subtree identifiers */ static gint ett_rtps = -1; @@ -164,9 +209,19 @@ static gint ett_rtps_ntp_time = -1; static gint ett_rtps_bitmap = -1; static gint ett_rtps_seq_string = -1; static gint ett_rtps_seq_ulong = -1; +static gint ett_rtps_resource_limit = -1; +static gint ett_rtps_durability_service = -1; +static gint ett_rtps_liveliness = -1; +static gint ett_rtps_manager_key = -1; /***************************************************************************/ /* Value-to-String Tables */ +static const value_string vendor_vals[] = { + { RTPS_VENDOR_RTI, RTPS_VENDOR_RTI_STRING}, + { RTPS_VENDOR_TOC, RTPS_VENDOR_TOC_STRING}, + { 0, NULL } +}; + static const value_string entity_id_vals[] = { { ENTITYID_UNKNOWN, "ENTITYID_UNKNOWN" }, { ENTITYID_BUILTIN_TOPIC_WRITER, "ENTITYID_BUILTIN_TOPIC_WRITER" }, @@ -225,6 +280,13 @@ static const value_string app_kind_vals[] = { { 0, NULL } }; +static const value_string rtps_locator_kind_vals[] = { + { LOCATOR_KIND_UDPV4, "LOCATOR_KIND_UDPV4" }, + { LOCATOR_KIND_UDPV6, "LOCATOR_KIND_UDPV6" }, + { LOCATOR_KIND_INVALID, "LOCATOR_KIND_INVALID" }, + { LOCATOR_KIND_RESERVED, "LOCATOR_KIND_RESERVED" }, + { 0, NULL } +}; static const value_string submessage_id_vals[] = { { PAD, "PAD" }, @@ -324,11 +386,11 @@ static const value_string parameter_id_vals[] = { { PID_HISTORY, "PID_HISTORY" }, { PID_RESOURCE_LIMIT, "PID_RESOURCE_LIMIT" }, { PID_METATRAFFIC_MULTICAST_PORT, "PID_METATRAFFIC_MULTICAST_PORT" }, - { PID_DEFAULT_EXPECTS_INLINE_QOS, "PID_DEFAULT_EXPECTS_INLINE_QOS" }, + { PID_EXPECTS_INLINE_QOS, "PID_EXPECTS_INLINE_QOS" }, { PID_METATRAFFIC_UNICAST_IPADDRESS, "PID_METATRAFFIC_UNICAST_IPADDRESS" }, { PID_PARTICIPANT_BUILTIN_ENDPOINTS, "PID_PARTICIPANT_BUILTIN_ENDPOINTS" }, { PID_CONTENT_FILTER_PROPERTY, "PID_CONTENT_FILTER_PROPERTY" }, - { PID_PROPERTY_LIST, "PID_PROPERTY_LIST" }, + { PID_PROPERTY_LIST_OLD, "PID_PROPERTY_LIST" }, { PID_FILTER_SIGNATURE, "PID_FILTER_SIGNATURE" }, { PID_COHERENT_SET, "PID_COHERENT_SET" }, { PID_TYPECODE, "PID_TYPECODE" }, @@ -529,57 +591,14 @@ static const struct Flag_definition INFO_REPLY_FLAGS[] = { */ /* Utility to add elements to the protocol tree */ -static void rtps_util_format_ipv6(guint8 *, guint8 *, gint); -static void rtps_util_add_protocol_version(proto_tree *, tvbuff_t *, gint); -static void rtps_util_add_vendor_id(proto_tree *, tvbuff_t *, - gint, guint8 *, gint); -static void rtps_util_add_locator_t(proto_tree *, tvbuff_t *, - gint, int, const guint8 *, guint8 *, gint); -static void rtps_util_add_locator_list(proto_tree *, tvbuff_t *, - gint, const guint8 *, int); -static void rtps_util_add_ipv4_address_t(proto_tree *, tvbuff_t *, - gint, int, const guint8 *, guint8 *, gint); -static void rtps_util_add_locator_udp_v4(proto_tree *, tvbuff_t *, - gint, const guint8 *, int); static void rtps_util_add_guid_prefix(proto_tree *, tvbuff_t *, - gint, int, int, int, int, int, const guint8 *, - guint8 *, gint); -static int rtps_util_add_entity_id(proto_tree *, tvbuff_t *, - gint, int, int, int, int, const char *, guint32 *); -static void rtps_util_add_generic_entity_id(proto_tree *, tvbuff_t *, - gint, const char *, - guint8 *, gint); + gint, int, int, int, int, int, const guint8 *); static void rtps_util_add_generic_guid(proto_tree *, tvbuff_t *, gint, const char *, guint8 *, gint); -static guint64 rtps_util_add_seq_number(proto_tree *, tvbuff_t *, - gint, int, const char *); -static void rtps_util_add_ntp_time(proto_tree *, tvbuff_t *, - gint, int, const char *, guint8 *, gint); -static gint rtps_util_add_string(proto_tree *, tvbuff_t *, - gint, int, int, const guint8 *, guint8 *, size_t); -static void rtps_util_add_long(proto_tree *, tvbuff_t *, - gint, int, int, gboolean, gboolean, const char *, - guint8 *, size_t); -static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, const char *, guint8 *, gint); -static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, const char *, guint8 *, size_t); -static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, - gint, int, guint8 *, gint); -static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, - gint, int, guint8 *, gint); -static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, const char *, const value_string *, guint8 *, size_t); -static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, const char *, guint8 *, gint); -static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, - gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, gint, int, const char *); static void rtps_util_decode_flags(proto_tree *, tvbuff_t *, gint, guint8, const struct Flag_definition *); -static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, const char *); /***************************************************************************/ @@ -593,68 +612,24 @@ static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, /* *********************************************************************** */ -/* Format the given address (16 octects) as an IPv6 address - */ -static void rtps_util_format_ipv6(guint8 *addr, - guint8 *buffer, - gint buffer_size) { - guint32 i; - guint8 temp[5]; /* Contains a 4-digit hex value */ - - buffer[0] = '\0'; - for (i = 0; i < 16; i+=2) { - /* Unfortunately %x is the same thing as %02x all the time... sigh */ - g_snprintf(temp, 5, "%02x%02x", addr[i], addr[i+1]); - if (temp[0] == '0') { - if (temp[1] == '0') { - if (temp[2] == '0') { - g_strlcat(buffer, &temp[3], buffer_size); - } else { - g_strlcat(buffer, &temp[2], buffer_size); - } - } else { - g_strlcat(buffer, &temp[1], buffer_size); - } - } else { - g_strlcat(buffer, temp, buffer_size); - } - if (i < 14) { - g_strlcat(buffer, ":", buffer_size); - } - } -} - - -/* *********************************************************************** */ -static void rtps_util_add_protocol_version(proto_tree *tree, /* Can NOT be NULL */ +guint16 rtps_util_add_protocol_version(proto_tree *tree, /* Can NOT be NULL */ tvbuff_t * tvb, gint offset) { proto_item * ti; proto_tree * version_tree; + guint16 version; - ti = proto_tree_add_none_format(tree, - hf_rtps_protocol_version, - tvb, - offset, - 2, - "Protocol version: %d.%d", - tvb_get_guint8(tvb, offset), - tvb_get_guint8(tvb, offset+1)); - version_tree = proto_item_add_subtree(ti, - ett_rtps_proto_version); - proto_tree_add_item(version_tree, - hf_rtps_protocol_version_major, - tvb, - offset, - 1, - ENC_BIG_ENDIAN); - proto_tree_add_item(version_tree, - hf_rtps_protocol_version_minor, - tvb, - offset+1, - 1, - ENC_BIG_ENDIAN); + version = tvb_get_ntohs(tvb, offset); + + ti = proto_tree_add_uint_format(tree, hf_rtps_protocol_version, tvb, offset, 2, + version, "Protocol version: %d.%d", + tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1)); + version_tree = proto_item_add_subtree(ti, ett_rtps_proto_version); + proto_tree_add_item(version_tree, hf_rtps_protocol_version_major, tvb, offset, 1, ENC_NA); + proto_tree_add_item(version_tree, hf_rtps_protocol_version_minor, tvb, offset+1, 1, ENC_NA); + + return version; } @@ -662,44 +637,19 @@ static void rtps_util_add_protocol_version(proto_tree *tree, /* Can NOT be NULL /* Interpret the next bytes as vendor ID. If proto_tree and field ID is * provided, it can also set. */ -static void rtps_util_add_vendor_id(proto_tree *tree, /* Can be NULL */ +void rtps_util_add_vendor_id(proto_tree *tree, tvbuff_t * tvb, - gint offset, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ + gint offset) { guint8 major, minor; - guint32 vendor_id = 0; - guint8 vendor_name[MAX_VENDOR_ID_SIZE]; + guint16 vendor_id; major = tvb_get_guint8(tvb, offset); minor = tvb_get_guint8(tvb, offset+1); - vendor_id = (major<<8) | minor; - switch(vendor_id) { - case RTPS_VENDOR_UNKNOWN: - g_strlcpy(vendor_name, RTPS_VENDOR_UNKNOWN_STRING, MAX_VENDOR_ID_SIZE); - break; - - case RTPS_VENDOR_RTI: - g_strlcpy(vendor_name, RTPS_VENDOR_RTI_STRING, MAX_VENDOR_ID_SIZE); - break; - - default: - g_snprintf(vendor_name, MAX_VENDOR_ID_SIZE, "%d.%d", major, minor); - } + vendor_id = tvb_get_ntohs(tvb, offset); - if (tree != NULL) { - proto_tree_add_uint_format(tree, - hf_rtps_vendor_id, - tvb, - offset, - 2, - vendor_id, - "vendor: %s", - vendor_name); - } - if (buffer != NULL) { - g_strlcpy(buffer, vendor_name, buffer_size); - } + proto_tree_add_uint_format_value(tree, hf_rtps_vendor_id, tvb, offset, 2, vendor_id, + "%02d.%02d (%s)", major, minor, + val_to_str_const(vendor_id, vendor_vals, "Unknown")); } @@ -714,109 +664,29 @@ static void rtps_util_add_vendor_id(proto_tree *tree, /* Can be NULL */ * octet[16] address; * } Locator_t; */ -static void rtps_util_add_locator_t(proto_tree *tree, /* Can NOT be NULL */ - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const guint8 * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ +void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, gint offset, + gboolean little_endian, const guint8 * label) { proto_item * ti; proto_tree * locator_tree; gint32 kind; - guint8 addr[16]; guint32 port; - char temp_buff[MAX_LOCATOR_SIZE]; - char addr_buff[MAX_IPV6_SIZE]; - const char *kind_string = NULL; - int i; + ti = proto_tree_add_text(tree, tvb, offset, 24, "%s", label); + locator_tree = proto_item_add_subtree(ti, ett_rtps_locator); - kind = NEXT_guint32(tvb, offset, little_endian); + kind = NEXT_guint32(tvb, offset, little_endian); port = NEXT_guint32(tvb, offset+4, little_endian); - for (i = 0; i < 16; ++i) { - addr[i] = tvb_get_guint8(tvb, offset + 8 + i); - } + proto_tree_add_uint(locator_tree, hf_rtps_locator_kind, tvb, offset, 4, kind); + ti = proto_tree_add_int(locator_tree, hf_rtps_locator_port, tvb, offset+4, 4, port); + if (port == 0) + expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Invalid Port"); - switch(kind) { - case LOCATOR_KIND_UDPV4: - kind_string = "LOCATOR_KIND_UDPV4"; - g_snprintf(addr_buff, MAX_IPV6_SIZE, - "%d.%d.%d.%d", - addr[12], - addr[13], - addr[14], - addr[15]); - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, "%s:%d", - addr_buff, - port); - break; - - case LOCATOR_KIND_UDPV6: - kind_string = "LOCATOR_KIND_UDPV6"; - rtps_util_format_ipv6(addr, &addr_buff[0], MAX_IPV6_SIZE); - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, - "IPv6: { addr=%s, port=%d }", - addr_buff, - port); - break; - - case LOCATOR_KIND_INVALID: - kind_string = "LOCATOR_KIND_INVALID"; - - case LOCATOR_KIND_RESERVED: - if (!kind_string) /* Need to guard overrides (no break before) */ - kind_string = "LOCATOR_KIND_RESERVED"; - - default: - if (!kind_string) /* Need to guard overrides (no break before) */ - kind_string = "(unknown)"; - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, - "{ kind=%02x, port=%d, addr=%02x %02x %02x ... %02x %02x }", - kind, - port, - addr[0], - addr[1], - addr[2], - /* ... */ - addr[14], - addr[15]); - } - - ti = proto_tree_add_text(tree, - tvb, - offset, - 24, - "%s: %s", - label, - temp_buff); - - locator_tree = proto_item_add_subtree(ti, - ett_rtps_locator); - proto_tree_add_text(locator_tree, - tvb, - offset, - 4, - "kind: %02x (%s)", - kind, - kind_string); - proto_tree_add_text(locator_tree, - tvb, - offset+4, - 4, - "port: %d%s", - port, - (port == 0) ? " (PORT_INVALID)" : ""); - proto_tree_add_text(locator_tree, - tvb, - offset + 8, - 16, - "address: %s", - addr_buff); - if (buffer) { - g_strlcpy(buffer, temp_buff, buffer_size); + if (kind == LOCATOR_KIND_UDPV4) { + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv4, tvb, offset+20, 4, ENC_BIG_ENDIAN); + } else { + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv6, tvb, offset+8, 16, ENC_NA); } } @@ -828,96 +698,63 @@ static void rtps_util_add_locator_t(proto_tree *tree, /* Can NOT be NULL */ * - locator 2 * - ... * - locator n + * Returns the new offset after parsing the locator list */ -static void rtps_util_add_locator_list(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - const guint8 * label, - gboolean little_endian) { +int rtps_util_add_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, const guint8* label, gboolean little_endian) { proto_item *ti; proto_tree *locator_tree; guint32 num_locators; num_locators = NEXT_guint32(tvb, offset, little_endian); - ti = proto_tree_add_text(tree, + if (tree) { + ti = proto_tree_add_text(tree, tvb, offset, 4, "%s: %d Locators", label, num_locators); - + } else { + return offset + 4 + ((num_locators > 0) ? (24 * num_locators) : 0); + } + offset += 4; if (num_locators > 0) { guint32 i; char temp_buff[20]; - locator_tree = proto_item_add_subtree(ti, - ett_rtps_locator_udp_v4); + locator_tree = proto_item_add_subtree(ti, ett_rtps_locator_udp_v4); for (i = 0; i < num_locators; ++i) { g_snprintf(temp_buff, 20, "Locator[%d]", i); rtps_util_add_locator_t(locator_tree, + pinfo, tvb, - offset + 4 + (i * 24), + offset, little_endian, - temp_buff, - NULL, - 0); + temp_buff); + offset += 24; } } + return offset; } /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next 4 bytes interpreted as IPV4Address_t */ -static void rtps_util_add_ipv4_address_t(proto_tree *tree, /* Can be NULL */ - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const guint8 * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ +void rtps_util_add_ipv4_address_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, gint offset, + gboolean little_endian, int hf_item) { guint32 addr; + proto_item* ti; addr = NEXT_guint32(tvb, offset, little_endian); - if (addr == IPADDRESS_INVALID) { - if (buffer) { - g_strlcpy(buffer, IPADDRESS_INVALID_STRING, buffer_size); - } - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - IPADDRESS_INVALID_STRING); - } - } else { - if (buffer) { - g_snprintf(buffer, buffer_size, - "%d.%d.%d.%d", - (addr >> 24) & 0xff, - (addr >> 16) & 0xff, - (addr >> 8) & 0xff, - addr & 0xff); - } - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %d.%d.%d.%d", - label, - (addr >> 24) & 0xff, - (addr >> 16) & 0xff, - (addr >> 8) & 0xff, - addr & 0xff); - } - } + + ti = proto_tree_add_ipv4(tree, hf_item, tvb, offset, 4, addr); + if (addr == IPADDRESS_INVALID) + expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, IPADDRESS_INVALID_STRING); } @@ -932,50 +769,23 @@ static void rtps_util_add_ipv4_address_t(proto_tree *tree, /* Can be NULL */ * } LocatorUDPv4_t; * */ -static void rtps_util_add_locator_udp_v4(proto_tree *tree, /* Can NOT be NULL */ - tvbuff_t * tvb, - gint offset, - const guint8 * label, - gboolean little_endian) { +void rtps_util_add_locator_udp_v4(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, const guint8 * label, gboolean little_endian) { proto_item * ti; proto_tree * locator_tree; guint32 port; - char portLabel[MAX_PORT_SIZE]; - char addr[MAX_IPV4_ADDRESS_SIZE]; - - port = NEXT_guint32(tvb, offset+4, little_endian); - - if (port == PORT_INVALID) { - g_snprintf(portLabel, MAX_PORT_SIZE, "%s (0x00000000)", PORT_INVALID_STRING); - } else { - g_snprintf(portLabel, MAX_PORT_SIZE, "%u", port); - } - ti = proto_tree_add_text(tree, - tvb, - offset, - 8, - "addr"); /* Add text later */ + ti = proto_tree_add_text(tree, tvb, offset, 8, "%s", label); locator_tree = proto_item_add_subtree(ti, ett_rtps_locator_udp_v4); - rtps_util_add_ipv4_address_t(locator_tree, - tvb, - offset, - little_endian, - "address", - addr, - MAX_IPV4_ADDRESS_SIZE); - proto_tree_add_text(locator_tree, - tvb, - offset + 4, - 4, - "port: %s", - portLabel); - proto_item_set_text(ti, "%s: { address=%s, port=%s }", - label, - addr, - portLabel); + rtps_util_add_ipv4_address_t(locator_tree, pinfo, tvb, offset, + little_endian, hf_rtps_locator_udp_v4); + + port = NEXT_guint32(tvb, offset+4, little_endian); + ti = proto_tree_add_uint(locator_tree, hf_rtps_locator_udp_v4_port, tvb, offset, 4, port); + if (port == PORT_INVALID) + expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, PORT_INVALID_STRING); } @@ -999,109 +809,41 @@ static void rtps_util_add_guid_prefix(proto_tree *tree, /* Can be NULL */ int hf_app_id, int hf_app_id_instance_id, int hf_app_id_app_kind, - const guint8 * label, /* Can be NULL */ - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint32 host_id; - guint32 app_id; - guint32 instance_id; + const guint8 * label) { + guint64 prefix; + guint32 host_id, app_id, instance_id; guint8 app_kind; - guint8 * temp_buff; - guint8 guid_prefix[8]; - const guint8 * safe_label; - int i; - - safe_label = (label == NULL) ? (const guint8 *)"guidPrefix" : label; + proto_item *ti; + proto_tree *guid_tree, *appid_tree; + const guint8 * safe_label = (label == NULL) ? (const guint8 *)"guidPrefix" : label; /* Read values from TVB */ + prefix = tvb_get_ntoh64(tvb, offset); host_id = tvb_get_ntohl(tvb, offset); app_id = tvb_get_ntohl(tvb, offset + 4); - for (i = 0; i < 8; ++i) { - guid_prefix[i] = tvb_get_guint8(tvb, offset+i); - } instance_id = (app_id >> 8); app_kind = (app_id & 0xff); - /* Format the string */ - temp_buff = (guint8 *)ep_alloc(MAX_GUID_PREFIX_SIZE); - g_snprintf(temp_buff, MAX_GUID_PREFIX_SIZE, - "%s=%02x%02x%02x%02x %02x%02x%02x%02x" - " { hostId=%08x, appId=%08x" - " (%s: %06x) }", - safe_label, - guid_prefix[0], - guid_prefix[1], - guid_prefix[2], - guid_prefix[3], - guid_prefix[4], - guid_prefix[5], - guid_prefix[6], - guid_prefix[7], - host_id, - app_id, + if (tree != NULL) { + ti = proto_tree_add_uint64_format(tree, hf_prefix, tvb, offset, 8, prefix, + "%s=%08x %08x { hostId=%08x, appId=%08x (%s: %06x) }", + safe_label, host_id, app_id, host_id, app_id, val_to_str(app_kind, app_kind_vals, "%02x"), instance_id); - if (tree != NULL) { - proto_item * ti, *hidden_item; - proto_tree * guid_tree; - proto_tree * appid_tree; - - /* The numeric value (used for searches) */ - hidden_item = proto_tree_add_item(tree, - hf_prefix, - tvb, - offset, - 8, - ENC_NA); - PROTO_ITEM_SET_HIDDEN(hidden_item); - - /* The text node (root of the guid prefix sub-tree) */ - ti = proto_tree_add_text(tree, - tvb, - offset, - 8, "%s", - temp_buff); - - guid_tree = proto_item_add_subtree(ti, - ett_rtps_guid_prefix); + guid_tree = proto_item_add_subtree(ti, ett_rtps_guid_prefix); /* Host Id */ - proto_tree_add_item(guid_tree, - hf_host_id, - tvb, - offset, - 4, - ENC_BIG_ENDIAN); + proto_tree_add_item(guid_tree, hf_host_id, tvb, offset, 4, ENC_BIG_ENDIAN); - /* AppId (root of the app_id sub-tree */ - ti = proto_tree_add_item(guid_tree, - hf_app_id, - tvb, - offset+4, - 4, - ENC_BIG_ENDIAN); - appid_tree = proto_item_add_subtree(ti, - ett_rtps_app_id); + /* AppId (root of the app_id sub-tree) */ + ti = proto_tree_add_item(guid_tree, hf_app_id, tvb, offset+4, 4, ENC_BIG_ENDIAN); + appid_tree = proto_item_add_subtree(ti, ett_rtps_app_id); /* InstanceId */ - proto_tree_add_item(appid_tree, - hf_app_id_instance_id, - tvb, - offset+4, - 3, - ENC_BIG_ENDIAN); + proto_tree_add_item(appid_tree, hf_app_id_instance_id, tvb, offset+4, 3, ENC_BIG_ENDIAN); /* AppKind */ - proto_tree_add_item(appid_tree, - hf_app_id_app_kind, - tvb, - offset+7, - 1, - ENC_BIG_ENDIAN); - } - - if (buffer != NULL) { - g_strlcpy(buffer, temp_buff, buffer_size); + proto_tree_add_item(appid_tree, hf_app_id_app_kind, tvb, offset+7, 1, ENC_BIG_ENDIAN); } } @@ -1113,15 +855,9 @@ static void rtps_util_add_guid_prefix(proto_tree *tree, /* Can be NULL */ * sub-components), as well as the label identifying it. * Returns true if the entityKind is one of the NDDS built-in entities. */ -static int rtps_util_add_entity_id(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - int hf_item, - int hf_item_entity_key, - int hf_item_entity_kind, - int subtree_entity_id, - const char *label, - guint32 * entity_id_out) { /* Can be NULL */ +int rtps_util_add_entity_id(proto_tree *tree, tvbuff_t * tvb, gint offset, + int hf_item, int hf_item_entity_key, int hf_item_entity_kind, + int subtree_entity_id, const char *label, guint32* entity_id_out) { guint32 entity_id = tvb_get_ntohl(tvb, offset); guint32 entity_key = (entity_id >> 8); guint8 entity_kind = (entity_id & 0xff); @@ -1131,53 +867,27 @@ static int rtps_util_add_entity_id(proto_tree *tree, *entity_id_out = entity_id; } - if (tree != NULL) { proto_tree * entity_tree; proto_item * ti; if (str_predef == NULL) { /* entityId is not a predefined value, format it */ - ti = proto_tree_add_uint_format(tree, - hf_item, - tvb, - offset, - 4, - entity_id, + ti = proto_tree_add_uint_format(tree, hf_item, tvb, offset, 4, entity_id, "%s: 0x%08x (%s: 0x%06x)", - label, - entity_id, - val_to_str(entity_kind, entity_kind_vals, - "unknown (%02x)"), + label, entity_id, + val_to_str(entity_kind, entity_kind_vals, "unknown kind (%02x)"), entity_key); } else { /* entityId is a predefined value */ - ti = proto_tree_add_uint_format(tree, - hf_item, - tvb, - offset, - 4, - entity_id, + ti = proto_tree_add_uint_format(tree, hf_item, tvb, offset, 4, entity_id, "%s: %s (0x%08x)", label, str_predef, entity_id); } - entity_tree = proto_item_add_subtree(ti, - subtree_entity_id); - - proto_tree_add_item(entity_tree, - hf_item_entity_key, - tvb, - offset, - 3, - ENC_BIG_ENDIAN); - - proto_tree_add_item(entity_tree, - hf_item_entity_kind, - tvb, - offset+3, - 1, - ENC_BIG_ENDIAN); + entity_tree = proto_item_add_subtree(ti, subtree_entity_id); + proto_tree_add_item(entity_tree, hf_item_entity_key, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(entity_tree, hf_item_entity_kind, tvb, offset+3, 1, ENC_BIG_ENDIAN); } /* is a built-in entity if the bit M and R (5 and 6) of the entityKind are set */ @@ -1197,7 +907,7 @@ static int rtps_util_add_entity_id(proto_tree *tree, * to any protocol field). It simply insert the content as a simple text entry * and returns in the passed buffer only the value (without the label). */ -static void rtps_util_add_generic_entity_id(proto_tree *tree, +void rtps_util_add_generic_entity_id(proto_tree *tree, tvbuff_t * tvb, gint offset, const char *label, @@ -1310,24 +1020,18 @@ static void rtps_util_add_generic_guid(proto_tree *tree, /* Canno /* Insert in the protocol tree the next 8 bytes interpreted as sequence * number. */ -static guint64 rtps_util_add_seq_number(proto_tree *tree, +guint64 rtps_util_add_seq_number(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - const char *label _U_) { + const char *label) { guint64 hi = (guint64)NEXT_guint32(tvb, offset, little_endian); guint64 lo = (guint64)NEXT_guint32(tvb, offset+4, little_endian); guint64 all = (hi << 32) | lo; - if (tree != NULL) { - proto_tree_add_int64_format(tree, - hf_rtps_sm_seq_number, - tvb, - offset, - 8, - all, - "%s: %" G_GINT64_MODIFIER "u", label, all); - } + proto_tree_add_int64_format(tree, hf_rtps_sm_seq_number, tvb, offset, 8, + all, "%s: %" G_GINT64_MODIFIER "u", label, all); + return all; } @@ -1335,64 +1039,22 @@ static guint64 rtps_util_add_seq_number(proto_tree *tree, /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next 8 bytes interpreted as NtpTime */ -static void rtps_util_add_ntp_time(proto_tree *tree, /* Can be NULL */ +void rtps_util_add_ntp_time(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - const char * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint8 tempBuffer[MAX_NTP_TIME_SIZE]; - - gint32 sec = NEXT_guint32(tvb, offset, little_endian); - guint32 frac = NEXT_guint32(tvb, offset+4, little_endian); - double absolute; + int hf_time) { - if ((sec == 0x7fffffff) && (frac == 0xffffffff)) { - g_strlcpy(tempBuffer, "INFINITE", MAX_NTP_TIME_SIZE); - } else if ((sec == 0) && (frac == 0)) { - g_strlcpy(tempBuffer, "0 sec", MAX_NTP_TIME_SIZE); - } else { - absolute = (double)sec + (double)frac / ((double)(0x80000000) * 2.0); - g_snprintf(tempBuffer, MAX_NTP_TIME_SIZE, - "%f sec (%ds + 0x%08x)", absolute, sec, frac); - } - if (tree != NULL) { - proto_item * ti; - proto_tree *time_tree; + proto_tree_add_item(tree, hf_time, tvb, offset, 8, + ENC_TIME_NTP|(little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN)); - ti = proto_tree_add_none_format(tree, - hf_rtps_param_ntpt, - tvb, - offset, - 8, - "%s: %s", - label, - tempBuffer); - time_tree = proto_item_add_subtree(ti, ett_rtps_ntp_time); - proto_tree_add_item(time_tree, - hf_rtps_param_ntpt_sec, - tvb, - offset, - 4, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - proto_tree_add_item(time_tree, - hf_rtps_param_ntpt_fraction, - tvb, - offset+4, - 4, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - } - if (buffer != NULL) { - g_strlcpy(buffer, tempBuffer, buffer_size); - } } /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next data interpreted as a String * Returns the new offset (after reading the string) */ -static gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */ +gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, int hf_item, /* Can be -1 (if label!=NULL) */ @@ -1445,113 +1107,18 @@ static gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */ return offset + 4 + ((size + 3) & 0xfffffffc); } - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a signed long. - */ -static void rtps_util_add_long(proto_tree *tree, /* Can be NULL */ - tvbuff_t * tvb, - gint offset, - int hf_item, /* Can be -1 */ - gboolean little_endian, - gboolean is_hex, /* Format as 0x... */ - gboolean is_signed, /* Signed/Unsigned */ - const char *label, /* Can be NULL */ - guint8 * buffer, - size_t buffer_size) { - - char temp_buff[16]; - - g_snprintf(temp_buff, 16, - (is_hex ? "0x%08x" : (is_signed ? "%d" : "%u")), - NEXT_guint32(tvb, offset, little_endian)); - if (tree != NULL) { - if (hf_item != -1) { - proto_tree_add_item(tree, - hf_item, - tvb, - offset, - 4, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - } else if (label != NULL) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - temp_buff); - } - } - if (buffer != NULL) { - g_strlcpy(buffer, temp_buff, (gulong) buffer_size); - } -} - /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next data interpreted as a port (unsigned * 32-bit integer) */ -static void rtps_util_add_port(proto_tree *tree, /* Can be NULL */ - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char *label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint8 tempBuffer[MAX_PORT_SIZE]; - guint32 value = NEXT_guint32(tvb, offset, little_endian); - - if (value == PORT_INVALID) { - g_snprintf(buffer, buffer_size, "%s (0x00000000)", PORT_INVALID_STRING); - } else { - g_snprintf(tempBuffer, MAX_PORT_SIZE, "%u", value); - } - - if (tree != NULL) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - tempBuffer); - } - if (buffer != NULL) { - g_strlcpy(buffer, tempBuffer, buffer_size); - } -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a boolean - * Returns the pointer to a dynamically allocated buffer containing the - * formatted version of the value. - */ -static void rtps_util_add_boolean(proto_tree *tree, /* Can be NULL */ - tvbuff_t * tvb, - gint offset, - const char *label, - guint8 * buffer, /* Can be NULL */ - size_t buffer_size) { - const char *str; - guint8 value = tvb_get_guint8(tvb, offset); - - str = value ? "TRUE" : "FALSE"; - - if (buffer) { - g_strlcpy(buffer, str, (gulong) buffer_size); - } - - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 1, - "%s: %s", - label, - str); - } +void rtps_util_add_port(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, gboolean little_endian, int hf_item) { + proto_item* ti; + guint32 port = NEXT_guint32(tvb, offset+4, little_endian); + + ti = proto_tree_add_uint(tree, hf_item, tvb, offset, 4, port); + if (port == PORT_INVALID) + expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, PORT_INVALID_STRING); } @@ -1559,156 +1126,53 @@ static void rtps_util_add_boolean(proto_tree *tree, /* Can be NULL */ /* Insert in the protocol tree the next bytes interpreted as * DurabilityServiceQosPolicy */ -static void rtps_util_add_durability_service_qos(proto_tree *tree, +void rtps_util_add_durability_service_qos(proto_tree *tree, tvbuff_t * tvb, gint offset, - gboolean little_endian, - guint8 * buffer, - gint buffer_size) { - guint8 temp_buffer[MAX_NTP_TIME_SIZE]; - gint32 kind = NEXT_guint32(tvb, offset+8, little_endian); - gint32 history_depth = NEXT_guint32(tvb, offset+12, little_endian); - gint32 max_samples = NEXT_guint32(tvb, offset+16, little_endian); - gint32 max_instances = NEXT_guint32(tvb, offset+20, little_endian); - gint32 max_spi = NEXT_guint32(tvb, offset+24, little_endian); - - rtps_util_add_ntp_time(NULL, - tvb, - offset, - little_endian, - NULL, - temp_buffer, - MAX_NTP_TIME_SIZE); - - g_snprintf(buffer, buffer_size, - "{ service_cleanup_delay=%s, history_kind='%s', " - "history_depth=%d, max_samples=%d, max_instances=%d, " - "max_samples_per_instances=%d }", - temp_buffer, - val_to_str(kind, history_qos_vals, "0x%08x"), - history_depth, - max_samples, - max_instances, - max_spi); - - rtps_util_add_ntp_time(tree, - tvb, - offset, - little_endian, - "service_cleanup_delay", - NULL, - 0); - proto_tree_add_text(tree, - tvb, - offset+8, - 4, - "history_kind: %s", - val_to_str(kind, history_qos_vals, "0x%08x")); - proto_tree_add_text(tree, - tvb, - offset+12, - 4, - "history_depth: %d", - history_depth); - proto_tree_add_text(tree, - tvb, - offset+16, - 4, - "max_samples: %d", - max_samples); - proto_tree_add_text(tree, - tvb, - offset+20, - 4, - "max_instances: %d", - max_instances); - proto_tree_add_text(tree, - tvb, - offset+24, - 4, - "max_samples_per_instances: %d", - max_spi); - + gboolean little_endian) { + proto_item *ti; + proto_tree *subtree; + + ti = proto_tree_add_text(tree, tvb, offset, 28, "PID_DURABILITY_SERVICE"); + subtree = proto_item_add_subtree(ti, ett_rtps_durability_service); + + rtps_util_add_ntp_time(subtree, tvb, offset, little_endian, hf_rtps_durability_service_cleanup_delay); + proto_tree_add_item(subtree, hf_rtps_durability_service_history_kind, tvb, offset+8, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_durability_service_history_depth, tvb, offset+12, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_durability_service_max_samples, tvb, offset+16, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_durability_service_max_instances, tvb, offset+20, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_durability_service_max_samples_per_instances, tvb, offset+24, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); } /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next bytes interpreted as Liveliness * QoS Policy structure. */ -static void rtps_util_add_liveliness_qos(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - guint8 * buffer, - gint buffer_size) { - guint8 temp_buffer[MAX_NTP_TIME_SIZE]; - guint32 kind = NEXT_guint32(tvb, offset, little_endian); +void rtps_util_add_liveliness_qos(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian) { - rtps_util_add_ntp_time(NULL, - tvb, - offset+4, - little_endian, - NULL, - temp_buffer, - MAX_NTP_TIME_SIZE); - - g_snprintf(buffer, buffer_size, - "{ kind=%s, lease_duration=%s }", - val_to_str(kind, liveliness_qos_vals, "0x%08x"), - temp_buffer); - - proto_tree_add_text(tree, - tvb, - offset, - 4, - "kind: %s", - val_to_str(kind, liveliness_qos_vals, "0x%08x")); - rtps_util_add_ntp_time(tree, - tvb, - offset+4, - little_endian, - "lease_duration", - NULL, - 0); -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as enum type. - */ -static void rtps_util_add_kind_qos(proto_tree *tree, /* Can be NULL */ - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char *label, - const value_string *vals, - guint8 * buffer, /* Can be NULL */ - size_t buffer_size) { - guint32 kind = NEXT_guint32(tvb, offset, little_endian); + proto_item *ti; + proto_tree *subtree; - if (buffer) { - g_strlcpy(buffer, val_to_str(kind, vals, "0x%08x"), - (gulong) buffer_size); - } + ti = proto_tree_add_text(tree, tvb, offset, 12, "PID_LIVELINESS"); + subtree = proto_item_add_subtree(ti, ett_rtps_liveliness); - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - buffer); - } + proto_tree_add_item(subtree, hf_rtps_liveliness_kind, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + rtps_util_add_ntp_time(subtree, tvb, offset+4, little_endian, hf_rtps_liveliness_lease_duration); } - /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next bytes interpreted as Sequence of * Strings. * The formatted buffer is: "string1", "string2", "string3", ... * Returns the new updated offset */ -static gint rtps_util_add_seq_string(proto_tree *tree, /* Can NOT be NULL */ +gint rtps_util_add_seq_string(proto_tree *tree, /* Can NOT be NULL */ tvbuff_t * tvb, gint offset, gboolean little_endian, @@ -1771,55 +1235,24 @@ static gint rtps_util_add_seq_string(proto_tree *tree, /* Can NOT be NULL */ * The formatted buffer is: val1, val2, val3, ... * Returns the new updated offset */ -static gint rtps_util_add_seq_ulong(proto_tree *tree, /* Can NOT be NULL */ - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - int param_length, - int is_hex, - int is_signed, - const char *label) { +gint rtps_util_add_seq_ulong(proto_tree *tree, tvbuff_t * tvb, gint offset, int hf_item, + gboolean little_endian, int param_length, const char *label) { guint32 num_elem; guint32 i; proto_tree *string_tree; proto_item *ti; - char temp_buff[MAX_LABEL_SIZE]; - char overview_buff[MAX_PARAM_SIZE]; num_elem = NEXT_guint32(tvb, offset, little_endian); offset += 4; /* Create the string node with an empty string, the replace it later */ - ti = proto_tree_add_text(tree, - tvb, - offset, - param_length-8, - "Seq"); + ti = proto_tree_add_text(tree, tvb, offset, num_elem*4, "%s (%d elements)", label, num_elem); string_tree = proto_item_add_subtree(ti, ett_rtps_seq_ulong); - overview_buff[0] = '\0'; - for (i = 0; i < num_elem; ++i) { - g_snprintf(temp_buff, MAX_LABEL_SIZE, - "%s[%d]", - label, - i); - rtps_util_add_long( string_tree, - tvb, - offset, - -1, - little_endian, - is_hex, - is_signed, - temp_buff, - overview_buff+strlen(overview_buff), - MAX_PARAM_SIZE-strlen(overview_buff)); + proto_tree_add_item(tree, hf_item, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); offset += 4; } - proto_item_set_text(ti, - "%s: %s", - label, - overview_buff); return offset; } @@ -2525,68 +1958,23 @@ static gint rtps_util_add_typecode(proto_tree *tree, * The maximum number of elements displayed is 10, after that a '...' is * inserted. */ -static void rtps_util_add_seq_octets(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - int param_length, - int hf_id, - guint8 * buffer, - gint buffer_size) { - gint idx = 0; +void rtps_util_add_seq_octets(proto_tree *tree, packet_info *pinfo, tvbuff_t* tvb, + gint offset, gboolean little_endian, int param_length, int hf_id) { guint32 seq_length; - guint32 i; - gint original_offset = offset; - guint32 original_seq_length; + proto_item *ti; - original_seq_length = seq_length = NEXT_guint32(tvb, offset, little_endian); + seq_length = NEXT_guint32(tvb, offset, little_endian); + + ti = proto_tree_add_text(tree, tvb, offset, 4, "sequenceSize: %d octects", seq_length); offset += 4; if (param_length < 4 + (int)seq_length) { - g_strlcpy(buffer, - "RTPS PROTOCOL ERROR: parameter value too small", - buffer_size); - proto_tree_add_text(tree, - tvb, - offset, - param_length, "%s", - buffer); - return ; - } - - /* Limit the number of octects displayed to MAX_SEQ_OCTETS_PRINTED */ - if (seq_length > MAX_SEQ_OCTETS_PRINTED) { - seq_length = MAX_SEQ_OCTETS_PRINTED; - } - for (i = 0; i < seq_length; ++i) { - idx += g_snprintf(&buffer[idx], - buffer_size - idx - 1, - "%02x", - tvb_get_guint8(tvb, offset++)); - if (idx >= buffer_size) { - break; - } - } - if (seq_length != original_seq_length) { - /* seq_length was reduced, add '...' */ - g_strlcat(buffer, "...", buffer_size); + expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "ERROR: Parameter value too small"); + return; } - if (tree != NULL) { - proto_tree_add_text(tree, - tvb, - original_offset, - 4, - "sequenceSize: %d octects", - original_seq_length); - proto_tree_add_item(tree, - hf_id, - tvb, - original_offset+4, - original_seq_length, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - - } + proto_tree_add_item(tree, hf_id, tvb, offset+4, seq_length, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); } @@ -2757,48 +2145,36 @@ static void rtps_util_decode_flags(proto_tree * tree, * current packet). * If no error occurred, the returned value is ALWAYS > than the offset passed. */ -#define ENSURE_LENGTH(size) \ - if (param_length < size) { \ - proto_tree_add_text(rtps_parameter_tree, \ - tvb, offset, param_length, \ - "RTPS PROTOCOL ERROR: parameter value too small"\ - " (must be at least %d octects)", size); \ - break; \ +#define ENSURE_LENGTH(size) \ + if (param_length < size) { \ + expert_add_info_format(pinfo, param_len_item, PI_PROTOCOL, PI_WARN, \ + "ERROR: parameter value too small (must be at least %d octects)", size); \ + break; \ } static gint dissect_parameter_sequence(proto_tree *tree, + packet_info *pinfo, tvbuff_t *tvb, gint offset, gboolean little_endian, int octects_to_next_header, const char * label) { - proto_item * ti; - proto_tree * rtps_parameter_sequence_tree; - proto_tree * rtps_parameter_tree; + proto_item *ti, *param_item, *param_len_item = NULL; + proto_tree *rtps_parameter_sequence_tree, *rtps_parameter_tree, *subtree; guint16 parameter, param_length; guint8 buffer[MAX_PARAM_SIZE]; gint max_param_section = offset + octects_to_next_header; buffer[0] = '\0'; - ti = proto_tree_add_text(tree, - tvb, - offset, - -1, - "%s:", label); - rtps_parameter_sequence_tree = proto_item_add_subtree(ti, - ett_rtps_parameter_sequence); - + ti = proto_tree_add_text(tree, tvb, offset, -1, "%s:", label); + rtps_parameter_sequence_tree = proto_item_add_subtree(ti, ett_rtps_parameter_sequence); /* Loop through all the parameters defined until PID_SENTINEL is found */ do { if (max_param_section-offset < 4) { - proto_tree_add_text(tree, - tvb, - offset, - 1, - "RTPS PROTOCOL ERROR: not enough bytes to read " - " the next parameter"); + expert_add_info_format(pinfo, (param_len_item == NULL) ? ti : param_len_item, + PI_PROTOCOL, PI_WARN, "ERROR: not enough bytes to read the next parameter"); return 0; } @@ -2807,30 +2183,17 @@ static gint dissect_parameter_sequence(proto_tree *tree, * be set later... */ parameter = NEXT_guint16(tvb, offset, little_endian); - ti = proto_tree_add_text(rtps_parameter_sequence_tree, - tvb, - offset, - -1, - "%s", - val_to_str(parameter, parameter_id_vals, - "Unknown (0x%04x)")); - rtps_parameter_tree = proto_item_add_subtree(ti, ett_rtps_parameter); - proto_tree_add_uint_format(rtps_parameter_tree, - hf_rtps_parameter_id, - tvb, - offset, - 2, - parameter, - "parameterId: 0x%04x (%s)", - parameter, - val_to_str(parameter, parameter_id_vals, - "unknown %04x")); + param_item = proto_tree_add_text(rtps_parameter_sequence_tree, tvb, offset, -1, + "%s", val_to_str(parameter, parameter_id_vals, "Unknown (0x%04x)")); + rtps_parameter_tree = proto_item_add_subtree(param_item, ett_rtps_parameter); + proto_tree_add_uint(rtps_parameter_tree, hf_rtps_parameter_id, + tvb, offset, 2, parameter); offset += 2; /* parameter length */ param_length = NEXT_guint16(tvb, offset, little_endian); - proto_tree_add_item(rtps_parameter_tree, + param_len_item = proto_tree_add_item(rtps_parameter_tree, hf_rtps_parameter_length, tvb, offset, @@ -2841,17 +2204,12 @@ static gint dissect_parameter_sequence(proto_tree *tree, /* Make sure we have enough bytes for the param value */ if ((max_param_section-offset < param_length) && (parameter != PID_SENTINEL)) { - proto_tree_add_text(tree, - tvb, - offset, - 1, - "RTPS PROTOCOL ERROR: not enough bytes to read " - " the parameter value"); + expert_add_info_format(pinfo, param_len_item, PI_PROTOCOL, PI_WARN, "Not enough bytes to read the parameter value"); return 0; } /* Sets the end of this item (now we know it!) */ - proto_item_set_len(ti, param_length+4); + proto_item_set_len(param_item, param_length+4); switch(parameter) { @@ -2866,13 +2224,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_PARTICIPANT_LEASE_DURATION: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, + little_endian, hf_rtps_participant_lease_duration); break; @@ -2887,13 +2240,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_TIME_BASED_FILTER: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "minimum_separation", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, + little_endian, hf_rtps_time_based_filter_minimum_separation); break; /* 0...2...........7...............15.............23...............31 @@ -2928,16 +2276,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_OWNERSHIP_STRENGTH: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - hf_rtps_param_strength, - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - NULL, /* No Label, use the protocol item ID */ - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_strength, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -2975,32 +2314,22 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_METATRAFFIC_UNICAST_PORT: case PID_DEFAULT_UNICAST_PORT: ENSURE_LENGTH(4); - rtps_util_add_port(rtps_parameter_tree, - tvb, - offset, - little_endian, - "port", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_port(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, hf_rtps_param_port); break; /* 0...2...........7...............15.............23...............31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | PID_DEFAULT_EXPECTS_INLINE_QOS| 0x0004 | + * | PID_EXPECTS_INLINE_QOS | 0x0004 | * +---------------+---------------+---------------+---------------+ * | boolean | N O T U S E D | * +---------------+---------------+---------------+---------------+ */ - case PID_DEFAULT_EXPECTS_INLINE_QOS: + case PID_EXPECTS_INLINE_QOS: ENSURE_LENGTH(1); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset, - "inline_qos", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_expects_inline_qos, tvb, offset, 1, ENC_NA ); break; /* 0...2...........7...............15.............23...............31 @@ -3014,13 +2343,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_DEFAULT_UNICAST_IPADDRESS: case PID_MULTICAST_IPADDRESS: case PID_METATRAFFIC_UNICAST_IPADDRESS: - rtps_util_add_ipv4_address_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "address", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ipv4_address_t(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, hf_param_ip_address); break; @@ -3033,19 +2357,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, * +---------------+---------------+---------------+---------------+ */ case PID_PROTOCOL_VERSION: { - guint8 major = 0; - guint8 minor = 0; - ENSURE_LENGTH(2); - major = tvb_get_guint8(tvb, offset); - minor = tvb_get_guint8(tvb, offset+1); - g_snprintf(buffer, MAX_PARAM_SIZE, "%d.%d", major, minor); - proto_tree_add_text(rtps_parameter_tree, - tvb, - offset, - param_length, - "protocolVersion: %s", - buffer); + rtps_util_add_protocol_version(rtps_parameter_tree, tvb, offset); break; } @@ -3058,18 +2371,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_VENDOR_ID: ENSURE_LENGTH(2); - rtps_util_add_vendor_id(NULL, - tvb, - offset, - buffer, - MAX_PARAM_SIZE); - proto_tree_add_text(rtps_parameter_tree, - tvb, - offset, - 2, - "vendorId: %s", - buffer); - + rtps_util_add_vendor_id(NULL, tvb, offset); break; @@ -3083,27 +2385,16 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_RELIABILITY_OFFERED: /* Deprecated */ case PID_RELIABILITY: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - reliability_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_reliability_kind, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); /* Older version of the protocol (and for PID_RELIABILITY_OFFERED) * this parameter was carrying also a NtpTime called * 'maxBlockingTime'. */ if (octects_to_next_header == 12) { - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset + 4, - little_endian, - "maxBlockingTime", - NULL, - 0); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset + 4, + little_endian, hf_rtps_reliability_max_blocking_time); } break; @@ -3124,12 +2415,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_LIVELINESS_OFFERED: /* Deprecated */ case PID_LIVELINESS: ENSURE_LENGTH(12); - rtps_util_add_liveliness_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_liveliness_qos(rtps_parameter_tree, tvb, offset, little_endian); break; @@ -3142,14 +2428,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DURABILITY: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "durability", - durability_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_durability, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -3173,12 +2453,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DURABILITY_SERVICE: ENSURE_LENGTH(28); - rtps_util_add_durability_service_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_durability_service_qos(rtps_parameter_tree, tvb, offset, little_endian); break; @@ -3192,14 +2467,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_OWNERSHIP_OFFERED: /* Deprecated */ case PID_OWNERSHIP: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - ownership_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_ownership, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -3215,30 +2484,10 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_PRESENTATION_OFFERED: /* Deprecated */ case PID_PRESENTATION: ENSURE_LENGTH(6); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "access_scope", - presentation_qos_vals, - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset+4, - "coherent_access", - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset+4, - "ordered_access", - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_access_scope, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_coherent_access, tvb, offset+4, 1, ENC_NA ); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_ordered_access, tvb, offset+5, 1, ENC_NA ); break; @@ -3254,13 +2503,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_DEADLINE_OFFERED: /* Deprecated */ case PID_DEADLINE: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "period", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, + little_endian, hf_rtps_deadline_period); break; /* 0...2...........7...............15.............23...............31 @@ -3273,14 +2517,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_DESTINATION_ORDER_OFFERED: /* Deprecated */ case PID_DESTINATION_ORDER: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - destination_order_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_destination_order, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -3296,13 +2534,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_LATENCY_BUDGET_OFFERED: case PID_LATENCY_BUDGET: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, + little_endian, hf_rtps_latency_budget_duration); break; @@ -3344,14 +2577,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_LIFESPAN: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, + little_endian, hf_rtps_lifespan_duration); break; /* 0...2...........7...............15.............23...............31 @@ -3367,15 +2594,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_USER_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_user_data, - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_user_data); break; /* 0...2...........7...............15.............23...............31 @@ -3391,14 +2611,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_GROUP_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_group_data, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_group_data); break; /* 0...2...........7...............15.............23...............31 @@ -3414,14 +2628,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_TOPIC_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_topic_data, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_topic_data); break; /* 0...2...........7...............15.............23...............31 @@ -3443,14 +2651,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, + offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -3472,14 +2674,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_MULTICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, + offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -3501,14 +2697,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DEFAULT_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, + offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -3530,14 +2720,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_METATRAFFIC_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, + offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -3559,14 +2743,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_METATRAFFIC_MULTICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, + offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -3577,18 +2755,15 @@ static gint dissect_parameter_sequence(proto_tree *tree, * +---------------+---------------+---------------+---------------+ */ case PID_PARTICIPANT_BUILTIN_ENDPOINTS: + ENSURE_LENGTH(4); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_participant_builtin_endpoints, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + break; + case PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, /* No protocol ID, use label below */ - little_endian, - TRUE, /* Is Hex ? */ - FALSE, /* Is Signed ? */ - "value", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_participant_manual_liveliness_count, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -3602,28 +2777,10 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_HISTORY: ENSURE_LENGTH(8); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - history_qos_vals, - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+4, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "depth", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_history_kind, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_history_depth, tvb, offset+4, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -3640,41 +2797,11 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_RESOURCE_LIMIT: ENSURE_LENGTH(12); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_samples", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+4, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_instances", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+8, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_samples_per_instances", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + ti = proto_tree_add_text(rtps_parameter_tree, tvb, offset, 12, "Resource Limit"); + subtree = proto_item_add_subtree(ti, ett_rtps_resource_limit); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_samples, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_instances, tvb, offset+4, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_samples_per_instances, tvb, offset+8, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -3795,7 +2922,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, * }; * */ - case PID_PROPERTY_LIST: + case PID_PROPERTY_LIST_OLD: ENSURE_LENGTH(4); { guint32 prev_offset; @@ -3876,14 +3003,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, ENSURE_LENGTH(8); /* Dissect filter bitmap */ - temp_offset = rtps_util_add_seq_ulong(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - TRUE, /* is_hex */ - FALSE, /* filterSignature: is_signed */ - "filterBitmap"); + temp_offset = rtps_util_add_seq_ulong(rtps_parameter_tree, tvb, offset, + hf_rtps_filter_bitmap, little_endian, param_length, "filterBitmap"); /* Dissect sequence of FILTER_SIGNATURE */ fs_elem = NEXT_guint32(tvb, temp_offset, little_endian); @@ -4045,56 +3166,33 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "persistence", - buffer, - MAX_PARAM_SIZE); + hf_rtps_persistence); break; case PID_TYPE_CHECKSUM: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, - little_endian, - TRUE, /* Is Hex? */ - FALSE, /* Is signed ? */ - "checksum", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_type_checksum, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; case PID_EXPECTS_ACK: ENSURE_LENGTH(1); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset, - "expectsAck", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_expects_ack, tvb, offset, 1, ENC_NA ); break; case PID_MANAGER_KEY: { int i = 0; - char sep = ':'; guint32 manager_key; - buffer[0] = '\0'; + ti = proto_tree_add_text(rtps_parameter_tree, tvb, offset, param_length, "Manager Keys"); + subtree = proto_item_add_subtree(ti, ett_rtps_manager_key); + while (param_length >= 4) { manager_key = NEXT_guint32(tvb, offset, little_endian); - g_snprintf(buffer+strlen(buffer), - MAX_PARAM_SIZE-(gulong) strlen(buffer), - "%c 0x%08x", - sep, - manager_key); - proto_tree_add_text(rtps_parameter_tree, - tvb, - offset, - param_length, - "Key[%d]: 0x%X", i, manager_key); + proto_tree_add_uint_format(subtree, hf_rtps_manager_key, tvb, offset, 4, + manager_key, "Key[%d]: 0x%X", i, manager_key); + ++i; offset +=4; - sep = ','; param_length -= 4; /* decrement count */ } offset += param_length; @@ -4105,16 +3203,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_RECV_QUEUE_SIZE: case PID_SEND_QUEUE_SIZE: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, - little_endian, - TRUE, /* Is Hex? */ - FALSE, /* Is signed ? */ - "queueSize", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_queue_size, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -4159,7 +3248,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, } /* End switch */ if (buffer[0]) { - proto_item_append_text(ti, ": %s", buffer); + proto_item_append_text(param_item, ": %s", buffer); buffer[0] = '\0'; } offset += param_length; @@ -4170,12 +3259,23 @@ static gint dissect_parameter_sequence(proto_tree *tree, #undef ENSURE_LENGTH +gboolean rtps_is_ping(tvbuff_t *tvb, packet_info *pinfo, gint offset) +{ + gboolean is_ping = FALSE; + + if (!tvb_strneql(tvb, offset, "NDDSPING", 8)) + is_ping = TRUE; + + if (is_ping) + col_add_str(pinfo->cinfo, COL_INFO, "PING"); + return is_ping; +} /* *********************************************************************** */ /* * P A D * */ /* *********************************************************************** */ -static void dissect_PAD(tvbuff_t *tvb, +void dissect_PAD(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, @@ -4301,27 +3401,15 @@ static void dissect_DATA(tvbuff_t *tvb, offset += 4; /* readerEntityId */ - is_builtin_entity |= 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); + is_builtin_entity |= 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 */ - is_builtin_entity |= 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", - &wid); + is_builtin_entity |= 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", &wid); offset += 4; /* Checks for predefined declarations @@ -4359,17 +3447,10 @@ static void dissect_DATA(tvbuff_t *tvb, /* If flag H is defined, read the HostId and AppId fields */ if ((flags & FLAG_DATA_H) != 0) { - rtps_util_add_guid_prefix(tree, - tvb, - offset, - hf_rtps_sm_guid_prefix, - hf_rtps_sm_host_id, - hf_rtps_sm_app_id, - hf_rtps_sm_instance_id, - hf_rtps_sm_app_kind, - "keyHashPrefix", - NULL, - 0); + rtps_util_add_guid_prefix(tree, tvb, offset, + hf_rtps_sm_guid_prefix, hf_rtps_sm_host_id, hf_rtps_sm_app_id, + hf_rtps_sm_instance_id, hf_rtps_sm_app_kind, + "keyHashPrefix"); offset += 8; } else { @@ -4398,23 +3479,15 @@ static void dissect_DATA(tvbuff_t *tvb, /* InlineQos */ if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, - octets_to_next_header, - "inlineQos"); + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, + little_endian, octets_to_next_header, "inlineQos"); } /* SerializedData */ if ((flags & FLAG_DATA_D) != 0) { if (is_builtin_entity) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, - octets_to_next_header, - "serializedData"); + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, + little_endian, octets_to_next_header, "serializedData"); } else { proto_tree_add_item(tree, hf_rtps_issue_data, @@ -4542,12 +3615,8 @@ static void dissect_NOKEY_DATA(tvbuff_t *tvb, /* Parameters */ if ((flags & FLAG_NOKEY_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, - octets_to_next_header, - "inlineQos"); + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, + little_endian, octets_to_next_header, "inlineQos"); } @@ -4663,16 +3732,7 @@ static void dissect_ACKNACK(tvbuff_t *tvb, */ if (offset + 4 == original_offset + octets_to_next_header) { /* Count is present */ - rtps_util_add_long(tree, - tvb, - offset, - -1, - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "counter", /* No Label, use the protocol item ID */ - NULL, - 0); + proto_tree_add_item(tree, hf_rtps_acknack_counter, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); } else if (offset < original_offset + octets_to_next_header) { /* In this case there must be something wrong in the bitmap: there * are some extra bytes that we don't know how to decode @@ -4882,27 +3942,15 @@ static void dissect_GAP(tvbuff_t *tvb, offset += 4; /* 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; @@ -4926,7 +3974,7 @@ static void dissect_GAP(tvbuff_t *tvb, /* *********************************************************************** */ /* * I N F O _ T S * */ /* *********************************************************************** */ -static void dissect_INFO_TS(tvbuff_t *tvb, +void dissect_INFO_TS(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, @@ -4981,9 +4029,7 @@ static void dissect_INFO_TS(tvbuff_t *tvb, tvb, offset, little_endian, - "timestamp", - NULL, - 0); + hf_rtps_info_ts_timestamp); } } @@ -4991,7 +4037,7 @@ static void dissect_INFO_TS(tvbuff_t *tvb, /* *********************************************************************** */ /* * I N F O _ S R C * */ /* *********************************************************************** */ -static void dissect_INFO_SRC(tvbuff_t *tvb, +void dissect_INFO_SRC(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, @@ -5027,6 +4073,8 @@ static void dissect_INFO_SRC(tvbuff_t *tvb, * +---------------+---------------+---------------+---------------+ */ proto_item* octet_item; + guint32 ip; + guint16 version; rtps_util_decode_flags(tree, tvb, offset + 1, flags, INFO_SRC_FLAGS); @@ -5044,89 +4092,29 @@ static void dissect_INFO_SRC(tvbuff_t *tvb, offset += 4; - /* Ip Address */ - { - guint32 ip = NEXT_guint32(tvb, offset, little_endian); - proto_tree_add_text(tree, - tvb, - offset, - 4, - "unused: 0x%08x (appIpAddress: %d.%d.%d.%d)", - ip, - (ip >> 24) & 0xff, - (ip >> 16) & 0xff, - (ip >> 8) & 0xff, - ip & 0xff); - offset += 4; + ip = NEXT_guint32(tvb, offset, little_endian); + + /* Use version field to determine what to display */ + version = tvb_get_ntohs(tvb, offset+4); + if (version < 0x102) { + octet_item = proto_tree_add_ipv4(tree, hf_rtps_info_src_ip, tvb, offset, 4, ip); + } else { + octet_item = proto_tree_add_uint(tree, hf_rtps_info_src_unused, tvb, offset, 4, ip); } - /* Version */ - { - guint8 major = 0; - guint8 minor = 0; - major = tvb_get_guint8(tvb, offset); - minor = tvb_get_guint8(tvb, offset+1); + offset += 4; - proto_tree_add_text(tree, - tvb, - offset, - 2, - "version: %d.%d", - major, - minor); - offset += 2; - } + rtps_util_add_protocol_version(tree, tvb, offset); + offset += 2; /* Vendor ID */ - { - guint8 vendor[MAX_VENDOR_ID_SIZE]; - rtps_util_add_vendor_id(NULL, - tvb, - offset, - vendor, - MAX_VENDOR_ID_SIZE); - proto_tree_add_text(tree, - tvb, - offset, - 2, - "vendor: %s", - vendor); - offset += 2; - } - - { - /* guint8 temp_buffer[MAX_GUID_PREFIX_SIZE]; */ - rtps_util_add_guid_prefix(tree, - tvb, - offset, - hf_rtps_sm_guid_prefix, - hf_rtps_sm_host_id, - hf_rtps_sm_app_id, - hf_rtps_sm_instance_id, - hf_rtps_sm_app_kind, - NULL, /* Use default 'guidPrefix' */ - NULL, - 0); -#if 0 - rtps_util_add_guid_prefix(tree, - tvb, - offset, - hf_rtps_sm_guid_prefix, - hf_rtps_sm_host_id, - hf_rtps_sm_app_id, - hf_rtps_sm_instance_id, - hf_rtps_sm_app_kind, - NULL, /* Use default 'guidPrefix' */ - &temp_buffer[0], - MAX_GUID_PREFIX_SIZE); - proto_tree_add_text(tree, - tvb, - offset, - 8, - temp_buffer); -#endif - } + rtps_util_add_vendor_id(NULL, tvb, offset); + offset += 2; + rtps_util_add_guid_prefix(tree, tvb, offset, + hf_rtps_sm_guid_prefix, hf_rtps_sm_host_id, hf_rtps_sm_app_id, + hf_rtps_sm_instance_id, hf_rtps_sm_app_kind, + NULL); /* Use default 'guidPrefix' */ } @@ -5192,21 +4180,15 @@ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb, /* unicastReplyLocator */ - rtps_util_add_locator_udp_v4(tree, - tvb, - offset, - "unicastReplyLocator", - little_endian); + rtps_util_add_locator_udp_v4(tree, pinfo, tvb, offset, + "unicastReplyLocator", little_endian); offset += 8; /* multicastReplyLocator */ if ((flags & FLAG_INFO_REPLY_IP4_M) != 0) { - rtps_util_add_locator_udp_v4(tree, - tvb, - offset, - "multicastReplyLocator", - little_endian); + rtps_util_add_locator_udp_v4(tree, pinfo, tvb, offset, + "multicastReplyLocator", little_endian); offset += 8; } } @@ -5259,17 +4241,10 @@ static void dissect_INFO_DST(tvbuff_t *tvb, offset += 4; - rtps_util_add_guid_prefix(tree, - tvb, - offset, - hf_rtps_sm_guid_prefix, - hf_rtps_sm_host_id, - hf_rtps_sm_app_id, - hf_rtps_sm_instance_id, - hf_rtps_sm_app_kind, - NULL, - NULL, - 0); + rtps_util_add_guid_prefix(tree, tvb, offset, + hf_rtps_sm_guid_prefix, hf_rtps_sm_host_id, hf_rtps_sm_app_id, + hf_rtps_sm_instance_id, hf_rtps_sm_app_kind, + NULL); } @@ -5325,21 +4300,12 @@ static void dissect_INFO_REPLY(tvbuff_t *tvb, offset += 4; /* unicastReplyLocatorList */ - rtps_util_add_locator_list(tree, - tvb, - offset, - "unicastReplyLocatorList", - little_endian); - + rtps_util_add_locator_list(tree, pinfo, tvb, offset, "unicastReplyLocatorList", little_endian); offset += 8; /* multicastReplyLocatorList */ if ((flags & FLAG_INFO_REPLY_M) != 0) { - rtps_util_add_locator_list(tree, - tvb, - offset, - "multicastReplyLocatorList", - little_endian); + rtps_util_add_locator_list(tree, pinfo, tvb, offset, "multicastReplyLocatorList", little_endian); offset += 8; } } @@ -5356,14 +4322,11 @@ static gboolean dissect_rtps(tvbuff_t *tvb, proto_tree *tree, void *data _U_) { - proto_item *ti = NULL; - proto_tree *rtps_tree=NULL; + proto_item *ti; + proto_tree *rtps_tree, *rtps_submessage_tree; gint offset = 0; - proto_tree *rtps_submessage_tree; - guint8 submessageId; - guint8 flags; - gboolean little_endian; - gboolean is_ping = FALSE; + guint8 submessageId, flags; + gboolean little_endian, is_ping; gint next_submsg, octects_to_next_header; const gboolean is_tcp = (pinfo->ptype == PT_TCP); @@ -5383,96 +4346,49 @@ static gboolean dissect_rtps(tvbuff_t *tvb, /* Distinguish between RTPS 1.x and 2.x here */ if (tvb_get_guint8(tvb,offset+4) != 1) return FALSE; - /* --- Make entries in Protocol column ---*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTPS"); - col_clear(pinfo->cinfo, COL_INFO); + /* create display subtree for the protocol */ + ti = proto_tree_add_item(tree, proto_rtps, tvb, 0, -1, ENC_NA); + rtps_tree = proto_item_add_subtree(ti, ett_rtps); - if (tree) { - guint8 nddsPing[8]; - /* create display subtree for the protocol */ - ti = proto_tree_add_item(tree, proto_rtps, tvb, 0, -1, ENC_NA); - rtps_tree = proto_item_add_subtree(ti, ett_rtps); - - /* Protocol Version */ - rtps_util_add_protocol_version(rtps_tree, tvb, offset+4); - - /* Vendor Id */ - rtps_util_add_vendor_id(rtps_tree, tvb, offset+6, NULL, 0); - - tvb_memcpy(tvb, nddsPing, offset+8, 8); - if (nddsPing[0] == 'N' && - nddsPing[1] == 'D' && - nddsPing[2] == 'D' && - nddsPing[3] == 'S' && - nddsPing[4] == 'P' && - nddsPing[5] == 'I' && - nddsPing[6] == 'N' && - nddsPing[7] == 'G') { - is_ping = TRUE; - } + /* Protocol Version */ + rtps_util_add_protocol_version(rtps_tree, tvb, offset+4); - if (!is_ping) { - rtps_util_add_guid_prefix(rtps_tree, - tvb, - offset+8, - hf_rtps_guid_prefix, - hf_rtps_host_id, - hf_rtps_app_id, - hf_rtps_app_id_instance_id, - hf_rtps_app_id_app_kind, - NULL, - NULL, - 0); - } - } + /* Vendor Id */ + rtps_util_add_vendor_id(rtps_tree, tvb, offset+6); - if (is_ping) - col_add_str(pinfo->cinfo, COL_INFO, "PING"); + is_ping = rtps_is_ping(tvb, pinfo, offset+8); + + if (!is_ping) + rtps_util_add_guid_prefix(rtps_tree, tvb, offset+8, + hf_rtps_guid_prefix, hf_rtps_host_id, hf_rtps_app_id, + hf_rtps_app_id_instance_id, hf_rtps_app_id_app_kind, NULL); /* Extract the domain id and participant index */ { - int domain_id; - int participant_idx; - int nature; - proto_item *ti2; + int domain_id, participant_idx, nature; proto_tree *mapping_tree; domain_id = ((pinfo->destport - PORT_BASE)/10) % 100; participant_idx = (pinfo->destport - PORT_BASE) / 1000; nature = (pinfo->destport % 10); - ti2 = proto_tree_add_text(rtps_tree, - tvb, - 0, - 4, + ti = proto_tree_add_text(rtps_tree, tvb, 0, 0, "Default port mapping: domainId=%d, " "participantIdx=%d, nature=%s", domain_id, participant_idx, val_to_str(nature, nature_type_vals, "%02x")); - mapping_tree = proto_item_add_subtree(ti2, ett_rtps_default_mapping); - proto_tree_add_uint(mapping_tree, - hf_rtps_domain_id, - tvb, - 0, - 4, - domain_id); - proto_tree_add_uint(mapping_tree, - hf_rtps_participant_idx, - tvb, - 0, - 4, - participant_idx); - proto_tree_add_uint(mapping_tree, - hf_rtps_nature_type, - tvb, - 0, - 4, - nature); - + mapping_tree = proto_item_add_subtree(ti, ett_rtps_default_mapping); + ti = proto_tree_add_uint(mapping_tree, hf_rtps_domain_id, tvb, 0, 0, domain_id); + PROTO_ITEM_SET_GENERATED(ti); + ti = proto_tree_add_uint(mapping_tree, hf_rtps_participant_idx, tvb, 0, 0, participant_idx); + PROTO_ITEM_SET_GENERATED(ti); + ti = proto_tree_add_uint(mapping_tree, hf_rtps_nature_type, tvb, 0, 0, nature); + PROTO_ITEM_SET_GENERATED(ti); } /* offset behind RTPS's Header (need to be set in case tree=NULL)*/ @@ -5486,39 +4402,21 @@ static gboolean dissect_rtps(tvbuff_t *tvb, /* Creates the subtree 'Submessage: XXXX' */ if (submessageId & 0x80) { - ti = proto_tree_add_text(rtps_tree, - tvb, - offset, - -1, - "Submessage: %s", - val_to_str(submessageId, submessage_id_vals, - "Vendor-specific (0x%02x)")); - } else { - ti = proto_tree_add_text(rtps_tree, - tvb, - offset, - -1, - "Submessage: %s", - val_to_str(submessageId, submessage_id_vals, - "Unknown (0x%02x)")); - } - rtps_submessage_tree = proto_item_add_subtree(ti, ett_rtps_submessage); - - /* Decode the submessage ID */ - if (submessageId & 0x80) { - proto_tree_add_uint_format(rtps_submessage_tree, + ti = proto_tree_add_uint_format_value(rtps_tree, hf_rtps_sm_id, tvb, offset, 1, submessageId, - "submessageId: Vendor-specific (0x%02x)", + "Vendor-specific (0x%02x)", submessageId); } else { - proto_tree_add_uint(rtps_submessage_tree, hf_rtps_sm_id, + ti = proto_tree_add_uint(rtps_tree, hf_rtps_sm_id, tvb, offset, 1, submessageId); } + rtps_submessage_tree = proto_item_add_subtree(ti, ett_rtps_submessage); + /* Gets the flags */ flags = tvb_get_guint8(tvb, offset + 1); @@ -5542,114 +4440,47 @@ static gboolean dissect_rtps(tvbuff_t *tvb, switch (submessageId) { case PAD: - dissect_PAD(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_PAD(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case DATA: - dissect_DATA(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_DATA(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case NOKEY_DATA: - dissect_NOKEY_DATA(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_NOKEY_DATA(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case ACKNACK: - dissect_ACKNACK(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree, - ti); + dissect_ACKNACK(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree, ti); break; case HEARTBEAT: - dissect_HEARTBEAT(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_HEARTBEAT(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case GAP: - dissect_GAP(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_GAP(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case INFO_TS: - dissect_INFO_TS(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_INFO_TS(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case INFO_SRC: - dissect_INFO_SRC(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_INFO_SRC(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case INFO_REPLY_IP4: - dissect_INFO_REPLY_IP4(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_INFO_REPLY_IP4(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case INFO_DST: - dissect_INFO_DST(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_INFO_DST(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; case INFO_REPLY: - dissect_INFO_REPLY(tvb, - pinfo, - offset, - flags, - little_endian, - octects_to_next_header, - rtps_submessage_tree); + dissect_INFO_REPLY(tvb, pinfo, offset, flags, little_endian, octects_to_next_header, rtps_submessage_tree); break; default: @@ -5674,40 +4505,16 @@ static gboolean dissect_rtps(tvbuff_t *tvb, } /* dissect_rtps(...) */ - - - -/*************************************************************************** - * Register the protocol with Wireshark - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ void proto_register_rtps(void) { - /* Definition of the protocol tree items: - * This section declares all the protocol items that are parsed in the - * dissectors. - * Structure of each element: - * { - * item_id, { - * name, // As appears in the GUI tree - * abbrev, // Referenced by filters (rtps.xxxx[.yyyy]) - * type, // FT_BOOLEAN, FT_UINT8, ... - * display, // BASE_HEX | BASE_DEC | BASE_OCT or other meanings - * strings, // String table (for enums) or NULL - * bitmask, // only for bitfields - * blurb, // Complete description of this item - * HFILL - * } - * } - */ static hf_register_info hf[] = { /* Protocol Version (composed as major.minor) -------------------------- */ { &hf_rtps_protocol_version, { "version", "rtps.version", - FT_NONE, - BASE_NONE, + FT_UINT16, + BASE_HEX, NULL, 0, "RTPS protocol version number", @@ -5783,8 +4590,8 @@ void proto_register_rtps(void) { { &hf_rtps_guid_prefix, { "guidPrefix", "rtps.guidPrefix", - FT_BYTES, - BASE_NONE, + FT_UINT64, + BASE_HEX, NULL, 0, "GuidPrefix of the RTPS packet", @@ -5877,8 +4684,8 @@ void proto_register_rtps(void) { { &hf_rtps_sm_guid_prefix, { "guidPrefix", "rtps.sm.guidPrefix", - FT_BYTES, - BASE_NONE, + FT_UINT64, + BASE_HEX, NULL, 0, "a generic guidPrefix that is transmitted inside the submessage (this is NOT the guidPrefix described in the packet header", @@ -6036,6 +4843,28 @@ void proto_register_rtps(void) { HFILL } }, + { &hf_rtps_info_src_ip, { + "appIpAddress", + "rtps.info_src.ip", + FT_IPv4, + BASE_NONE, + NULL, + 0, + NULL, + HFILL } + }, + + { &hf_rtps_info_src_unused, { + "Unused", + "rtps.info_src.unused", + FT_UINT32, + BASE_HEX, + NULL, + 0, + NULL, + HFILL } + }, + /* Parameter Id -------------------------------------------------------- */ { &hf_rtps_parameter_id, { "parameterId", @@ -6060,39 +4889,6 @@ void proto_register_rtps(void) { HFILL } }, - /* Parameter / NtpTime ------------------------------------------------- */ - { &hf_rtps_param_ntpt, { - "ntpTime", - "rtps.param.ntpTime", - FT_NONE, - BASE_NONE, - NULL, - 0, - "Time using the NTP standard format", - HFILL } - }, - { &hf_rtps_param_ntpt_sec, { - "seconds", - "rtps.param.ntpTime.sec", - FT_INT32, - BASE_DEC, - NULL, - 0, - "The 'second' component of a NTP time", - HFILL } - }, - { &hf_rtps_param_ntpt_fraction, { - "fraction", - "rtps.param.ntpTime.fraction", - FT_UINT32, - BASE_DEC, - NULL, - 0, - "The 'fraction' component of a NTP time", - HFILL } - }, - - /* Parameter / Topic --------------------------------------------------- */ { &hf_rtps_param_topic_name, { "topic", @@ -6198,6 +4994,275 @@ void proto_register_rtps(void) { HFILL } }, + { &hf_rtps_durability_service_cleanup_delay, + { "Service Cleanup Delay", "rtps.durability.service_cleanup_delay", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_liveliness_lease_duration, + { "Lease Duration", "rtps.liveliness.lease_duration", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_participant_lease_duration, + { "Duration", "rtps.participant_lease_duration", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_time_based_filter_minimum_separation, + { "Minimum Separation", "rtps.time_based_filter.minimum_separation", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_reliability_max_blocking_time, + { "Max Blocking Time", "rtps.reliability.max_blocking_time", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_deadline_period, + { "Period", "rtps.deadline_period", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_latency_budget_duration, + { "Duration", "rtps.latency_budget.duration", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_lifespan_duration, + { "Duration", "rtps.lifespan", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_persistence, + { "Persistence", "rtps.persistence", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_info_ts_timestamp, + { "Timestamp", "rtps.info_ts.timestamp", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_locator_kind, + { "Kind", "rtps.locator.kind", + FT_UINT32, BASE_HEX, VALS(rtps_locator_kind_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_port, + { "Port", "rtps.locator.port", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_ipv4, + { "Address", "rtps.locator.ipv4", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_ipv6, + { "Address", "rtps.locator.ipv6", + FT_IPv6, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_participant_builtin_endpoints, + { "BuiltIn Endpoint", "rtps.participant_builtin_endpoints", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_participant_manual_liveliness_count, + { "Manual Liveliness Count", "rtps.participant_manual_liveliness_count", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_history_depth, + { "Depth", "rtps.history_depth", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_samples, + { "Max Samples", "rtps.resource_limit.max_samples", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_instances, + { "Max Instances", "rtps.resource_limit.max_instances", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_samples_per_instances, + { "Max Samples Per Instance", "rtps.resource_limit.max_samples_per_instance", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_filter_bitmap, + { "Filter Bitmap", "rtps.filter_bitmap", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_type_checksum, + { "Checksum", "rtps.type_checksum", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_queue_size, + { "queueSize", "rtps.queue_size", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_acknack_counter, + { "Counter", "rtps.acknack.counter", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_durability_service_history_kind, + { "History Kind", "rtps.durability_service.history_kind", + FT_UINT32, BASE_HEX, VALS(history_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_durability_service_history_depth, + { "History Depth", "rtps.durability_service.history_depth", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_durability_service_max_samples, + { "Max Samples", "rtps.durability_service.max_samples", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_durability_service_max_instances, + { "Max Instances", "rtps.durability_service.max_instances", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_durability_service_max_samples_per_instances, + { "Max Samples Per Instance", "rtps.durability_service.max_samples_per_instance", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_liveliness_kind, + { "Kind", "rtps.liveliness.kind", + FT_UINT32, BASE_HEX, VALS(liveliness_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_manager_key, + { "Key", "rtps.manager_key", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_udp_v4, + { "Address", "rtps.locator_udp_v4.ip", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_udp_v4_port, + { "Port", "rtps.locator_udp_v4.port", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_param_ip_address, + { "Address", "rtps.param.ip_address", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_param_port, + { "Port", "rtps.param.port", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_expects_inline_qos, + { "Inline QoS", "rtps.expects_inline_qos", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_coherent_access, + { "Coherent Access", "rtps.presentation.coherent_access", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_ordered_access, + { "Ordered Access", "rtps.presentation.ordered_access", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_expects_ack, + { "expectsAck", "rtps.expects_ack", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_reliability_kind, + { "Kind", "rtps.reliability_kind", + FT_UINT32, BASE_HEX, VALS(reliability_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_durability, + { "Durability", "rtps.durability", + FT_UINT32, BASE_HEX, VALS(durability_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_ownership, + { "Kind", "rtps.ownership", + FT_UINT32, BASE_HEX, VALS(ownership_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_access_scope, + { "Access Scope", "rtps.presentation.access_scope", + FT_UINT32, BASE_HEX, VALS(presentation_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_destination_order, + { "Kind", "rtps.destination_order", + FT_UINT32, BASE_HEX, VALS(destination_order_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_history_kind, + { "Kind", "rtps.history.kind", + FT_UINT32, BASE_HEX, VALS(history_qos_vals), 0, + NULL, HFILL } + }, /* Finally the raw issue data ------------------------------------------ */ { &hf_rtps_issue_data, { @@ -6232,6 +5297,10 @@ void proto_register_rtps(void) { &ett_rtps_bitmap, &ett_rtps_seq_string, &ett_rtps_seq_ulong, + &ett_rtps_resource_limit, + &ett_rtps_durability_service, + &ett_rtps_liveliness, + &ett_rtps_manager_key }; proto_rtps = proto_register_protocol( diff --git a/epan/dissectors/packet-rtps.h b/epan/dissectors/packet-rtps.h index 894d37c7a1..864d209133 100644 --- a/epan/dissectors/packet-rtps.h +++ b/epan/dissectors/packet-rtps.h @@ -59,7 +59,7 @@ extern "C" { typedef enum { - RTI_CDR_TK_NULL, + RTI_CDR_TK_NULL = 0, RTI_CDR_TK_SHORT, RTI_CDR_TK_LONG, RTI_CDR_TK_USHORT, @@ -81,7 +81,8 @@ typedef enum { RTI_CDR_TK_LONGDOUBLE, RTI_CDR_TK_WCHAR, RTI_CDR_TK_WSTRING, - RTI_CDR_TK_VALUE + RTI_CDR_TK_VALUE, + RTI_CDR_TK_VALUE_PARARM } RTICdrTCKind; @@ -146,10 +147,10 @@ typedef enum { #define PID_METATRAFFIC_MULTICAST_LOCATOR (0x33) #define PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT (0x34) #define PID_CONTENT_FILTER_PROPERTY (0x35) -#define PID_PROPERTY_LIST (0x36) +#define PID_PROPERTY_LIST_OLD (0x36) /* For compatibility between 4.2d and 4.2e */ #define PID_HISTORY (0x40) #define PID_RESOURCE_LIMIT (0x41) -#define PID_DEFAULT_EXPECTS_INLINE_QOS (0x43) +#define PID_EXPECTS_INLINE_QOS (0x43) #define PID_PARTICIPANT_BUILTIN_ENDPOINTS (0x44) #define PID_METATRAFFIC_UNICAST_IPADDRESS (0x45) #define PID_METATRAFFIC_MULTICAST_PORT (0x46) @@ -162,14 +163,6 @@ typedef enum { #define PID_COHERENT_SET (0x56) /* The following QoS are deprecated */ -#define PID_RELIABILITY_OFFERED (0x19) -#define PID_LIVELINESS_OFFERED (0x1c) -#define PID_OWNERSHIP_OFFERED (0x20) -#define PID_PRESENTATION_OFFERED (0x22) -#define PID_DEADLINE_OFFERED (0x24) -#define PID_DESTINATION_ORDER_OFFERED (0x26) -#define PID_LATENCY_BUDGET_OFFERED (0x28) -#define PID_PARTITION_OFFERED (0x2a) #define PID_PERSISTENCE (0x03) #define PID_TYPE_CHECKSUM (0x08) #define PID_TYPE2_NAME (0x09) @@ -178,9 +171,17 @@ typedef enum { #define PID_EXPECTS_ACK (0x10) #define PID_MANAGER_KEY (0x12) #define PID_SEND_QUEUE_SIZE (0x13) +#define PID_RELIABILITY_ENABLED (0x14) #define PID_RECV_QUEUE_SIZE (0x18) #define PID_VARGAPPS_SEQUENCE_NUMBER_LAST (0x17) -#define PID_RELIABILITY_ENABLED (0x14) +#define PID_RELIABILITY_OFFERED (0x19) +#define PID_LIVELINESS_OFFERED (0x1c) +#define PID_OWNERSHIP_OFFERED (0x20) +#define PID_PRESENTATION_OFFERED (0x22) +#define PID_DEADLINE_OFFERED (0x24) +#define PID_DESTINATION_ORDER_OFFERED (0x26) +#define PID_LATENCY_BUDGET_OFFERED (0x28) +#define PID_PARTITION_OFFERED (0x2a) /* appId.appKind possible values */ #define APPKIND_UNKNOWN (0x00) @@ -246,7 +247,7 @@ typedef enum { * Make sure the _STRING macro is bigger than a normal IP */ #define IPADDRESS_INVALID (0) -#define IPADDRESS_INVALID_STRING "ADDRESS_INVALID (0x00000000)" +#define IPADDRESS_INVALID_STRING "ADDRESS_INVALID" /* Identifies the value of an invalid port number: * Make sure the _STRING macro is bigger than a normal port @@ -259,6 +260,9 @@ typedef enum { #define RTPS_VENDOR_UNKNOWN_STRING "VENDOR_ID_UNKNOWN (0x0000)" #define RTPS_VENDOR_RTI (0x0101) #define RTPS_VENDOR_RTI_STRING "Real-Time Innovations, Inc." +#define RTPS_VENDOR_TOC (0x0106) +#define RTPS_VENDOR_TOC_STRING "Twin Oaks Computing, Inc." + /* Parameter Liveliness */ #define LIVELINESS_AUTOMATIC (0) @@ -298,10 +302,51 @@ typedef enum { #define BY_RECEPTION_TIMESTAMP (0) #define BY_SOURCE_TIMESTAMP (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 void 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, + gboolean little_endian, const guint8 * label); +extern int rtps_util_add_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, const guint8* label, gboolean little_endian); +extern void rtps_util_add_ipv4_address_t(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, gint offset, + gboolean little_endian, int hf_item); +extern void rtps_util_add_locator_udp_v4(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, const guint8 * label, gboolean little_endian); +extern int rtps_util_add_entity_id(proto_tree *tree, tvbuff_t * tvb, gint offset, + int hf_item, int hf_item_entity_key, int hf_item_entity_kind, + int subtree_entity_id, const char *label, guint32* entity_id_out); +extern void rtps_util_add_generic_entity_id(proto_tree *, tvbuff_t *, + gint, const char *, + guint8 *, gint); +extern guint64 rtps_util_add_seq_number(proto_tree *, tvbuff_t *, + gint, int, const char *); +extern void rtps_util_add_ntp_time(proto_tree *tree, tvbuff_t * tvb, gint offset, + gboolean little_endian, int hf_time); +extern gint rtps_util_add_string(proto_tree *, tvbuff_t *, + gint, int, int, const guint8 *, guint8 *, size_t); +extern void rtps_util_add_port(proto_tree *tree, packet_info *pinfo, tvbuff_t * tvb, + gint offset, gboolean little_endian, int hf_item); +extern void rtps_util_add_durability_service_qos(proto_tree *tree, tvbuff_t * tvb, + gint offset, gboolean little_endian); +extern void rtps_util_add_liveliness_qos(proto_tree *tree, tvbuff_t * tvb, gint offset, + gboolean little_endian); +extern gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, + gint, int, int, const char *, guint8 *, gint); +extern void rtps_util_add_seq_octets(proto_tree *tree, packet_info *pinfo, tvbuff_t* tvb, + gint offset, gboolean little_endian, int param_length, int hf_id); +extern gint rtps_util_add_seq_ulong(proto_tree *tree, tvbuff_t * tvb, gint offset, int hf_item, + gboolean little_endian, int param_length, const char *label); + +extern gboolean rtps_is_ping(tvbuff_t *tvb, packet_info *pinfo, gint offset); + +/* Shared submessage dissection */ +extern void dissect_PAD(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, + gboolean little_endian, int octects_to_next_header, proto_tree *tree); +extern void dissect_INFO_SRC(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, + gboolean little_endian, int octets_to_next_header, proto_tree *tree); +extern void dissect_INFO_TS(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 flags, + gboolean little_endian, int octets_to_next_header, proto_tree *tree); #ifdef __cplusplus diff --git a/epan/dissectors/packet-rtps2.c b/epan/dissectors/packet-rtps2.c index f5e7effc56..308c5dfb0e 100644 --- a/epan/dissectors/packet-rtps2.c +++ b/epan/dissectors/packet-rtps2.c @@ -63,6 +63,7 @@ #include "packet-rtps2.h" +#include "packet-rtps.h" /* Size of the temp buffers used to format various part of the protocol. * Note: Some of those values are bigger than expected. The reason is @@ -90,10 +91,6 @@ /***************************************************************************/ /* Protocol Fields Identifiers */ static int proto_rtps = -1; -static int hf_rtps_protocol_version = -1; -static int hf_rtps_protocol_version_major = -1; -static int hf_rtps_protocol_version_minor = -1; -static int hf_rtps_vendor_id = -1; static int hf_rtps_domain_id = -1; static int hf_rtps_participant_idx = -1; @@ -122,13 +119,9 @@ static int hf_rtps_sm_rdentity_id_kind = -1; static int hf_rtps_sm_wrentity_id = -1; static int hf_rtps_sm_wrentity_id_key = -1; static int hf_rtps_sm_wrentity_id_kind = -1; -static int hf_rtps_sm_seq_number = -1; static int hf_rtps_parameter_id = -1; static int hf_rtps_parameter_length = -1; -static int hf_rtps_param_ntpt = -1; -static int hf_rtps_param_ntpt_sec = -1; -static int hf_rtps_param_ntpt_fraction = -1; static int hf_rtps_param_topic_name = -1; static int hf_rtps_param_entity_name = -1; static int hf_rtps_param_strength = -1; @@ -142,6 +135,36 @@ static int hf_rtps_param_filter_name = -1; static int hf_rtps_issue_data = -1; static int hf_rtps_param_status_info = -1; +static int hf_rtps_participant_lease_duration = -1; +static int hf_rtps_time_based_filter_minimum_separation = -1; +static int hf_rtps_deadline_period = -1; +static int hf_rtps_latency_budget_duration = -1; +static int hf_rtps_lifespan_duration = -1; +static int hf_rtps_persistence = -1; +static int hf_rtps_data_batch_timestamp = -1; +static int hf_rtps_participant_builtin_endpoints= -1; +static int hf_rtps_participant_manual_liveliness_count = -1; +static int hf_rtps_history_depth = -1; +static int hf_rtps_resource_limit_max_samples = -1; +static int hf_rtps_resource_limit_max_instances = -1; +static int hf_rtps_resource_limit_max_samples_per_instances = -1; +static int hf_rtps_filter_bitmap = -1; +static int hf_rtps_type_checksum = -1; +static int hf_rtps_queue_size = -1; +static int hf_param_ip_address = -1; +static int hf_rtps_param_port = -1; +static int hf_rtps_expects_inline_qos = -1; +static int hf_rtps_presentation_coherent_access = -1; +static int hf_rtps_presentation_ordered_access = -1; +static int hf_rtps_expects_ack = -1; +static int hf_rtps_disable_positive_ack = -1; +static int hf_rtps_reliability_kind = -1; +static int hf_rtps_durability = -1; +static int hf_rtps_ownership = -1; +static int hf_rtps_presentation_access_scope = -1; +static int hf_rtps_destination_order = -1; +static int hf_rtps_history_kind = -1; + /* Subtree identifiers */ static gint ett_rtps = -1; @@ -170,6 +193,7 @@ static gint ett_rtps_sample_info = -1; static gint ett_rtps_sample_batch_list = -1; static gint ett_rtps_locator_filter_channel = -1; static gint ett_rtps_locator_filter_locator = -1; +static gint ett_rtps_resource_limit = -1; /***************************************************************************/ /* Value-to-String Tables */ @@ -355,7 +379,7 @@ static const value_string parameter_id_vals[] = { { PID_PLUGIN_PROMISCUITY_KIND, "PID_PLUGIN_PROMISCUITY_KIND" }, { PID_ENTITY_VIRTUAL_GUID, "PID_ENTITY_VIRTUAL_GUID" }, { PID_SERVICE_KIND, "PID_SERVICE_KIND" }, - { PID_TYPECODE, "PID_TYPECODE" }, + { PID_TYPECODE_RTPS2, "PID_TYPECODE" }, { PID_DISABLE_POSITIVE_ACKS, "PID_DISABLE_POSITIVE_ACKS" }, { PID_LOCATOR_FILTER_LIST, "PID_LOCATOR_FILTER_LIST" }, @@ -467,17 +491,6 @@ struct Flag_definition { #define RESERVEDFLAG_CHAR ('_') #define RESERVEDFLAG_STRING ("reserved bit") -static const struct Flag_definition PAD_FLAGS[] = { - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 7 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 6 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 5 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 4 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 3 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 2 */ - { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 1 */ - { 'E', "Endianness bit" } /* Bit 0 */ -}; - static const struct Flag_definition DATA_FLAGS[] = { { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 7 */ { RESERVEDFLAG_CHAR, RESERVEDFLAG_STRING }, /* Bit 6 */ @@ -719,72 +732,27 @@ static const struct Flag_definition RTPS_SAMPLE_INFO_FLAGS16[] = { */ /* Utility to add elements to the protocol tree */ -static void rtps_util_format_ipv6(guint8 *, guint8 *, gint); -static void rtps_util_add_protocol_version(proto_tree *, tvbuff_t *, gint); -static void rtps_util_add_vendor_id(proto_tree *, tvbuff_t *, - gint, guint8 *, gint); -static void rtps_util_add_locator_t(proto_tree *, tvbuff_t *, - gint, int, const guint8 *, guint8 *, gint); -static int rtps_util_add_locator_list(proto_tree *, tvbuff_t *, - gint, const guint8 *, int); -static void rtps_util_add_ipv4_address_t(proto_tree *, tvbuff_t *, - gint, int, const guint8 *, guint8 *, gint); -static void rtps_util_add_locator_udp_v4(proto_tree *, tvbuff_t *, - gint, const guint8 *, int); static void rtps_util_add_guid_prefix(proto_tree *, tvbuff_t *, gint, int, int, int, int, const guint8 *, guint8 *, gint); -static void rtps_util_add_entity_id(proto_tree *, tvbuff_t *, - gint, int, int, int, int, const char *, guint32 *); -static void rtps_util_add_generic_entity_id(proto_tree *, tvbuff_t *, - gint, const char *, - guint8 *, gint); static void rtps_util_add_generic_guid(proto_tree *, tvbuff_t *, gint, const char *, guint8 *, gint); -static guint64 rtps_util_add_seq_number(proto_tree *, tvbuff_t *, - gint, int, const char *); -static void rtps_util_add_ntp_time(proto_tree *, tvbuff_t *, - gint, int, const char *, guint8 *, gint); -static gint rtps_util_add_string(proto_tree *, tvbuff_t *, - gint, int, int, const guint8 *, guint8 *, size_t); -static guint32 rtps_util_add_long(proto_tree *, tvbuff_t *, - gint, int, int, gboolean, gboolean, const char *, - guint8 *, size_t); static guint16 rtps_util_add_short(proto_tree *, tvbuff_t *, gint, int, int, gboolean, gboolean, const char *, guint8 *, gint); -static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, const char *, guint8 *, gint); -static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, const char *, guint8 *, size_t); -static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, - gint, int, guint8 *, gint); -static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, - gint, int, guint8 *, gint); -static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, const char *, const value_string *, guint8 *, size_t); -static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, const char *, guint8 *, gint); -static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, - gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, gint, int, const char *); static int rtps_util_add_fragment_number_set(proto_tree *, tvbuff_t *, gint, int, const char *, gint); -static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, const char *); static void rtps_util_add_extra_flags(proto_tree *, tvbuff_t *, gint, const char *); /* The data (payload) dissector */ -static void dissect_serialized_data(proto_tree *, tvbuff_t *, - gint, int, const char *, guint16 vendor_id); - static void dissect_octet_seq(proto_tree *, tvbuff_t *, gint, const char *); /* The data (payload) dissector for parameter sequences */ -static gint dissect_parameter_sequence(proto_tree *, tvbuff_t *, +static gint dissect_parameter_sequence(proto_tree *, packet_info *pinfo, tvbuff_t *, gint, int, int, const char *, guint32 *, guint16 vendor_id); @@ -879,41 +847,6 @@ static void info_summary_append_ex(packet_info *pinfo, -/* *********************************************************************** */ -/* Format the given address (16 octets) as an IPv6 address - */ -static void rtps_util_format_ipv6(guint8 *addr, - guint8 *buffer, - gint buffer_size) { - guint32 i; - guint8 temp[5]; /* Contains a 4-digit hex value */ - - buffer[0] = '\0'; - for (i = 0; i < 16; i+=2) { - /* Unfortunately %x is the same thing as %02x all the time... sigh */ - g_snprintf(temp, 5, "%02x%02x", addr[i], addr[i+1]); - if (temp[0] == '0') { - if (temp[1] == '0') { - if (temp[2] == '0') { - g_strlcat(buffer, &temp[3], buffer_size); - } else { - g_strlcat(buffer, &temp[2], buffer_size); - } - } else { - g_strlcat(buffer, &temp[1], buffer_size); - } - } else { - g_strlcat(buffer, temp, buffer_size); - } - if (i < 14) { - g_strlcat(buffer, ":", buffer_size); - } - } -} - - - - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * NOTE: * In general those utility functions (they all starts with 'rtps_util') @@ -953,373 +886,6 @@ static void rtps_util_add_extra_flags(proto_tree *tree, } } -/* *********************************************************************** */ -static void rtps_util_add_protocol_version(proto_tree *tree, - tvbuff_t * tvb, - gint offset) { - if (tree) { - proto_item * ti; - proto_tree * version_tree; - - ti = proto_tree_add_none_format(tree, - hf_rtps_protocol_version, - tvb, - offset, - 2, - "Protocol version: %d.%d", - tvb_get_guint8(tvb, offset), - tvb_get_guint8(tvb, offset+1)); - version_tree = proto_item_add_subtree(ti, - ett_rtps_proto_version); - proto_tree_add_item(version_tree, - hf_rtps_protocol_version_major, - tvb, - offset, - 1, - ENC_BIG_ENDIAN); - proto_tree_add_item(version_tree, - hf_rtps_protocol_version_minor, - tvb, - offset+1, - 1, - ENC_BIG_ENDIAN); - } -} - - -/* ------------------------------------------------------------------------- */ -/* Interpret the next bytes as vendor ID. If proto_tree and field ID is - * provided, it can also set. - */ -static void rtps_util_add_vendor_id(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ - guint8 major, minor; - guint32 vendor_id = 0; - guint8 vendor_name[MAX_VENDOR_ID_SIZE]; - - major = tvb_get_guint8(tvb, offset); - minor = tvb_get_guint8(tvb, offset+1); - vendor_id = (major<<8) | minor; - switch(vendor_id) { - case RTPS_VENDOR_UNKNOWN: - g_strlcpy(vendor_name, RTPS_VENDOR_UNKNOWN_STRING, MAX_VENDOR_ID_SIZE); - break; - - case RTPS_VENDOR_RTI: - g_strlcpy(vendor_name, RTPS_VENDOR_RTI_STRING, MAX_VENDOR_ID_SIZE); - break; - - case RTPS_VENDOR_TOC: - g_strlcpy(vendor_name, RTPS_VENDOR_TOC_STRING, MAX_VENDOR_ID_SIZE); - break; - - default: - g_snprintf(vendor_name, MAX_VENDOR_ID_SIZE, "%d.%d", major, minor); - } - - if (tree) { - proto_tree_add_uint_format(tree, - hf_rtps_vendor_id, - tvb, - offset, - 2, - vendor_id, - "vendor: %s", - vendor_name); - } - if (buffer != NULL) { - g_strlcpy(buffer, vendor_name, buffer_size); - } -} - - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next 8 bytes interpreted as Locator_t - * - * Locator_t is a struct defined as: - * struct { - * long kind; // kind of locator - * unsigned long port; - * octet[16] address; - * } Locator_t; - */ -static void rtps_util_add_locator_t(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const guint8 * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ - - proto_item * ti; - proto_tree * locator_tree; - gint32 kind; - guint8 addr[16]; - guint32 port; - char temp_buff[MAX_LOCATOR_SIZE]; - char addr_buff[MAX_IPV6_SIZE]; - const char *kind_string = NULL; - int i; - - - kind = NEXT_guint32(tvb, offset, little_endian); - port = NEXT_guint32(tvb, offset+4, little_endian); - for (i = 0; i < 16; ++i) { - addr[i] = tvb_get_guint8(tvb, offset + 8 + i); - } - - - switch(kind) { - case LOCATOR_KIND_UDPV4: - kind_string = "LOCATOR_KIND_UDPV4"; - g_snprintf(addr_buff, MAX_IPV6_SIZE, - "%d.%d.%d.%d", - addr[12], - addr[13], - addr[14], - addr[15]); - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, "%s:%d", - addr_buff, - port); - break; - - case LOCATOR_KIND_UDPV6: - kind_string = "LOCATOR_KIND_UDPV6"; - rtps_util_format_ipv6(addr, &addr_buff[0], MAX_IPV6_SIZE); - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, - "IPv6: { addr=%s, port=%d }", - addr_buff, - port); - break; - - case LOCATOR_KIND_INVALID: - kind_string = "LOCATOR_KIND_INVALID"; - - case LOCATOR_KIND_RESERVED: - if (!kind_string) /* Need to guard overrides (no break before) */ - kind_string = "LOCATOR_KIND_RESERVED"; - - default: - if (!kind_string) /* Need to guard overrides (no break before) */ - kind_string = "(unknown)"; - g_snprintf(temp_buff, MAX_LOCATOR_SIZE, - "{ kind=%02x, port=%d, addr=%02x %02x %02x ... %02x %02x }", - kind, - port, - addr[0], - addr[1], - addr[2], - /* ... */ - addr[14], - addr[15]); - } - if (tree) { - ti = proto_tree_add_text(tree, - tvb, - offset, - 24, - "%s: %s", - label, - temp_buff); - - locator_tree = proto_item_add_subtree(ti, - ett_rtps_locator); - proto_tree_add_text(locator_tree, - tvb, - offset, - 4, - "kind: %02x (%s)", - kind, - kind_string); - proto_tree_add_text(locator_tree, - tvb, - offset+4, - 4, - "port: %d%s", - port, - (port == 0) ? " (PORT_INVALID)" : ""); - proto_tree_add_text(locator_tree, - tvb, - offset + 8, - 16, - "address: %s", - addr_buff); - } - if (buffer) { - g_strlcpy(buffer, temp_buff, buffer_size); - } -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as a list of - * Locators: - * - unsigned long numLocators - * - locator 1 - * - locator 2 - * - ... - * - locator n - * Returns the new offset after parsing the locator list - */ -static int rtps_util_add_locator_list(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - const guint8 * label, - gboolean little_endian) { - - proto_item *ti; - proto_tree *locator_tree; - guint32 num_locators; - - num_locators = NEXT_guint32(tvb, offset, little_endian); - if (tree) { - ti = proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %d Locators", - label, - num_locators); - } else { - return offset + 4 + ((num_locators > 0) ? (24 * num_locators) : 0); - } - offset += 4; - if (num_locators > 0) { - guint32 i; - char temp_buff[20]; - - locator_tree = proto_item_add_subtree(ti, - ett_rtps_locator_udp_v4); - - for (i = 0; i < num_locators; ++i) { - g_snprintf(temp_buff, 20, "Locator[%d]", i); - rtps_util_add_locator_t(locator_tree, - tvb, - offset, - little_endian, - temp_buff, - NULL, - 0); - offset += 24; - } - } - return offset; -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next 4 bytes interpreted as IPV4Address_t - */ -static void rtps_util_add_ipv4_address_t(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const guint8 * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { /* Can be 0 */ - - guint32 addr; - - addr = NEXT_guint32(tvb, offset, little_endian); - if (addr == IPADDRESS_INVALID) { - if (buffer) { - g_strlcpy(buffer, IPADDRESS_INVALID_STRING, buffer_size); - } - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - IPADDRESS_INVALID_STRING); - } - } else { - if (buffer) { - g_snprintf(buffer, buffer_size, - "%d.%d.%d.%d", - (addr >> 24) & 0xff, - (addr >> 16) & 0xff, - (addr >> 8) & 0xff, - addr & 0xff); - } - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %d.%d.%d.%d", - label, - (addr >> 24) & 0xff, - (addr >> 16) & 0xff, - (addr >> 8) & 0xff, - addr & 0xff); - } - } -} - - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next 8 bytes interpreted as LocatorUDPv4 - * - * LocatorUDPv4 is a struct defined as: - * struct { - * unsigned long address; - * unsigned long port; - * } LocatorUDPv4_t; - * - */ -static void rtps_util_add_locator_udp_v4(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - const guint8 * label, - gboolean little_endian) { - if (tree) { - proto_item * ti; - proto_tree * locator_tree; - guint32 port; - char portLabel[MAX_PORT_SIZE]; - char addr[MAX_IPV4_ADDRESS_SIZE]; - - port = NEXT_guint32(tvb, offset+4, little_endian); - - if (port == PORT_INVALID) { - g_snprintf(portLabel, MAX_PORT_SIZE, "%s (0x00000000)", PORT_INVALID_STRING); - } else { - g_snprintf(portLabel, MAX_PORT_SIZE, "%u", port); - } - - ti = proto_tree_add_text(tree, - tvb, - offset, - 8, - "addr"); /* Add text later */ - locator_tree = proto_item_add_subtree(ti, ett_rtps_locator_udp_v4); - rtps_util_add_ipv4_address_t(locator_tree, - tvb, - offset, - little_endian, - "address", - addr, - MAX_IPV4_ADDRESS_SIZE); - proto_tree_add_text(locator_tree, - tvb, - offset + 4, - 4, - "port: %s", - portLabel); - - proto_item_set_text(ti, "%s: { address=%s, port=%s }", - label, - addr, - portLabel); - } -} - /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next 12 bytes interpreted as GuidPrefix @@ -1436,131 +1002,6 @@ static void rtps_util_add_guid_prefix(proto_tree *tree, } } - - -/* ------------------------------------------------------------------------- */ - /* Insert the entityId from the next 4 bytes. Since there are more than - * one entityId, we need to specify also the IDs of the entityId (and its - * sub-components), as well as the label identifying it. - */ -static void rtps_util_add_entity_id(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - int hf_item, - int hf_item_entity_key, - int hf_item_entity_kind, - int subtree_entity_id, - const char *label, - guint32 * entity_id_out) { /* Can be NULL */ - guint32 entity_id = tvb_get_ntohl(tvb, offset); - guint32 entity_key = (entity_id >> 8); - guint8 entity_kind = (entity_id & 0xff); - const char *str_predef = match_strval(entity_id, entity_id_vals); - - if (entity_id_out != NULL) { - *entity_id_out = entity_id; - } - - - if (tree) { - proto_tree * entity_tree; - proto_item * ti; - - if (str_predef == NULL) { - /* entityId is not a predefined value, format it */ - ti = proto_tree_add_uint_format(tree, - hf_item, - tvb, - offset, - 4, - entity_id, - "%s: 0x%08x (%s: 0x%06x)", - label, - entity_id, - val_to_str(entity_kind, entity_kind_vals, - "unknown kind (%02x)"), - entity_key); - } else { - /* entityId is a predefined value */ - ti = proto_tree_add_uint_format(tree, - hf_item, - tvb, - offset, - 4, - entity_id, - "%s: %s (0x%08x)", label, str_predef, entity_id); - } - - entity_tree = proto_item_add_subtree(ti, - subtree_entity_id); - - proto_tree_add_item(entity_tree, - hf_item_entity_key, - tvb, - offset, - 3, - ENC_BIG_ENDIAN); - - proto_tree_add_item(entity_tree, - hf_item_entity_kind, - tvb, - offset+3, - 1, - ENC_BIG_ENDIAN); - - } -} - -/* ------------------------------------------------------------------------- */ - /* Insert the entityId from the next 4 bytes as a generic one (not connected - * to any protocol field). It simply insert the content as a simple text entry - * and returns in the passed buffer only the value (without the label). - */ -static void rtps_util_add_generic_entity_id(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - const char *label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint32 entity_id = tvb_get_ntohl(tvb, offset); - guint32 entity_key = (entity_id >> 8); - guint8 entity_kind = (entity_id & 0xff); - const char *str_predef = match_strval(entity_id, entity_id_vals); - guint8 temp_buffer[MAX_GUID_SIZE]; - - if (str_predef == NULL) { - /* entityId is not a predefined value, format it */ - g_snprintf(temp_buffer, MAX_GUID_SIZE, - "0x%08x (%s: 0x%06x)", - entity_id, - val_to_str(entity_kind, entity_kind_vals, - "unknown kind (%02x)"), - entity_key); - } else { - /* entityId is a predefined value */ - g_snprintf(temp_buffer, MAX_GUID_SIZE, - "%s (0x%08x)", - str_predef, - entity_id); - } - - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - temp_buffer); - } - - if (buffer != NULL) { - g_strlcpy(buffer, temp_buffer, buffer_size); - } -} - - - /* ------------------------------------------------------------------------- */ /* Interpret the next 16 octets as a generic GUID and insert it in the protocol * tree as simple text (no reference fields are set). @@ -1626,150 +1067,9 @@ static void rtps_util_add_generic_guid(proto_tree *tree, /* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next 8 bytes interpreted as sequence - * number. - */ -static guint64 rtps_util_add_seq_number(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char *label _U_) { - guint64 hi = (guint64)NEXT_guint32(tvb, offset, little_endian); - guint64 lo = (guint64)NEXT_guint32(tvb, offset+4, little_endian); - guint64 all = (hi << 32) | lo; - - if (tree) { - proto_tree_add_int64_format(tree, - hf_rtps_sm_seq_number, - tvb, - offset, - 8, - all, - "%s: %" G_GINT64_MODIFIER "u", label, all); - } - return all; -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next 8 bytes interpreted as NtpTime - */ -static void rtps_util_add_ntp_time(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char * label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint8 tempBuffer[MAX_NTP_TIME_SIZE]; - - gint32 sec = NEXT_guint32(tvb, offset, little_endian); - guint32 frac = NEXT_guint32(tvb, offset+4, little_endian); - double absolute; - - if ((sec == 0x7fffffff) && (frac == 0xffffffff)) { - g_strlcpy(tempBuffer, "INFINITE", MAX_NTP_TIME_SIZE); - } else if ((sec == 0) && (frac == 0)) { - g_strlcpy(tempBuffer, "0 sec", MAX_NTP_TIME_SIZE); - } else { - absolute = (double)sec + (double)frac / ((double)(0x80000000) * 2.0); - g_snprintf(tempBuffer, MAX_NTP_TIME_SIZE, - "%f sec (%ds + 0x%08x)", absolute, sec, frac); - } - if (tree) { - proto_item * ti; - proto_tree *time_tree; - - ti = proto_tree_add_none_format(tree, - hf_rtps_param_ntpt, - tvb, - offset, - 8, - "%s: %s", - label, - tempBuffer); - time_tree = proto_item_add_subtree(ti, ett_rtps_ntp_time); - proto_tree_add_item(time_tree, - hf_rtps_param_ntpt_sec, - tvb, - offset, - 4, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - proto_tree_add_item(time_tree, - hf_rtps_param_ntpt_fraction, - tvb, - offset+4, - 4, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - } - if (buffer != NULL) { - g_strlcpy(buffer, tempBuffer, buffer_size); - } -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a String - * Returns the new offset (after reading the string) - */ -static gint rtps_util_add_string(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - int hf_item, /* Can be -1 (if label!=NULL) */ - gboolean little_endian, - const guint8 * label, /* Can be NULL (if hf_item!=-1) */ - guint8 * buffer, /* Can be NULL */ - size_t buffer_size) { - guint8 * retVal = NULL; - guint32 size = NEXT_guint32(tvb, offset, little_endian); - - if (size > 0) { - retVal = tvb_get_ephemeral_string(tvb, offset+4, size); - } - - if (tree) { - if (hf_item != -1) { - proto_item * hidden_item; - hidden_item = proto_tree_add_string(tree, - hf_item, - tvb, - offset, - size+4, - (size == 0) ? (guint8 *)"" : retVal); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - proto_tree_add_text(tree, - tvb, - offset, - size+4, - "%s: \"%s\"", - ((label != NULL) ? label : (const guint8 *)"value") , - (size == 0) ? (guint8 *)"" : retVal); - } - if (buffer != NULL) { - if (size == 0) { - buffer[0] = '\0'; - } else { - g_snprintf(buffer, (gulong) buffer_size, "%s", retVal); - } - } - - /* NDDS align strings at 4-bytes word. So: - * string_length: 4 -> buffer_length = 4; - * string_length: 5 -> buffer_length = 8; - * string_length: 6 -> buffer_length = 8; - * string_length: 7 -> buffer_length = 8; - * string_length: 8 -> buffer_length = 8; - * ... - */ - return offset + 4 + ((size + 3) & 0xfffffffc); -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a signed long. - * Returns the value inserted as a guint32 +/* Insert in the protocol tree the next data interpreted as a 16-bit short */ -static guint32 rtps_util_add_long(proto_tree *tree, +static guint16 rtps_util_add_short(proto_tree *tree, tvbuff_t * tvb, gint offset, int hf_item, /* Can be -1 */ @@ -1778,42 +1078,41 @@ static guint32 rtps_util_add_long(proto_tree *tree, gboolean is_signed, /* Signed/Unsigned */ const char *label, /* Can be NULL */ guint8 * buffer, - size_t buffer_size) { + gint buffer_size) { char temp_buff[16]; - - guint32 retVal = NEXT_guint32(tvb, offset, little_endian); + guint16 retVal = NEXT_guint16(tvb, offset, little_endian); g_snprintf(temp_buff, 16, - (is_hex ? "0x%08x" : (is_signed ? "%d" : "%u")), - NEXT_guint32(tvb, offset, little_endian)); + (is_hex ? "0x%04x" : (is_signed ? "%d" : "%u")), + retVal); if (tree != NULL) { if (hf_item != -1) { proto_tree_add_item(tree, hf_item, tvb, offset, - 4, + 2, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); } else if (label != NULL) { proto_tree_add_text(tree, tvb, offset, - 4, + 2, "%s: %s", label, temp_buff); } } if (buffer != NULL) { - g_strlcpy(buffer, temp_buff, (gulong) buffer_size); + g_strlcpy(buffer, temp_buff, buffer_size); } return retVal; } /* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a 16-bit short +/* Insert in the protocol tree the next data interpreted as a signed long. */ -static guint16 rtps_util_add_short(proto_tree *tree, +static guint32 rtps_util_add_long(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, int hf_item, /* Can be -1 */ @@ -1822,382 +1121,37 @@ static guint16 rtps_util_add_short(proto_tree *tree, gboolean is_signed, /* Signed/Unsigned */ const char *label, /* Can be NULL */ guint8 * buffer, - gint buffer_size) { + size_t buffer_size) { char temp_buff[16]; - guint16 retVal = NEXT_guint16(tvb, offset, little_endian); + guint32 retVal = NEXT_guint32(tvb, offset, little_endian); + g_snprintf(temp_buff, 16, - (is_hex ? "0x%04x" : (is_signed ? "%d" : "%u")), - retVal); + (is_hex ? "0x%08x" : (is_signed ? "%d" : "%u")), retVal); + if (tree != NULL) { if (hf_item != -1) { proto_tree_add_item(tree, hf_item, tvb, offset, - 2, + 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); } else if (label != NULL) { proto_tree_add_text(tree, tvb, offset, - 2, + 4, "%s: %s", label, temp_buff); } } if (buffer != NULL) { - g_strlcpy(buffer, temp_buff, buffer_size); - } - return retVal; -} - - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a port (unsigned - * 32-bit integer) - */ -static void rtps_util_add_port(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char *label, - guint8 * buffer, /* Can be NULL */ - gint buffer_size) { - guint8 tempBuffer[MAX_PORT_SIZE]; - guint32 value = NEXT_guint32(tvb, offset, little_endian); - - if (value == PORT_INVALID) { - g_snprintf(buffer, buffer_size, "%s (0x00000000)", PORT_INVALID_STRING); - } else { - g_snprintf(tempBuffer, MAX_PORT_SIZE, "%u", value); - } - - if (tree != NULL) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - tempBuffer); - } - if (buffer != NULL) { - g_strlcpy(buffer, tempBuffer, buffer_size); - } -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next data interpreted as a boolean - * Returns the pointer to a dynamically allocated buffer containing the - * formatted version of the value. - */ -static void rtps_util_add_boolean(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - const char *label, - guint8 * buffer, /* Can be NULL */ - size_t buffer_size) { - const char *str; - guint8 value = tvb_get_guint8(tvb, offset); - - str = value ? "TRUE" : "FALSE"; - - if (buffer) { - g_strlcpy(buffer, str, (gulong) buffer_size); - } - - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 1, - "%s: %s", - label, - str); - } -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as - * DurabilityServiceQosPolicy - */ -static void rtps_util_add_durability_service_qos(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - guint8 * buffer, - gint buffer_size) { - guint8 temp_buffer[MAX_NTP_TIME_SIZE]; - gint32 kind = NEXT_guint32(tvb, offset+8, little_endian); - gint32 history_depth = NEXT_guint32(tvb, offset+12, little_endian); - gint32 max_samples = NEXT_guint32(tvb, offset+16, little_endian); - gint32 max_instances = NEXT_guint32(tvb, offset+20, little_endian); - gint32 max_spi = NEXT_guint32(tvb, offset+24, little_endian); - - rtps_util_add_ntp_time(NULL, - tvb, - offset, - little_endian, - NULL, - temp_buffer, - MAX_NTP_TIME_SIZE); - - g_snprintf(buffer, buffer_size, - "{ service_cleanup_delay=%s, history_kind='%s', " - "history_depth=%d, max_samples=%d, max_instances=%d, " - "max_samples_per_instances=%d }", - temp_buffer, - val_to_str(kind, history_qos_vals, "0x%08x"), - history_depth, - max_samples, - max_instances, - max_spi); - if (tree) { - rtps_util_add_ntp_time(tree, - tvb, - offset, - little_endian, - "service_cleanup_delay", - NULL, - 0); - proto_tree_add_text(tree, - tvb, - offset+8, - 4, - "history_kind: %s", - val_to_str(kind, history_qos_vals, "0x%08x")); - proto_tree_add_text(tree, - tvb, - offset+12, - 4, - "history_depth: %d", - history_depth); - proto_tree_add_text(tree, - tvb, - offset+16, - 4, - "max_samples: %d", - max_samples); - proto_tree_add_text(tree, - tvb, - offset+20, - 4, - "max_instances: %d", - max_instances); - proto_tree_add_text(tree, - tvb, - offset+24, - 4, - "max_samples_per_instances: %d", - max_spi); - } -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as Liveliness - * QoS Policy structure. - */ -static void rtps_util_add_liveliness_qos(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - guint8 * buffer, - gint buffer_size) { - guint8 temp_buffer[MAX_NTP_TIME_SIZE]; - guint32 kind = NEXT_guint32(tvb, offset, little_endian); - - rtps_util_add_ntp_time(NULL, - tvb, - offset+4, - little_endian, - NULL, - temp_buffer, - MAX_NTP_TIME_SIZE); - - g_snprintf(buffer, buffer_size, - "{ kind=%s, lease_duration=%s }", - val_to_str(kind, liveliness_qos_vals, "0x%08x"), - temp_buffer); - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "kind: %s", - val_to_str(kind, liveliness_qos_vals, "0x%08x")); - rtps_util_add_ntp_time(tree, - tvb, - offset+4, - little_endian, - "lease_duration", - NULL, - 0); - } -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as enum type. - */ -static void rtps_util_add_kind_qos(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - const char *label, - const value_string *vals, - guint8 * buffer, /* Can be NULL */ - size_t buffer_size) { - guint32 kind = NEXT_guint32(tvb, offset, little_endian); - - if (buffer) { - g_strlcpy(buffer, val_to_str(kind, vals, "0x%08x"), - (gulong) buffer_size); - } - - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - 4, - "%s: %s", - label, - buffer); - } -} - - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as Sequence of - * Strings. - * The formatted buffer is: "string1", "string2", "string3", ... - * Returns the new updated offset - */ -static gint rtps_util_add_seq_string(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - int param_length, - const char *label, - guint8 * buffer, /* Can NOT be NULL */ - gint buffer_size) { - guint32 num_strings; - guint32 i; - proto_tree *string_tree = NULL; - proto_item *ti = NULL; - char temp_buff[MAX_LABEL_SIZE]; - guint8 overview_buffer[MAX_LABEL_SIZE]; - - num_strings = NEXT_guint32(tvb, offset, little_endian); - proto_tree_add_text(tree, - tvb, - offset, - 4, - "size: %d", num_strings); - offset += 4; - - /* Create the string node with a fake string, then replace it later */ - if (tree) { - ti = proto_tree_add_text(tree, - tvb, - offset, - param_length-8, - "Strings"); - string_tree = proto_item_add_subtree(ti, ett_rtps_seq_string); - } - - overview_buffer[0] = '\0'; - - for (i = 0; i < num_strings; ++i) { - g_snprintf(temp_buff, MAX_LABEL_SIZE, - "%s[%d]", - label, - i); - /* This call safe with string_tree=NULL and is required to calculate offset */ - offset = rtps_util_add_string(string_tree, - tvb, - offset, - -1, - little_endian, - temp_buff, - overview_buffer+strlen(overview_buffer), - MAX_LABEL_SIZE-strlen(overview_buffer)); - } - if (tree) { - proto_item_set_text(ti, - "%s: %s", - label, - overview_buffer); - } - if (buffer != NULL) { - g_strlcpy(buffer, overview_buffer, buffer_size); - } - return offset; -} - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as Sequence of - * longs. - * The formatted buffer is: val1, val2, val3, ... - * Returns the new updated offset - */ -static gint rtps_util_add_seq_ulong(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - int param_length, - int is_hex, - int is_signed, - const char *label) { - guint32 num_elem; - guint32 i; - proto_tree *string_tree; - proto_item *ti; - char temp_buff[MAX_LABEL_SIZE]; - char overview_buff[MAX_PARAM_SIZE]; - - num_elem = NEXT_guint32(tvb, offset, little_endian); - offset += 4; - - /* Create the string node with an empty string, the replace it later */ - if (tree) { - ti = proto_tree_add_text(tree, - tvb, - offset, - param_length-8, - "Seq"); - string_tree = proto_item_add_subtree(ti, ett_rtps_seq_ulong); - } else { - return offset + 4*num_elem; + g_strlcpy(buffer, temp_buff, (gulong) buffer_size); } - overview_buff[0] = '\0'; - - for (i = 0; i < num_elem; ++i) { - g_snprintf(temp_buff, MAX_LABEL_SIZE, - "%s[%d]", - label, - i); - rtps_util_add_long( string_tree, - tvb, - offset, - -1, - little_endian, - is_hex, - is_signed, - temp_buff, - overview_buff+strlen(overview_buff), - MAX_PARAM_SIZE-strlen(overview_buff)); - offset += 4; - } - proto_item_set_text(ti, - "%s: %s", - label, - overview_buff); - return offset; + return retVal; } @@ -2914,83 +1868,6 @@ static gint rtps_util_add_typecode(proto_tree *tree, return retVal; } - -/* ------------------------------------------------------------------------- */ -/* Insert in the protocol tree the next bytes interpreted as Sequence of - * Octets. - * The formatted buffer is: [ 0x01, 0x02, 0x03, 0x04, ...] - * The maximum number of elements displayed is 10, after that a '...' is - * inserted. - */ -static void rtps_util_add_seq_octets(proto_tree *tree, - tvbuff_t * tvb, - gint offset, - gboolean little_endian, - int param_length, - int hf_id, - guint8 * buffer, - gint buffer_size) { - gint idx = 0; - guint32 seq_length; - guint32 i; - gint original_offset = offset; - guint32 original_seq_length; - - - original_seq_length = seq_length = NEXT_guint32(tvb, offset, little_endian); - - offset += 4; - if (param_length < 4 + (int)seq_length) { - g_strlcpy(buffer, "RTPS PROTOCOL ERROR: parameter value too small", buffer_size); - if (tree) { - proto_tree_add_text(tree, - tvb, - offset, - param_length, - "%s", - buffer); - } - return ; - } - - /* Limit the number of octets displayed to MAX_SEQ_OCTETS_PRINTED */ - if (seq_length > MAX_SEQ_OCTETS_PRINTED) { - seq_length = MAX_SEQ_OCTETS_PRINTED; - } - for (i = 0; i < seq_length; ++i) { - idx += g_snprintf(&buffer[idx], - buffer_size - idx - 1, - "%02x", - tvb_get_guint8(tvb, offset++)); - if (idx >= buffer_size) { - break; - } - } - if (seq_length != original_seq_length) { - /* seq_length was reduced, add '...' */ - g_strlcat(buffer, "...", buffer_size); - } - - if (tree) { - proto_tree_add_text(tree, - tvb, - original_offset, - 4, - "sequenceSize: %d octets", - original_seq_length); - proto_tree_add_item(tree, - hf_id, - tvb, - original_offset+4, - original_seq_length, - little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); - - } -} - - - - /* ------------------------------------------------------------------------- */ /* Insert in the protocol tree the next bytes interpreted as a Bitmap * struct { @@ -3325,20 +2202,13 @@ static void rtps_util_decode_flags_16bit(proto_tree * tree, /* Note: the encapsulation header is ALWAYS big endian, then the encapsulation * type specified the type of endianess of the payload. */ -static void dissect_serialized_data(proto_tree *tree, - tvbuff_t *tvb, - gint offset, - int size, - const char * label, - guint16 vendor_id) { +static void dissect_serialized_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, + int size, const char * label, guint16 vendor_id) { proto_item * ti; proto_tree * rtps_parameter_sequence_tree; guint16 encapsulation_id; guint16 encapsulation_len; gboolean encapsulation_little_endian = FALSE; - if (tree == NULL) { - return; - } /* Creates the sub-tree */ ti = proto_tree_add_text(tree, @@ -3392,12 +2262,8 @@ static void dissect_serialized_data(proto_tree *tree, case ENCAPSULATION_PL_CDR_LE: case ENCAPSULATION_PL_CDR_BE: - dissect_parameter_sequence(rtps_parameter_sequence_tree, - tvb, - offset, - encapsulation_little_endian, - size, - label, NULL, vendor_id); + dissect_parameter_sequence(rtps_parameter_sequence_tree, pinfo, tvb, offset, + encapsulation_little_endian, size, label, NULL, vendor_id); break; default: @@ -3484,6 +2350,7 @@ static void dissect_octet_seq(proto_tree *tree, } static gint dissect_parameter_sequence(proto_tree *tree, + packet_info *pinfo, tvbuff_t *tvb, gint offset, gboolean little_endian, @@ -3491,23 +2358,20 @@ static gint dissect_parameter_sequence(proto_tree *tree, const char * label, guint32 *pStatusInfo, guint16 vendor_id) { - proto_item * ti = NULL; - proto_tree * rtps_parameter_sequence_tree = NULL; - proto_tree * rtps_parameter_tree = NULL; + proto_item *ti, *param_item; + proto_tree *rtps_parameter_sequence_tree, *rtps_parameter_tree, *subtree; guint16 parameter, param_length; guint8 buffer[MAX_PARAM_SIZE]; gint original_offset = offset; buffer[0] = '\0'; - if (tree) { - ti = proto_tree_add_text(tree, + + ti = proto_tree_add_text(tree, tvb, offset, -1, "%s:", label); - rtps_parameter_sequence_tree = proto_item_add_subtree(ti, - ett_rtps_parameter_sequence); - } + rtps_parameter_sequence_tree = proto_item_add_subtree(ti, ett_rtps_parameter_sequence); /* Loop through all the parameters defined until PID_SENTINEL is found */ for (;;) { @@ -3528,26 +2392,12 @@ static gint dissect_parameter_sequence(proto_tree *tree, * be set later... */ parameter = NEXT_guint16(tvb, offset, little_endian); - if (tree) { - ti = proto_tree_add_text(rtps_parameter_sequence_tree, - tvb, - offset, - -1, - "%s", - val_to_str(parameter, parameter_id_vals, - "Unknown (0x%04x)")); - rtps_parameter_tree = proto_item_add_subtree(ti, ett_rtps_parameter); - proto_tree_add_uint_format(rtps_parameter_tree, - hf_rtps_parameter_id, - tvb, - offset, - 2, - parameter, - "parameterId: 0x%04x (%s)", - parameter, - val_to_str(parameter, parameter_id_vals, - "unknown %04x")); - } + param_item = proto_tree_add_text(rtps_parameter_sequence_tree, tvb, offset, -1, + "%s", val_to_str(parameter, parameter_id_vals, "Unknown (0x%04x)")); + rtps_parameter_tree = proto_item_add_subtree(param_item, ett_rtps_parameter); + + proto_tree_add_uint(rtps_parameter_tree, hf_rtps_parameter_id, + tvb, offset, 2, parameter); offset += 2; if (parameter == PID_SENTINEL) { @@ -3607,20 +2457,11 @@ static gint dissect_parameter_sequence(proto_tree *tree, * +---------------+---------------+---------------+---------------+ */ case PID_STATUS_INFO: { - guint32 si = 0xffffffff; ENSURE_LENGTH(4); - si = rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - hf_rtps_param_status_info, - FALSE, /* ALWAYS in network byte order (big endian) */ - TRUE, /* Is Hex ? */ - FALSE, /* Is Signed ? */ - NULL, /* No Label, use the protocol item ID */ - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_status_info, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + if (pStatusInfo != NULL) { - *pStatusInfo = si; + *pStatusInfo = NEXT_guint32(tvb, offset, little_endian); } break; } @@ -3719,13 +2560,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_PARTICIPANT_LEASE_DURATION: ENSURE_LENGTH(8); - rtps_util_add_ntp_time(rtps_parameter_tree, - tvb, - offset, - little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ntp_time(rtps_parameter_tree, tvb, offset, little_endian, hf_rtps_participant_lease_duration); break; @@ -3744,9 +2579,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "minimum_separation", - buffer, - MAX_PARAM_SIZE); + hf_rtps_time_based_filter_minimum_separation); break; /* 0...2...........7...............15.............23...............31 @@ -3781,16 +2614,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_OWNERSHIP_STRENGTH: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - hf_rtps_param_strength, - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - NULL, /* No Label, use the protocol item ID */ - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_param_strength, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -3828,13 +2652,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_METATRAFFIC_UNICAST_PORT: case PID_DEFAULT_UNICAST_PORT: ENSURE_LENGTH(4); - rtps_util_add_port(rtps_parameter_tree, - tvb, - offset, - little_endian, - "port", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_port(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, hf_rtps_param_port); break; @@ -3848,12 +2667,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_EXPECTS_INLINE_QOS: ENSURE_LENGTH(1); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset, - "inline_qos", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_expects_inline_qos, tvb, offset, 1, ENC_NA ); break; /* 0...2...........7...............15.............23...............31 @@ -3867,13 +2681,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_DEFAULT_UNICAST_IPADDRESS: case PID_MULTICAST_IPADDRESS: case PID_METATRAFFIC_UNICAST_IPADDRESS: - rtps_util_add_ipv4_address_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "address", - buffer, - MAX_PARAM_SIZE); + rtps_util_add_ipv4_address_t(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, hf_param_ip_address); break; @@ -3913,16 +2722,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, ENSURE_LENGTH(2); rtps_util_add_vendor_id(NULL, tvb, - offset, - buffer, - MAX_PARAM_SIZE); - proto_tree_add_text(rtps_parameter_tree, - tvb, - offset, - 2, - "vendorId: %s", - buffer); - + offset); break; @@ -3936,14 +2736,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_RELIABILITY_OFFERED: /* Deprecated */ case PID_RELIABILITY: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - reliability_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_reliability_kind, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -3966,9 +2760,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, rtps_util_add_liveliness_qos(rtps_parameter_tree, tvb, offset, - little_endian, - buffer, - MAX_PARAM_SIZE); + little_endian); break; @@ -3981,14 +2773,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DURABILITY: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "durability", - durability_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_durability, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -4012,12 +2798,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DURABILITY_SERVICE: ENSURE_LENGTH(28); - rtps_util_add_durability_service_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_durability_service_qos(rtps_parameter_tree, tvb, offset, little_endian); break; @@ -4031,14 +2812,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_OWNERSHIP_OFFERED: /* Deprecated */ case PID_OWNERSHIP: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - ownership_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_ownership, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -4075,30 +2850,10 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_PRESENTATION_OFFERED: /* Deprecated */ case PID_PRESENTATION: ENSURE_LENGTH(6); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "access_scope", - presentation_qos_vals, - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset+4, - "coherent_access", - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset+4, - "ordered_access", - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_access_scope, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_coherent_access, tvb, offset+4, 1, ENC_NA ); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_presentation_ordered_access, tvb, offset+5, 1, ENC_NA ); break; @@ -4118,9 +2873,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "period", - buffer, - MAX_PARAM_SIZE); + hf_rtps_deadline_period); break; /* 0...2...........7...............15.............23...............31 @@ -4133,14 +2886,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_DESTINATION_ORDER_OFFERED: /* Deprecated */ case PID_DESTINATION_ORDER: ENSURE_LENGTH(4); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - destination_order_qos_vals, - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_destination_order, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -4160,9 +2907,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); + hf_rtps_latency_budget_duration); break; @@ -4208,10 +2953,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "duration", - buffer, - MAX_PARAM_SIZE); - + hf_rtps_lifespan_duration); break; /* 0...2...........7...............15.............23...............31 @@ -4227,15 +2969,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_USER_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_user_data, - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_user_data); break; /* 0...2...........7...............15.............23...............31 @@ -4251,14 +2986,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_GROUP_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_group_data, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_group_data); break; /* 0...2...........7...............15.............23...............31 @@ -4274,14 +3003,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_TOPIC_DATA: ENSURE_LENGTH(4); - rtps_util_add_seq_octets(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - hf_rtps_param_topic_data, - buffer, - MAX_PARAM_SIZE); + rtps_util_add_seq_octets(rtps_parameter_tree, pinfo, tvb, offset, + little_endian, param_length, hf_rtps_param_topic_data); break; /* 0...2...........7...............15.............23...............31 @@ -4303,14 +3026,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -4332,14 +3048,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DEFAULT_MULTICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; @@ -4362,14 +3071,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_MULTICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -4391,14 +3093,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DEFAULT_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -4420,14 +3115,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_METATRAFFIC_UNICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -4449,14 +3137,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_METATRAFFIC_MULTICAST_LOCATOR: ENSURE_LENGTH(24); - rtps_util_add_locator_t(rtps_parameter_tree, - tvb, - offset, - little_endian, - "locator", - buffer, - MAX_PARAM_SIZE); - + rtps_util_add_locator_t(rtps_parameter_tree, pinfo, tvb, offset, little_endian, "locator"); break; /* 0...2...........7...............15.............23...............31 @@ -4467,18 +3148,15 @@ static gint dissect_parameter_sequence(proto_tree *tree, * +---------------+---------------+---------------+---------------+ */ case PID_PARTICIPANT_BUILTIN_ENDPOINTS: + ENSURE_LENGTH(4); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_participant_builtin_endpoints, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + break; + case PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, /* No protocol ID, use label below */ - little_endian, - TRUE, /* Is Hex ? */ - FALSE, /* Is Signed ? */ - "value", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_participant_manual_liveliness_count, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; /* 0...2...........7...............15.............23...............31 @@ -4492,28 +3170,9 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_HISTORY: ENSURE_LENGTH(8); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_kind_qos(rtps_parameter_tree, - tvb, - offset, - little_endian, - "kind", - history_qos_vals, - buffer+strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+4, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "depth", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_history_kind, tvb, offset, 4, + little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_history_depth, tvb, offset+4, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -4530,41 +3189,11 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_RESOURCE_LIMIT: ENSURE_LENGTH(12); - g_strlcpy(buffer, "{ ", MAX_PARAM_SIZE); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_samples", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+4, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_instances", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, ", ", MAX_PARAM_SIZE); - - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset+8, - -1, /* No protocol ID, use label below */ - little_endian, - FALSE, /* Is Hex ? */ - TRUE, /* Is Signed ? */ - "max_samples_per_instances", - buffer + strlen(buffer), - MAX_PARAM_SIZE-strlen(buffer)); - g_strlcat(buffer, " }", MAX_PARAM_SIZE); + ti = proto_tree_add_text(rtps_parameter_tree, tvb, offset, 12, "Resource Limit"); + subtree = proto_item_add_subtree(ti, ett_rtps_resource_limit); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_samples, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_instances, tvb, offset+4, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_rtps_resource_limit_max_samples_per_instances, tvb, offset+8, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -4767,14 +3396,8 @@ static gint dissect_parameter_sequence(proto_tree *tree, ENSURE_LENGTH(8); /* Dissect filter bitmap */ - temp_offset = rtps_util_add_seq_ulong(rtps_parameter_tree, - tvb, - offset, - little_endian, - param_length, - TRUE, /* is_hex */ - FALSE, /* filterSignature: is_signed */ - "filterBitmap"); + temp_offset = rtps_util_add_seq_ulong(rtps_parameter_tree, tvb, offset, + hf_rtps_filter_bitmap, little_endian, param_length, "filterBitmap"); /* Dissect sequence of FILTER_SIGNATURE */ fs_elem = NEXT_guint32(tvb, temp_offset, little_endian); @@ -5042,33 +3665,17 @@ static gint dissect_parameter_sequence(proto_tree *tree, tvb, offset, little_endian, - "persistence", - buffer, - MAX_PARAM_SIZE); + hf_rtps_persistence); break; case PID_TYPE_CHECKSUM: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, - little_endian, - TRUE, /* Is Hex? */ - FALSE, /* Is signed ? */ - "checksum", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_type_checksum, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; case PID_EXPECTS_ACK: ENSURE_LENGTH(1); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset, - "expectsAck", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_expects_ack, tvb, offset, 1, ENC_NA ); break; case PID_MANAGER_KEY: { @@ -5102,16 +3709,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, case PID_RECV_QUEUE_SIZE: case PID_SEND_QUEUE_SIZE: ENSURE_LENGTH(4); - rtps_util_add_long(rtps_parameter_tree, - tvb, - offset, - -1, - little_endian, - TRUE, /* Is Hex? */ - FALSE, /* Is signed ? */ - "queueSize", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_queue_size, tvb, offset, 4, little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN); break; @@ -5263,14 +3861,14 @@ static gint dissect_parameter_sequence(proto_tree *tree, /* 0...2...........7...............15.............23...............31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | PID_TYPECODE | length | + * | PID_TYPECODE_RTPS2 | length | * +---------------+---------------+---------------+---------------+ * | | * + Type code description + * | | * +---------------+---------------+---------------+---------------+ */ - case PID_TYPECODE: + case PID_TYPECODE_RTPS2: rtps_util_add_typecode(rtps_parameter_tree, tvb, offset, @@ -5295,12 +3893,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, */ case PID_DISABLE_POSITIVE_ACKS: ENSURE_LENGTH(1); - rtps_util_add_boolean(rtps_parameter_tree, - tvb, - offset, - "disablePositiveAcks", - buffer, - MAX_PARAM_SIZE); + proto_tree_add_item(rtps_parameter_tree, hf_rtps_disable_positive_ack, tvb, offset, 1, ENC_NA ); break; /* 0...2...........7...............15.............23...............31 @@ -5369,11 +3962,7 @@ static gint dissect_parameter_sequence(proto_tree *tree, temp_buff); channel_tree = proto_item_add_subtree(ti_channel, ett_rtps_locator_filter_channel); } - off = rtps_util_add_locator_list(channel_tree, - tvb, - off, - temp_buff, - little_endian); + off = rtps_util_add_locator_list(channel_tree, pinfo, tvb, off, temp_buff, little_endian); /* Filter expression */ off = rtps_util_add_string(channel_tree, tvb, @@ -5397,14 +3986,14 @@ static gint dissect_parameter_sequence(proto_tree *tree, switch(parameter) { /* 0...2...........7...............15.............23...............31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | PID_TYPECODE | length | + * | PID_TYPECODE_RTPS2 | length | * +---------------+---------------+---------------+---------------+ * | | * + Type code description + * | | * +---------------+---------------+---------------+---------------+ */ - case PID_TYPECODE: + case PID_TYPECODE_RTPS2: rtps_util_add_typecode(rtps_parameter_tree, tvb, offset, @@ -5451,41 +4040,6 @@ static gint dissect_parameter_sequence(proto_tree *tree, #undef ENSURE_LENGTH - - -/* *********************************************************************** */ -/* * P A D * */ -/* *********************************************************************** */ -static void dissect_PAD(tvbuff_t *tvb, - packet_info *pinfo, - gint offset, - guint8 flags, - gboolean little_endian, - int octets_to_next_header _U_, - proto_tree *tree) { - proto_item* item; - /* 0...2...........7...............15.............23...............31 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | PAD |X|X|X|X|X|X|X|E| octetsToNextHeader | - * +---------------+---------------+---------------+---------------+ - */ - rtps_util_decode_flags(tree, tvb, offset + 1, flags, PAD_FLAGS); - - 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 (NEXT_guint16(tvb, offset + 2, little_endian) != 0) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Should be ZERO"); - } -} - - - - - /* *********************************************************************** */ /* * D A T A * */ /* *********************************************************************** */ @@ -5547,8 +4101,8 @@ static void dissect_DATA(tvbuff_t *tvb, /* Calculates the minimum length for this submessage */ min_len = 20; - if ((flags & FLAG_DATA_Q) != 0) min_len += 4; - if ((flags & FLAG_DATA_D) != 0) min_len += 4; + if ((flags & FLAG_DATA_Q_RTPS2) != 0) min_len += 4; + if ((flags & FLAG_DATA_D_RTPS2) != 0) min_len += 4; if ((flags & FLAG_DATA_H) != 0) min_len += 12; if (octets_to_next_header < min_len) { @@ -5655,25 +4209,17 @@ static void dissect_DATA(tvbuff_t *tvb, } /* InlineQos */ - if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + if ((flags & FLAG_DATA_Q_RTPS2) != 0) { + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - NULL, - vendor_id); + "inlineQos", NULL, vendor_id); } /* SerializedData */ - if ((flags & FLAG_DATA_D) != 0) { - dissect_serialized_data(tree, - tvb, - offset, + if ((flags & FLAG_DATA_D_RTPS2) != 0) { + dissect_serialized_data(tree, pinfo, tvb, offset, octets_to_next_header - (offset - old_offset) + 4, - "serializedData", - vendor_id); + "serializedData", vendor_id); } info_summary_append_ex(pinfo, wid, status_info); } @@ -5875,25 +4421,17 @@ static void dissect_DATA_FRAG(tvbuff_t *tvb, offset += 4; /* InlineQos */ - if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + if ((flags & FLAG_DATA_Q_RTPS2) != 0) { + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - NULL, - vendor_id); + "inlineQos", NULL, vendor_id); } /* SerializedData */ - if ((flags & FLAG_DATA_D) != 0) { - dissect_serialized_data(tree, - tvb, - offset, + if ((flags & FLAG_DATA_D_RTPS2) != 0) { + dissect_serialized_data(tree, pinfo, tvb, offset, octets_to_next_header - (offset - old_offset) + 4, - "serializedData", - vendor_id); + "serializedData", vendor_id); } } @@ -5997,25 +4535,17 @@ static void dissect_NOKEY_DATA(tvbuff_t *tvb, offset += 8; /* InlineQos */ - if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + if ((flags & FLAG_DATA_Q_RTPS2) != 0) { + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - NULL, - vendor_id); + "inlineQos", NULL, vendor_id); } /* SerializedData */ - if ((flags & FLAG_DATA_D) != 0) { - dissect_serialized_data(tree, - tvb, - offset, + if ((flags & FLAG_DATA_D_RTPS2) != 0) { + dissect_serialized_data(tree, pinfo, tvb, offset, octets_to_next_header - (offset - old_offset) + 4, - "serializedData", - vendor_id); + "serializedData", vendor_id); } } @@ -6161,25 +4691,17 @@ static void dissect_NOKEY_DATA_FRAG(tvbuff_t *tvb, offset += 2; /* InlineQos */ - if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + if ((flags & FLAG_DATA_Q_RTPS2) != 0) { + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - NULL, - vendor_id); + "inlineQos", NULL, vendor_id); } /* SerializedData */ - if ((flags & FLAG_DATA_D) != 0) { - dissect_serialized_data(tree, - tvb, - offset, + if ((flags & FLAG_DATA_D_RTPS2) != 0) { + dissect_serialized_data(tree, pinfo, tvb,offset, octets_to_next_header - (offset - old_offset) + 4, - "serializedData", - vendor_id); + "serializedData", vendor_id); } } @@ -6866,181 +5388,6 @@ static void dissect_GAP(tvbuff_t *tvb, /* *********************************************************************** */ -/* * I N F O _ T S * */ -/* *********************************************************************** */ -static void dissect_INFO_TS(tvbuff_t *tvb, - packet_info *pinfo, - gint offset, - guint8 flags, - gboolean little_endian, - int octets_to_next_header, - proto_tree *tree) { - /* - * 0...2...........7...............15.............23...............31 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | INFO_TS |X|X|X|X|X|X|I|E| octetsToNextHeader | - * +---------------+---------------+---------------+---------------+ - * | | - * + Timestamp timestamp [only if I==1] + - * | | - * +---------------+---------------+---------------+---------------+ - */ - - int min_len; - proto_item* octet_item; - - rtps_util_decode_flags(tree, tvb, offset + 1, flags, INFO_TS_FLAGS); - - 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); - - min_len = 0; - if ((flags & FLAG_INFO_TS_T) == 0) min_len += 8; - - if (octets_to_next_header != min_len) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == %u)", min_len); - return; - } - - /* Skip decoding the entire packet if (tree == NULL) */ - if (tree == NULL) { - return; - } - - offset += 4; - - if ((flags & FLAG_INFO_TS_T) == 0) { - rtps_util_add_ntp_time(tree, - tvb, - offset, - little_endian, - "timestamp", - NULL, - 0); - } -} - - -/* *********************************************************************** */ -/* * I N F O _ S R C * */ -/* *********************************************************************** */ -static void dissect_INFO_SRC(tvbuff_t *tvb, - packet_info *pinfo, - gint offset, - guint8 flags, - gboolean little_endian, - int octets_to_next_header, - proto_tree *tree) { - /* - * 0...2...........7...............15.............23...............31 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | INFO_SRC |X|X|X|X|X|X|X|E| octetsToNextHeader | - * +---------------+---------------+---------------+---------------+ - * | long unused | - * +---------------+---------------+---------------+---------------+ - * | ProtocolVersion version | VendorId vendor | - * +---------------+---------------+---------------+---------------+ - * | | - * + + - * | GuidPrefix guidPrefix | - * + + - * | | - * +---------------+---------------+---------------+---------------+ - */ - proto_item* octet_item; - - rtps_util_decode_flags(tree, tvb, offset + 1, flags, INFO_SRC_FLAGS); - - 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 != 16) { - expert_add_info_format(pinfo, octet_item, PI_PROTOCOL, PI_WARN, "(Error: should be == 16)"); - return; - } - - /* Skip decoding the entire packet if (tree == NULL) */ - if (tree == NULL) { - return; - } - - offset += 4; - - /* Ip Address */ - { - guint32 ip = NEXT_guint32(tvb, offset, little_endian); - proto_tree_add_text(tree, - tvb, - offset, - 4, - "unused: 0x%08x (appIpAddress: %d.%d.%d.%d)", - ip, - (ip >> 24) & 0xff, - (ip >> 16) & 0xff, - (ip >> 8) & 0xff, - ip & 0xff); - offset += 4; - } - - /* Version */ - { - guint8 major = 0; - guint8 minor = 0; - major = tvb_get_guint8(tvb, offset); - minor = tvb_get_guint8(tvb, offset+1); - - proto_tree_add_text(tree, - tvb, - offset, - 2, - "version: %d.%d", - major, - minor); - offset += 2; - } - - /* Vendor ID */ - { - guint8 vendor[MAX_VENDOR_ID_SIZE]; - rtps_util_add_vendor_id(NULL, - tvb, - offset, - vendor, - MAX_VENDOR_ID_SIZE); - proto_tree_add_text(tree, - tvb, - offset, - 2, - "vendor: %s", - vendor); - offset += 2; - } - - { - /* guint8 temp_buffer[MAX_GUID_PREFIX_SIZE]; */ - rtps_util_add_guid_prefix(tree, - tvb, - offset, - hf_rtps_sm_guid_prefix, - hf_rtps_sm_host_id, - hf_rtps_sm_app_id, - hf_rtps_sm_counter, - NULL, /* Use default 'guidPrefix' */ - NULL, - 0); - } -} - - -/* *********************************************************************** */ /* * I N F O _ R E P L Y _ I P 4 * */ /* *********************************************************************** */ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb, @@ -7093,21 +5440,15 @@ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb, /* unicastReplyLocator */ - rtps_util_add_locator_udp_v4(tree, - tvb, - offset, - "unicastReplyLocator", - little_endian); + rtps_util_add_locator_udp_v4(tree, pinfo, tvb, offset, + "unicastReplyLocator", little_endian); offset += 8; /* multicastReplyLocator */ if ((flags & FLAG_INFO_REPLY_IP4_M) != 0) { - rtps_util_add_locator_udp_v4(tree, - tvb, - offset, - "multicastReplyLocator", - little_endian); + rtps_util_add_locator_udp_v4(tree, pinfo, tvb, offset, + "multicastReplyLocator", little_endian); offset += 8; } } @@ -7224,20 +5565,11 @@ static void dissect_INFO_REPLY(tvbuff_t *tvb, /* unicastReplyLocatorList */ - offset = rtps_util_add_locator_list(tree, - tvb, - offset, - "unicastReplyLocatorList", - little_endian); - + offset = rtps_util_add_locator_list(tree, pinfo, tvb, offset, "unicastReplyLocatorList", little_endian); /* multicastReplyLocatorList */ if ((flags & FLAG_INFO_REPLY_M) != 0) { - offset = rtps_util_add_locator_list(tree, - tvb, - offset, - "multicastReplyLocatorList", - little_endian); + offset = rtps_util_add_locator_list(tree, pinfo, tvb, offset, "multicastReplyLocatorList", little_endian); } } @@ -7346,14 +5678,9 @@ static void dissect_RTPS_DATA(tvbuff_t *tvb, offset += 12; if ((flags & FLAG_RTPS_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - &status_info, - vendor_id); + "inlineQos", &status_info, vendor_id); } info_summary_append_ex(pinfo, wid, status_info); return; @@ -7428,14 +5755,9 @@ static void dissect_RTPS_DATA(tvbuff_t *tvb, /* InlineQos */ if ((flags & FLAG_RTPS_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - &status_info, - vendor_id); + "inlineQos", &status_info, vendor_id); } /* SerializedData */ @@ -7532,12 +5854,9 @@ static void dissect_RTPS_DATA(tvbuff_t *tvb, } /* At the end still dissect the rest of the bytes as raw data */ - dissect_serialized_data(tree, - tvb, - offset, + dissect_serialized_data(tree, pinfo, tvb, offset, octets_to_next_header - (offset - old_offset) + 4, - label, - vendor_id); + label, vendor_id); } } @@ -7623,14 +5942,9 @@ static void dissect_RTPS_DATA_FRAG(tvbuff_t *tvb, offset += 24; if ((flags & FLAG_RTPS_DATA_FRAG_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - &status_info, - vendor_id); + "inlineQos", &status_info, vendor_id); } info_summary_append_ex(pinfo, wid, status_info); return; @@ -7743,14 +6057,9 @@ static void dissect_RTPS_DATA_FRAG(tvbuff_t *tvb, /* InlineQos */ if ((flags & FLAG_RTPS_DATA_FRAG_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - &status_info, - vendor_id); + "inlineQos", &status_info, vendor_id); } /* SerializedData */ @@ -7759,12 +6068,9 @@ static void dissect_RTPS_DATA_FRAG(tvbuff_t *tvb, if ((flags & FLAG_RTPS_DATA_FRAG_K) != 0) { label = "serializedKey"; } - dissect_serialized_data(tree, - tvb, - offset, + dissect_serialized_data(tree, pinfo, tvb, offset, octets_to_next_header - (offset - old_offset) + 4, - label, - vendor_id); + label, vendor_id); } info_summary_append_ex(pinfo, wid, status_info); } @@ -7894,15 +6200,10 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, wid = NEXT_guint32(tvb, offset, little_endian); offset += 24; - if ((flags & FLAG_DATA_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, - octets_to_next_header - (offset - old_offset) + 4, - "inlineQos", - &status_info, - vendor_id); + if ((flags & FLAG_DATA_Q_RTPS2) != 0) { + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, + little_endian, octets_to_next_header - (offset - old_offset) + 4, + "inlineQos", &status_info, vendor_id); } info_summary_append_ex(pinfo, wid, status_info); return; @@ -7998,14 +6299,9 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, /* Parameter list (if Q==1) */ /* InlineQos */ if ((flags & FLAG_RTPS_DATA_BATCH_Q) != 0) { - offset = dissect_parameter_sequence(tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "batchInlineQos", - &status_info, - vendor_id); + "batchInlineQos", &status_info, vendor_id); } /* octetsToSLEncapsulationId */ @@ -8120,9 +6416,7 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, tvb, offset, little_endian, - "timestamp", - NULL, - 0); + hf_rtps_data_batch_timestamp); offset += 8; } @@ -8143,14 +6437,9 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, /* Parameter list [only if Q==1] */ if ((flags2 & FLAG_SAMPLE_INFO_Q) != 0) { - offset = dissect_parameter_sequence(si_tree, - tvb, - offset, - little_endian, + offset = dissect_parameter_sequence(si_tree, pinfo, tvb, offset, little_endian, octets_to_next_header - (offset - old_offset) + 4, - "sampleInlineQos", - &status_info, - vendor_id); + "sampleInlineQos", &status_info, vendor_id); } proto_item_set_len(ti, offset - offset_begin_sampleinfo); sample_info_count++; @@ -8261,18 +6550,7 @@ static gboolean dissect_rtps(tvbuff_t *tvb, col_clear(pinfo->cinfo, COL_INFO); /* Check if is NDDSPING */ - { - guint8 nddsPing[8]; - tvb_memcpy(tvb, nddsPing, offset+8, 8); - is_ping = (nddsPing[0] == 'N' && - nddsPing[1] == 'D' && - nddsPing[2] == 'D' && - nddsPing[3] == 'S' && - nddsPing[4] == 'P' && - nddsPing[5] == 'I' && - nddsPing[6] == 'N' && - nddsPing[7] == 'G'); - } + is_ping = rtps_is_ping(tvb, pinfo, offset+8); /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_rtps, tvb, 0, -1, ENC_NA); @@ -8283,7 +6561,7 @@ static gboolean dissect_rtps(tvbuff_t *tvb, /* Vendor Id */ vendor_id = NEXT_guint16(tvb, offset+6, FALSE); - rtps_util_add_vendor_id(rtps_tree, tvb, offset+6, NULL, 0); + rtps_util_add_vendor_id(rtps_tree, tvb, offset+6); /* If is not PING, the next 12 bytes are the GUID prefix */ if (!is_ping) { @@ -8299,9 +6577,6 @@ static gboolean dissect_rtps(tvbuff_t *tvb, 0); } - if (is_ping) { - col_add_str(pinfo->cinfo, COL_INFO, "PING"); - } #ifdef RTI_BUILD else { pinfo->guid_prefix_host = tvb_get_ntohl(tvb, offset + 8); @@ -8731,38 +7006,6 @@ void proto_register_rtps2(void) { */ static hf_register_info hf[] = { - /* Protocol Version (composed as major.minor) -------------------------- */ - { &hf_rtps_protocol_version, { - "version", - "rtps2.version", - FT_NONE, - BASE_NONE, - NULL, - 0, - "RTPS protocol version number", - HFILL } - }, - { &hf_rtps_protocol_version_major, { - "major", - "rtps2.version.major", - FT_INT8, - BASE_DEC, - NULL, - 0, - "RTPS major protocol version number", - HFILL } - }, - { &hf_rtps_protocol_version_minor, { - "minor", - "rtps2.version.minor", - FT_INT8, - BASE_DEC, - NULL, - 0, - "RTPS minor protocol version number", - HFILL } - }, - /* Domain Participant and Participant Index ---------------------------- */ { &hf_rtps_domain_id, { "domain_id", @@ -8796,18 +7039,6 @@ void proto_register_rtps2(void) { HFILL } }, - /* Vendor ID ----------------------------------------------------------- */ - { &hf_rtps_vendor_id, { - "vendorId", - "rtps2.vendorId", - FT_UINT16, - BASE_HEX, - NULL, - 0, - "Unique identifier of the DDS vendor that generated this packet", - HFILL } - }, - /* Guid Prefix for the Packet ------------------------------------------ */ { &hf_rtps_guid_prefix, { "guidPrefix", @@ -9057,20 +7288,6 @@ void proto_register_rtps2(void) { HFILL } }, - - - /* Sequence number ----------------------------------------------------- */ - { &hf_rtps_sm_seq_number, { - "writerSeqNumber", - "rtps2.sm.seqNumber", - FT_INT64, - BASE_DEC, - NULL, - 0, - "Writer sequence number", - HFILL } - }, - /* Parameter Id -------------------------------------------------------- */ { &hf_rtps_parameter_id, { "parameterId", @@ -9107,39 +7324,6 @@ void proto_register_rtps2(void) { HFILL } }, - /* Parameter / NtpTime ------------------------------------------------- */ - { &hf_rtps_param_ntpt, { - "ntpTime", - "rtps2.param.ntpTime", - FT_NONE, - BASE_NONE, - NULL, - 0, - "Time using the NTP standard format", - HFILL } - }, - { &hf_rtps_param_ntpt_sec, { - "seconds", - "rtps2.param.ntpTime.sec", - FT_INT32, - BASE_DEC, - NULL, - 0, - "The 'second' component of a NTP time", - HFILL } - }, - { &hf_rtps_param_ntpt_fraction, { - "fraction", - "rtps2.param.ntpTime.fraction", - FT_UINT32, - BASE_DEC, - NULL, - 0, - "The 'fraction' component of a NTP time", - HFILL } - }, - - /* Parameter / Topic --------------------------------------------------- */ { &hf_rtps_param_topic_name, { "topic", @@ -9270,6 +7454,179 @@ void proto_register_rtps2(void) { HFILL } }, + { &hf_rtps_participant_lease_duration, + { "Duration", "rtps2.participant_lease_duration", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_time_based_filter_minimum_separation, + { "Minimum Separation", "rtps2.time_based_filter.minimum_separation", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_deadline_period, + { "Period", "rtps2.deadline_period", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_latency_budget_duration, + { "Duration", "rtps2.latency_budget.duration", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_lifespan_duration, + { "Duration", "rtps2.lifespan", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_persistence, + { "Persistence", "rtps2.persistence", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_data_batch_timestamp, + { "Timestamp", "rtps2.data_batch.timestamp", + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, + "Time using the NTP standard format", HFILL } + }, + + { &hf_rtps_participant_builtin_endpoints, + { "BuiltIn Endpoint", "rtps.participant_builtin_endpoints", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_participant_manual_liveliness_count, + { "Manual Liveliness Count", "rtps.participant_manual_liveliness_count", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_history_depth, + { "Depth", "rtps.history_depth", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_samples, + { "Max Samples", "rtps.resource_limit.max_samples", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_instances, + { "Max Instances", "rtps.resource_limit.max_instances", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_resource_limit_max_samples_per_instances, + { "Max Samples Per Instance", "rtps.resource_limit.max_samples_per_instance", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_filter_bitmap, + { "Filter Bitmap", "rtps.filter_bitmap", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_type_checksum, + { "Checksum", "rtps.type_checksum", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_queue_size, + { "queueSize", "rtps.queue_size", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_param_ip_address, + { "Address", "rtps.param.ip_address", + FT_IPv4, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_param_port, + { "Port", "rtps.param.port", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_expects_inline_qos, + { "Inline QoS", "rtps.expects_inline_qos", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_coherent_access, + { "Coherent Access", "rtps.presentation.coherent_access", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_ordered_access, + { "Ordered Access", "rtps.presentation.ordered_access", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_expects_ack, + { "expectsAck", "rtps.expects_ack", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_disable_positive_ack, + { "disablePositiveAcks", "rtps.disable_positive_ack", + FT_BOOLEAN, 8, TFS(&tfs_true_false), 0, + NULL, HFILL } + }, + + { &hf_rtps_reliability_kind, + { "Kind", "rtps.reliability_kind", + FT_UINT32, BASE_HEX, VALS(reliability_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_durability, + { "Durability", "rtps.durability", + FT_UINT32, BASE_HEX, VALS(durability_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_ownership, + { "Kind", "rtps.ownership", + FT_UINT32, BASE_HEX, VALS(ownership_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_presentation_access_scope, + { "Access Scope", "rtps.presentation.access_scope", + FT_UINT32, BASE_HEX, VALS(presentation_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_destination_order, + { "Kind", "rtps.destination_order", + FT_UINT32, BASE_HEX, VALS(destination_order_qos_vals), 0, + NULL, HFILL } + }, + + { &hf_rtps_history_kind, + { "Kind", "rtps.history.kind", + FT_UINT32, BASE_HEX, VALS(history_qos_vals), 0, + NULL, HFILL } + }, }; static gint *ett[] = { @@ -9298,7 +7655,8 @@ void proto_register_rtps2(void) { &ett_rtps_sample_info, &ett_rtps_sample_batch_list, &ett_rtps_locator_filter_channel, - &ett_rtps_locator_filter_locator + &ett_rtps_locator_filter_locator, + &ett_rtps_resource_limit }; module_t *rtps_module; diff --git a/epan/dissectors/packet-rtps2.h b/epan/dissectors/packet-rtps2.h index 1f229197e4..6b69385152 100644 --- a/epan/dissectors/packet-rtps2.h +++ b/epan/dissectors/packet-rtps2.h @@ -57,34 +57,6 @@ extern "C" { #endif -typedef enum { - RTI_CDR_TK_NULL=0, - RTI_CDR_TK_SHORT, - RTI_CDR_TK_LONG, - RTI_CDR_TK_USHORT, - RTI_CDR_TK_ULONG, - RTI_CDR_TK_FLOAT, - RTI_CDR_TK_DOUBLE, - RTI_CDR_TK_BOOLEAN, - RTI_CDR_TK_CHAR, - RTI_CDR_TK_OCTET, - RTI_CDR_TK_STRUCT, - RTI_CDR_TK_UNION, - RTI_CDR_TK_ENUM, - RTI_CDR_TK_STRING, - RTI_CDR_TK_SEQUENCE, - RTI_CDR_TK_ARRAY, - RTI_CDR_TK_ALIAS, - RTI_CDR_TK_LONGLONG, - RTI_CDR_TK_ULONGLONG, - RTI_CDR_TK_LONGDOUBLE, - RTI_CDR_TK_WCHAR, - RTI_CDR_TK_WSTRING, - RTI_CDR_TK_VALUE, - RTI_CDR_TK_VALUE_PARARM -} RTICdrTCKind; - - /* Traffic type */ #define PORT_BASE (7400) @@ -95,8 +67,8 @@ typedef enum { /* Flags defined in the 'flag' bitmask of a submessage */ #define FLAG_E (0x01) /* Common to all the submessages */ -#define FLAG_DATA_Q (0x02) -#define FLAG_DATA_D (0x04) +#define FLAG_DATA_Q_RTPS2 (0x02) +#define FLAG_DATA_D_RTPS2 (0x04) #define FLAG_DATA_H (0x08) #define FLAG_DATA_I (0x10) @@ -137,56 +109,9 @@ typedef enum { /* The following PIDs are defined since RTPS 1.0 */ -#define PID_PAD (0x0000) -#define PID_SENTINEL (0x0001) -#define PID_PARTICIPANT_LEASE_DURATION (0x0002) -#define PID_TIME_BASED_FILTER (0x0004) -#define PID_TOPIC_NAME (0x0005) -#define PID_OWNERSHIP_STRENGTH (0x0006) -#define PID_TYPE_NAME (0x0007) -#define PID_METATRAFFIC_MULTICAST_IPADDRESS (0x000b) -#define PID_DEFAULT_UNICAST_IPADDRESS (0x000c) -#define PID_METATRAFFIC_UNICAST_PORT (0x000d) -#define PID_DEFAULT_UNICAST_PORT (0x000e) -#define PID_MULTICAST_IPADDRESS (0x0011) -#define PID_PROTOCOL_VERSION (0x0015) -#define PID_VENDOR_ID (0x0016) -#define PID_RELIABILITY (0x001a) -#define PID_LIVELINESS (0x001b) -#define PID_DURABILITY (0x001d) -#define PID_DURABILITY_SERVICE (0x001e) -#define PID_OWNERSHIP (0x001f) -#define PID_PRESENTATION (0x0021) -#define PID_DEADLINE (0x0023) -#define PID_DESTINATION_ORDER (0x0025) -#define PID_LATENCY_BUDGET (0x0027) -#define PID_PARTITION (0x0029) -#define PID_LIFESPAN (0x002b) -#define PID_USER_DATA (0x002c) -#define PID_GROUP_DATA (0x002d) -#define PID_TOPIC_DATA (0x002e) -#define PID_UNICAST_LOCATOR (0x002f) -#define PID_MULTICAST_LOCATOR (0x0030) -#define PID_DEFAULT_UNICAST_LOCATOR (0x0031) -#define PID_METATRAFFIC_UNICAST_LOCATOR (0x0032) -#define PID_METATRAFFIC_MULTICAST_LOCATOR (0x0033) -#define PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT (0x0034) -#define PID_CONTENT_FILTER_PROPERTY (0x0035) -#define PID_PROPERTY_LIST_OLD (0x0036) /* For compatibility between 4.2d and 4.2e */ -#define PID_HISTORY (0x0040) -#define PID_RESOURCE_LIMIT (0x0041) -#define PID_EXPECTS_INLINE_QOS (0x0043) -#define PID_PARTICIPANT_BUILTIN_ENDPOINTS (0x0044) -#define PID_METATRAFFIC_UNICAST_IPADDRESS (0x0045) -#define PID_METATRAFFIC_MULTICAST_PORT (0x0046) #define PID_DEFAULT_MULTICAST_LOCATOR (0x0048) #define PID_TRANSPORT_PRIORITY (0x0049) -#define PID_PARTICIPANT_GUID (0x0050) -#define PID_PARTICIPANT_ENTITY_ID (0x0051) -#define PID_GROUP_GUID (0x0052) -#define PID_GROUP_ENTITY_ID (0x0053) #define PID_CONTENT_FILTER_INFO (0x0055) -#define PID_COHERENT_SET (0x0056) #define PID_DIRECTED_WRITE (0x0057) #define PID_BUILTIN_ENDPOINT_SET (0x0058) #define PID_PROPERTY_LIST (0x0059) /* RTI DDS 4.2e and newer */ @@ -202,34 +127,11 @@ typedef enum { #define PID_PLUGIN_PROMISCUITY_KIND (0x8001) #define PID_ENTITY_VIRTUAL_GUID (0x8002) #define PID_SERVICE_KIND (0x8003) -#define PID_TYPECODE (0x8004) /* Was: 0x47 in RTPS 1.2 */ +#define PID_TYPECODE_RTPS2 (0x8004) /* Was: 0x47 in RTPS 1.2 */ #define PID_DISABLE_POSITIVE_ACKS (0x8005) #define PID_LOCATOR_FILTER_LIST (0x8006) -/* The following QoS are deprecated (used in RTPS 1.0 and older) */ -#define PID_PERSISTENCE (0x0003) -#define PID_TYPE_CHECKSUM (0x0008) -#define PID_TYPE2_NAME (0x0009) -#define PID_TYPE2_CHECKSUM (0x000a) -#define PID_IS_RELIABLE (0x000f) -#define PID_EXPECTS_ACK (0x0010) -#define PID_MANAGER_KEY (0x0012) -#define PID_SEND_QUEUE_SIZE (0x0013) -#define PID_RECV_QUEUE_SIZE (0x0018) -#define PID_VARGAPPS_SEQUENCE_NUMBER_LAST (0x0017) -#define PID_RELIABILITY_ENABLED (0x0014) -#define PID_RELIABILITY_OFFERED (0x0019) -#define PID_LIVELINESS_OFFERED (0x001c) -#define PID_OWNERSHIP_OFFERED (0x0020) -#define PID_PRESENTATION_OFFERED (0x0022) -#define PID_DEADLINE_OFFERED (0x0024) -#define PID_DESTINATION_ORDER_OFFERED (0x0026) -#define PID_LATENCY_BUDGET_OFFERED (0x0028) -#define PID_PARTITION_OFFERED (0x002a) - - - /* appId.appKind possible values */ #define APPKIND_UNKNOWN (0x00) #define APPKIND_MANAGED_APPLICATION (0x01) @@ -312,27 +214,6 @@ typedef enum { #define ENCAPSULATION_PL_CDR_BE (0x0002) #define ENCAPSULATION_PL_CDR_LE (0x0003) - -/* An invalid IP Address: - * Make sure the _STRING macro is bigger than a normal IP - */ -#define IPADDRESS_INVALID (0) -#define IPADDRESS_INVALID_STRING "ADDRESS_INVALID (0x00000000)" - -/* Identifies the value of an invalid port number: - * Make sure the _STRING macro is bigger than a normal port - */ -#define PORT_INVALID (0) -#define PORT_INVALID_STRING "PORT_INVALID" - -/* Protocol Vendor Information (guint16) */ -#define RTPS_VENDOR_UNKNOWN (0x0000) -#define RTPS_VENDOR_UNKNOWN_STRING "VENDOR_ID_UNKNOWN (0x0000)" -#define RTPS_VENDOR_RTI (0x0101) -#define RTPS_VENDOR_RTI_STRING "Real-Time Innovations, Inc." -#define RTPS_VENDOR_TOC (0x0106) -#define RTPS_VENDOR_TOC_STRING "Twin Oaks Computing, Inc." - /* Parameter Liveliness */ #define LIVELINESS_AUTOMATIC (0) #define LIVELINESS_BY_PARTICIPANT (1) |