summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-11-12 10:09:02 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-11-12 10:09:02 +0000
commita78d2fbc63c42126d55b8b3871d19d25c4577761 (patch)
tree4226ded6cb42e250aa1b9e2bae630c64b4c69cd8
parent8b68d910396dbcbbcfdc444475c2dacfb1f224d2 (diff)
downloadwireshark-a78d2fbc63c42126d55b8b3871d19d25c4577761.tar.gz
(on behalf of the PROFIBUS Nutzerorganisation e.V. Deutschland):
add some PROFINET specific LLDP extensions svn path=/trunk/; revision=16488
-rw-r--r--epan/dissectors/packet-lldp.c164
-rw-r--r--epan/oui.h1
2 files changed, 162 insertions, 3 deletions
diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c
index b49fced9d1..924591177f 100644
--- a/epan/dissectors/packet-lldp.c
+++ b/epan/dissectors/packet-lldp.c
@@ -84,6 +84,15 @@ static int hf_org_spc_oui = -1;
static int hf_ieee_802_1_subtype = -1;
static int hf_ieee_802_3_subtype = -1;
static int hf_media_tlv_subtype = -1;
+static int hf_profinet_tlv_subtype = -1;
+static int hf_profinet_class2_port_status = -1;
+static int hf_profinet_class3_port_status = -1;
+static int hf_profinet_port_rx_delay_local = -1;
+static int hf_profinet_port_rx_delay_remote = -1;
+static int hf_profinet_port_tx_delay_local = -1;
+static int hf_profinet_port_tx_delay_remote = -1;
+static int hf_profinet_cable_delay_local = -1;
+static int hf_unknown_subtype = -1;
/* Initialize the subtree pointers */
static gint ett_lldp = -1;
@@ -184,6 +193,7 @@ const value_string tlv_oui_subtype_vals[] = {
{ OUI_IEEE_802_1, "IEEE 802.1" },
{ OUI_IEEE_802_3, "IEEE 802.3" },
{ OUI_MEDIA_ENDPOINT, "TIA" },
+ { OUI_PROFINET, "PROFINET" },
{ 0, NULL }
};
@@ -245,6 +255,14 @@ const value_string media_application_type[] = {
{ 0, NULL }
};
+/* PROFINET subtypes */
+const value_string profinet_subtypes[] = {
+ { 1, "Measured Delay Values" },
+ { 2, "Port Status" },
+ { 3, "Alias" },
+ { 0, NULL }
+};
+
/* Power Type */
const value_string media_power_type[] = {
{ 0, "PSE Device" },
@@ -416,6 +434,16 @@ const value_string operational_mau_type_values[] = {
#define MAX_MAC_LEN 6
+
+const value_string profinet_port_status_vals[] = {
+ { 0, "Not used" },
+ { 1, "Mode configured" },
+ { 2, "Mode enabled" },
+ { 3, "Reserved" },
+ /* all other bits reserved */
+ { 0, NULL }
+};
+
/* Calculate Latitude and Longitude string */
/*
Parameters:
@@ -1997,6 +2025,92 @@ dissect_media_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint
return;
}
+
+
+/* Dissect PROFINET TLVs */
+static void
+dissect_profinet_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 offset, guint16 tlvLen2)
+{
+ guint8 subType;
+ proto_item *tf = NULL;
+ guint16 class2_PortStatus;
+ guint16 class3_PortStatus;
+ guint32 port_rx_delay_local;
+ guint32 port_rx_delay_remote;
+ guint32 port_tx_delay_local;
+ guint32 port_tx_delay_remote;
+ guint32 cable_delay_local;
+
+
+ /* Get subtype */
+ subType = tvb_get_guint8(tvb, offset);
+ if (tree)
+ proto_tree_add_uint(tree, hf_profinet_tlv_subtype, tvb, offset, 1, subType);
+ offset++;
+
+ switch (subType)
+ {
+ case 1: /* Measured delay values */
+ {
+ port_rx_delay_local = tvb_get_ntohl(tvb, offset);
+ tf = proto_tree_add_uint(tree, hf_profinet_port_rx_delay_local, tvb, offset, 4, port_rx_delay_local);
+ if(port_rx_delay_local) {
+ proto_item_append_text(tf, "ns");
+ } else {
+ proto_item_append_text(tf, " (unknown)");
+ }
+ offset+=4;
+ port_rx_delay_remote = tvb_get_ntohl(tvb, offset);
+ tf = proto_tree_add_uint(tree, hf_profinet_port_rx_delay_remote, tvb, offset, 4, port_rx_delay_remote);
+ if(port_rx_delay_remote) {
+ proto_item_append_text(tf, "ns");
+ } else {
+ proto_item_append_text(tf, " (unknown)");
+ }
+ offset+=4;
+ port_tx_delay_local = tvb_get_ntohl(tvb, offset);
+ tf = proto_tree_add_uint(tree, hf_profinet_port_tx_delay_local, tvb, offset, 4, port_tx_delay_local);
+ if(port_tx_delay_local) {
+ proto_item_append_text(tf, "ns");
+ } else {
+ proto_item_append_text(tf, " (unknown)");
+ }
+ offset+=4;
+ port_tx_delay_remote = tvb_get_ntohl(tvb, offset);
+ tf = proto_tree_add_uint(tree, hf_profinet_port_tx_delay_remote, tvb, offset, 4, port_tx_delay_remote);
+ if(port_tx_delay_remote) {
+ proto_item_append_text(tf, "ns");
+ } else {
+ proto_item_append_text(tf, " (unknown)");
+ }
+ offset+=4;
+ cable_delay_local = tvb_get_ntohl(tvb, offset);
+ tf = proto_tree_add_uint(tree, hf_profinet_cable_delay_local, tvb, offset, 4, cable_delay_local);
+ if(cable_delay_local) {
+ proto_item_append_text(tf, "ns");
+ } else {
+ proto_item_append_text(tf, " (unknown)");
+ }
+ offset+=4;
+ break;
+ }
+ case 2: /* Port status */
+ {
+ class2_PortStatus = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_uint(tree, hf_profinet_class2_port_status, tvb, offset, 2, class2_PortStatus);
+ offset+=2;
+ class3_PortStatus = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_uint(tree, hf_profinet_class3_port_status, tvb, offset, 2, class3_PortStatus);
+ offset+=2;
+ break;
+ }
+ /*case 3:*/ /* XXX - Alias */
+ default:
+ proto_tree_add_item(tree, hf_unknown_subtype, tvb, offset, tlvLen2, FALSE);
+ }
+}
+
+
/* Dissect Organizational Specific TLV */
static gint32
dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
@@ -2025,13 +2139,16 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre
switch(oui)
{
case OUI_IEEE_802_1:
- subTypeStr = val_to_str(subType, ieee_802_1_subtypes, "Unknown");
+ subTypeStr = val_to_str(subType, ieee_802_1_subtypes, "Unknown subtype 0x%x");
break;
case OUI_IEEE_802_3:
- subTypeStr = val_to_str(subType, ieee_802_3_subtypes, "Unknown");
+ subTypeStr = val_to_str(subType, ieee_802_3_subtypes, "Unknown subtype 0x%x");
break;
case OUI_MEDIA_ENDPOINT:
- subTypeStr = val_to_str(subType, media_subtypes, "Unknown");
+ subTypeStr = val_to_str(subType, media_subtypes, "Unknown subtype 0x%x");
+ break;
+ case OUI_PROFINET:
+ subTypeStr = val_to_str(subType, profinet_subtypes, "Reserved (0x%x)");
break;
default:
subTypeStr = "Unknown";
@@ -2073,6 +2190,11 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre
case OUI_MEDIA_ENDPOINT:
dissect_media_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3));
break;
+ case OUI_PROFINET:
+ dissect_profinet_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3));
+ break;
+ default:
+ proto_tree_add_item(org_tlv_tree, hf_unknown_subtype, tvb, (offset+5), (guint16) (tempLen-3), FALSE);
}
return (tempLen + 2);
@@ -2314,6 +2436,42 @@ proto_register_lldp(void)
{ "Media Subtype", "lldp.media.subtype", FT_UINT8, BASE_HEX,
VALS(media_subtypes), 0x0, "", HFILL }
},
+ { &hf_profinet_tlv_subtype,
+ { "Subtype", "lldp.profinet.subtype", FT_UINT8, BASE_HEX,
+ VALS(profinet_subtypes), 0x0, "PROFINET Subtype", HFILL }
+ },
+ { &hf_profinet_port_rx_delay_local,
+ { "Port RX Delay Local", "lldp.profinet.port_rx_delay_local", FT_UINT32, BASE_DEC,
+ NULL, 0x0, "", HFILL }
+ },
+ { &hf_profinet_port_rx_delay_remote,
+ { "Port RX Delay Remote", "lldp.profinet.port_rx_delay_remote", FT_UINT32, BASE_DEC,
+ NULL, 0x0, "", HFILL }
+ },
+ { &hf_profinet_port_tx_delay_local,
+ { "Port TX Delay Local", "lldp.profinet.port_tx_delay_local", FT_UINT32, BASE_DEC,
+ NULL, 0x0, "", HFILL }
+ },
+ { &hf_profinet_port_tx_delay_remote,
+ { "Port TX Delay Remote", "lldp.profinet.port_tx_delay_remote", FT_UINT32, BASE_DEC,
+ NULL, 0x0, "", HFILL }
+ },
+ { &hf_profinet_cable_delay_local,
+ { "Port Cable Delay Local", "lldp.profinet.cable_delay_local", FT_UINT32, BASE_DEC,
+ NULL, 0x0, "", HFILL }
+ },
+ { &hf_profinet_class2_port_status,
+ { "RTClass2 Port Status", "lldp.profinet.rtc2_port_status", FT_UINT16, BASE_HEX,
+ VALS(profinet_port_status_vals), 0x0, "", HFILL }
+ },
+ { &hf_profinet_class3_port_status,
+ { "RTClass3 Port Status", "lldp.profinet.rtc3_port_status", FT_UINT16, BASE_HEX,
+ VALS(profinet_port_status_vals), 0x0, "", HFILL }
+ },
+ { &hf_unknown_subtype,
+ { "Unknown Subtype Content","lldp.unknown_subtype", FT_BYTES, BASE_HEX,
+ NULL, 0x0, "", HFILL }
+ },
};
/* Setup protocol subtree array */
diff --git a/epan/oui.h b/epan/oui.h
index 56277b9216..1fcd7229da 100644
--- a/epan/oui.h
+++ b/epan/oui.h
@@ -42,6 +42,7 @@
#define OUI_IEEE_802_1 0x0080C2 /* IEEE 802.1 Committee */
#define OUI_IEEE_802_3 0x00120F /* IEEE 802.3 */
#define OUI_MEDIA_ENDPOINT 0x0012BB /* Media (TIA TR-41 Committee) */
+#define OUI_PROFINET 0x000ECF /* PROFIBUS Nutzerorganisation e.V. */
extern const value_string oui_vals[];