diff options
author | Juanjo Martin <juanjo@rti.com> | 2016-02-12 18:41:38 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-02-16 07:16:50 +0000 |
commit | c97a97aa9e56dd777791bd19b8829e8e87b8cadc (patch) | |
tree | 62cb84c7f8d621e94782d9d19f6a9801e38b8864 | |
parent | d1474f1ce8b0880bf3d7c6b4bcb8be688344df58 (diff) | |
download | wireshark-c97a97aa9e56dd777791bd19b8829e8e87b8cadc.tar.gz |
RTPS: Added new locator kinds and upgraded to latest set of ids
The standard says that UDPv6 is the index 2. However, the dissector
contained the old implementation of RTI DDS (which had SHMEM = 2
and UDPv6 = 5). I have updated the dissector to be compliant with
the standard and indirectly be compliant with the new version of
RTI DDS which now implements the standard in this aspect.
Change-Id: Iaade0e457fda35362c04a7658d62242cf8868127
Reviewed-on: https://code.wireshark.org/review/13922
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-rtps.c | 73 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps.h | 35 |
2 files changed, 83 insertions, 25 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index ce9a7b554c..93cf19c109 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -148,6 +148,8 @@ 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_logical_port = -1; +static int hf_rtps_locator_public_address_port = -1; static int hf_rtps_locator_ipv4 = -1; static int hf_rtps_locator_ipv6 = -1; static int hf_rtps_participant_builtin_endpoints= -1; @@ -497,6 +499,11 @@ 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_TCPV4_LAN, "LOCATOR_KIND_TCPV4_LAN" }, + { LOCATOR_KIND_TCPV4_WAN, "LOCATOR_KIND_TCPV4_WAN" }, + { LOCATOR_KIND_TLSV4_LAN, "LOCATOR_KIND_TLSV4_LAN" }, + { LOCATOR_KIND_TLSV4_WAN, "LOCATOR_KIND_TLSV4_WAN" }, + { LOCATOR_KIND_SHMEM, "LOCATOR_KIND_SHMEM" }, { LOCATOR_KIND_RESERVED, "LOCATOR_KIND_RESERVED" }, { 0, NULL } }; @@ -1377,20 +1384,54 @@ void rtps_util_add_locator_t(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb gint32 kind; guint32 port; - locator_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_rtps_locator, NULL, label); + locator_tree = proto_tree_add_subtree(tree, tvb, offset, 24, ett_rtps_locator, + NULL, label); kind = NEXT_guint32(tvb, offset, little_endian); port = NEXT_guint32(tvb, offset+4, little_endian); - 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(pinfo, ti, &ei_rtps_locator_port); - - 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); + switch (kind) { + case LOCATOR_KIND_UDPV4: { + ti = proto_tree_add_int(locator_tree, hf_rtps_locator_port, tvb, offset+4, 4, port); + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv4, tvb, offset+20, 4, + ENC_BIG_ENDIAN); + if (port == 0) + expert_add_info(pinfo, ti, &ei_rtps_locator_port); + break; + } + case LOCATOR_KIND_TCPV4_LAN: + case LOCATOR_KIND_TCPV4_WAN: + case LOCATOR_KIND_TLSV4_LAN: + case LOCATOR_KIND_TLSV4_WAN: { + ti = proto_tree_add_int(locator_tree, hf_rtps_logical_port, tvb, offset+4, 4, port); + if (port == 0) + expert_add_info(pinfo, ti, &ei_rtps_locator_port); + kind = NEXT_guint16(tvb, offset+16, little_endian); + if (kind == 0xFFFF) { /* IPv4 format */ + proto_tree_add_item(locator_tree, hf_rtps_locator_public_address_port, + tvb, offset+18, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv4, tvb, offset+20, + 4, ENC_BIG_ENDIAN); + } else { /* IPv6 format */ + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv6, tvb, offset+8, + 16, ENC_NA); + } + break; + } + case LOCATOR_KIND_SHMEM: { + ti = proto_tree_add_int(locator_tree, hf_rtps_locator_port, tvb, offset+4, + 4, port); + if (port == 0) + expert_add_info(pinfo, ti, &ei_rtps_locator_port); + break; + } + case LOCATOR_KIND_UDPV6: { + proto_tree_add_item(locator_tree, hf_rtps_locator_ipv6, tvb, offset+8, 16, ENC_NA); + break; + } + /* Default case, we already have the locator kind so don't do anything */ + default: + break; } } @@ -8547,6 +8588,18 @@ void proto_register_rtps(void) { NULL, HFILL } }, + { &hf_rtps_logical_port, + { "RTPS Logical Port", "rtps.locator.port", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + + { &hf_rtps_locator_public_address_port, + { "Public Address Port", "rtps.locator.public_address_port", + FT_INT32, BASE_DEC, NULL, 0, + NULL, HFILL } + }, + { &hf_rtps_locator_ipv4, { "Address", "rtps.locator.ipv4", FT_IPv4, BASE_NONE, NULL, 0, diff --git a/epan/dissectors/packet-rtps.h b/epan/dissectors/packet-rtps.h index b96cf14224..27135725b4 100644 --- a/epan/dissectors/packet-rtps.h +++ b/epan/dissectors/packet-rtps.h @@ -420,11 +420,16 @@ typedef struct _rtps_dissector_data { #define PRESENTATION_TOPIC (1) #define PRESENTATION_GROUP (2) - #define LOCATOR_KIND_INVALID (-1) #define LOCATOR_KIND_RESERVED (0) #define LOCATOR_KIND_UDPV4 (1) #define LOCATOR_KIND_UDPV6 (2) +/* Vendor specific - rti */ +#define LOCATOR_KIND_TCPV4_LAN (8) +#define LOCATOR_KIND_TCPV4_WAN (9) +#define LOCATOR_KIND_TLSV4_LAN (10) +#define LOCATOR_KIND_TLSV4_WAN (11) +#define LOCATOR_KIND_SHMEM (0x01000000) /* History Kind */ #define HISTORY_KIND_KEEP_LAST (0) @@ -453,20 +458,20 @@ typedef struct _rtps_dissector_data { #define APPLICATION_ORDERED_ACKNOWLEDGMENT (2) #define APPLICATION_EXPLICIT_ACKNOWLEDGMENT (3) -/* NDDS_TRANSPORT_CLASSID */ -#define NDDS_TRANSPORT_CLASSID_ANY (0) -#define NDDS_TRANSPORT_CLASSID_UDPv4 (1) -#define NDDS_TRANSPORT_CLASSID_SHMEM (2) -#define NDDS_TRANSPORT_CLASSID_INTRA (3) -#define NDDS_TRANSPORT_CLASSID_UDPv6 (5) -#define NDDS_TRANSPORT_CLASSID_DTLS (6) -#define NDDS_TRANSPORT_CLASSID_WAN (7) -#define NDDS_TRANSPORT_CLASSID_TCPV4_LAN (8) -#define NDDS_TRANSPORT_CLASSID_TCPV4_WAN (9) -#define NDDS_TRANSPORT_CLASSID_TLSV4_LAN (10) -#define NDDS_TRANSPORT_CLASSID_TLSV4_WAN (11) -#define NDDS_TRANSPORT_CLASSID_PCIE (12) -#define NDDS_TRANSPORT_CLASSID_ITP (13) +/* Vendor specific - rti */ +#define NDDS_TRANSPORT_CLASSID_ANY (0) +#define NDDS_TRANSPORT_CLASSID_UDPv4 (1) +#define NDDS_TRANSPORT_CLASSID_UDPv6 (2) +#define NDDS_TRANSPORT_CLASSID_INTRA (3) +#define NDDS_TRANSPORT_CLASSID_DTLS (6) +#define NDDS_TRANSPORT_CLASSID_WAN (7) +#define NDDS_TRANSPORT_CLASSID_TCPV4_LAN (8) +#define NDDS_TRANSPORT_CLASSID_TCPV4_WAN (9) +#define NDDS_TRANSPORT_CLASSID_TLSV4_LAN (10) +#define NDDS_TRANSPORT_CLASSID_TLSV4_WAN (11) +#define NDDS_TRANSPORT_CLASSID_PCIE (12) +#define NDDS_TRANSPORT_CLASSID_ITP (13) +#define NDDS_TRANSPORT_CLASSID_SHMEM (0x01000000) #define TOPIC_INFO_ADD_GUID (1) #define TOPIC_INFO_ADD_TYPE_NAME (2) |