aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorDr. Lars Völker <lars.voelker@technica-engineering.de>2020-10-27 15:39:31 +0100
committerAndersBroman <a.broman58@gmail.com>2020-10-28 08:31:44 +0000
commitecdd7f3ede593e6b1e51df7a0e6b7a8fcb0184e8 (patch)
tree14d4410aec157eb66707e4af33af2e72b50e22ca /epan
parent889e0d5cb6a4e082e13d71c88c0fe40a4e8f8d2d (diff)
TECMP: Adding support for two temps in Vendor Data
The TECMP vendor data format for the Status Capture Module message has support for two temperatures (chassis and silicon). This patch allows dissection of those temperatures.
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-tecmp.c41
1 files changed, 37 insertions, 4 deletions
diff --git a/epan/dissectors/packet-tecmp.c b/epan/dissectors/packet-tecmp.c
index 1fc596e0db..da62b3346c 100644
--- a/epan/dissectors/packet-tecmp.c
+++ b/epan/dissectors/packet-tecmp.c
@@ -153,6 +153,11 @@ static int hf_tecmp_payload_status_cm_vendor_technica_buffer_size = -1;
static int hf_tecmp_payload_status_cm_vendor_technica_lifecycle = -1;
static int hf_tecmp_payload_status_cm_vendor_technica_voltage = -1;
static int hf_tecmp_payload_status_cm_vendor_technica_temperature = -1;
+static int hf_tecmp_payload_status_cm_vendor_technica_temperature_chassis = -1;
+static int hf_tecmp_payload_status_cm_vendor_technica_temperature_silicon = -1;
+
+#define VENDOR_TECHNICA_TEMP_MAX 127
+#define VENDOR_TECHNICA_TEMP_NA -128
/* Status Bus Vendor Data Technica Engineering */
static int hf_tecmp_payload_status_bus_vendor_technica_link_status = -1;
@@ -768,6 +773,7 @@ dissect_tecmp_status_cm_vendor_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto
proto_item *ti = NULL;
gint offset = 0;
guint tmp = 0;
+ gint temperature = 0;
proto_item_append_text(ti_root, " (%s)", val_to_str(vendor_id, tecmp_vendor_ids, "(Unknown Vendor: %d)"));
tree = proto_item_add_subtree(ti_root, ett_tecmp_status_cm_vendor_data);
@@ -807,12 +813,33 @@ dissect_tecmp_status_cm_vendor_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto
offset += 8;
tmp = tvb_get_guint16(tvb, offset, ENC_BIG_ENDIAN);
- proto_tree_add_string_format(tree, hf_tecmp_payload_status_cm_vendor_technica_voltage, tvb, offset, 2, NULL,
- "Voltage: %d.%d V", (tmp & 0x0000ff00) >> 8, tmp & 0x000000ff);
+ proto_tree_add_string_format_value(tree, hf_tecmp_payload_status_cm_vendor_technica_voltage, tvb, offset, 2, NULL,
+ "%d.%d V", (tmp & 0x0000ff00) >> 8, tmp & 0x000000ff);
offset += 2;
- ti = proto_tree_add_item(tree, hf_tecmp_payload_status_cm_vendor_technica_temperature, tvb, offset, 1, ENC_NA);
- proto_item_append_text(ti, " %s", "Degrees Celsius");
+ if (tvb_captured_length_remaining(tvb, offset) == 1) {
+ ti = proto_tree_add_item(tree, hf_tecmp_payload_status_cm_vendor_technica_temperature, tvb, offset, 1, ENC_NA);
+ proto_item_append_text(ti, " %s", "Degrees Celsius");
+ } else if (tvb_captured_length_remaining(tvb, offset) > 1) {
+ /* TECMP 1.5 and later */
+ ti = proto_tree_add_item_ret_int(tree, hf_tecmp_payload_status_cm_vendor_technica_temperature_chassis, tvb, offset, 1, ENC_NA, &temperature);
+ proto_item_append_text(ti, " %s", "Degrees Celsius");
+ if (temperature == VENDOR_TECHNICA_TEMP_MAX) {
+ proto_item_append_text(ti, " %s", "or more");
+ }
+ offset += 1;
+
+ temperature = tvb_get_gint8(tvb, offset);
+ if ( temperature == VENDOR_TECHNICA_TEMP_NA) {
+ proto_tree_add_int_format_value(tree, hf_tecmp_payload_status_cm_vendor_technica_temperature_silicon, tvb, offset, 1, temperature, "%s", "Not Available");
+ } else {
+ ti = proto_tree_add_item_ret_int(tree, hf_tecmp_payload_status_cm_vendor_technica_temperature_silicon, tvb, offset, 1, ENC_NA, &temperature);
+ proto_item_append_text(ti, " %s", "Degrees Celsius");
+ if (temperature == VENDOR_TECHNICA_TEMP_MAX) {
+ proto_item_append_text(ti, " %s", "or more");
+ }
+ }
+ }
break;
}
@@ -1369,6 +1396,12 @@ proto_register_tecmp_payload(void) {
{ &hf_tecmp_payload_status_cm_vendor_technica_temperature,
{ "Temperature", "tecmp.payload.status_cm.vendor_technica.temperature",
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { &hf_tecmp_payload_status_cm_vendor_technica_temperature_chassis,
+ { "Temperature Chassis", "tecmp.payload.status_cm.vendor_technica.temperature_chassis",
+ FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_tecmp_payload_status_cm_vendor_technica_temperature_silicon,
+ { "Temperature Silicon", "tecmp.payload.status_cm.vendor_technica.temperature_silicon",
+ FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
/* Status Bus Vendor Data */
{ &hf_tecmp_payload_status_bus_vendor_technica_link_status,