aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-selfm.c
diff options
context:
space:
mode:
authorChris Bontje <cbontje@gmail.com>2018-08-03 11:49:54 -0600
committerAnders Broman <a.broman58@gmail.com>2018-08-05 04:45:02 +0000
commit20c08df23d2d625cf2b1bd40e6ab8ef32219253e (patch)
tree9aa10d1842870a6fac4fbbca0190b5efc8db1c9a /epan/dissectors/packet-selfm.c
parentaa8ebb94e5d5db58eae56af64cdc5d8968b60b0b (diff)
[packet-selfm.c] - Fix handling of Response Code in Fast Message ACK Messages
Change-Id: Ideee81186e65c929b2104b63033ee2ac9c76b161 Reviewed-on: https://code.wireshark.org/review/28944 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-selfm.c')
-rw-r--r--epan/dissectors/packet-selfm.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c
index 16024a45e4..8df5e73c04 100644
--- a/epan/dissectors/packet-selfm.c
+++ b/epan/dissectors/packet-selfm.c
@@ -1,7 +1,7 @@
/* packet-selfm.c
* Routines for Schweitzer Engineering Laboratories (SEL) Protocols Dissection
* By Chris Bontje (cbontje[AT]gmail.com
- * Copyright 2012-2016,
+ * Copyright 2012-2018,
*
************************************************************************************************
* Wireshark - Network traffic analyzer
@@ -141,6 +141,7 @@ static int hf_selfm_fastmsg_len = -1;
static int hf_selfm_fastmsg_routing_addr = -1;
static int hf_selfm_fastmsg_status = -1;
static int hf_selfm_fastmsg_funccode = -1;
+static int hf_selfm_fastmsg_response_code = -1;
static int hf_selfm_fastmsg_seq = -1;
static int hf_selfm_fastmsg_seq_fir = -1;
static int hf_selfm_fastmsg_seq_fin = -1;
@@ -748,6 +749,20 @@ static const value_string selfm_fastmsg_tagtype_vals[] = {
{ 0, NULL }
};
+/* Fast Message ACK Response Codes */
+static const value_string selfm_fastmsg_ack_responsecode_vals[] = {
+ { 0x0, "Success" },
+ { 0x1, "Function code not recognized" },
+ { 0x2, "Function code supported but disabled" },
+ { 0x3, "Invalid Data Address" },
+ { 0x4, "Bad Data" },
+ { 0x5, "Insufficient Memory" },
+ { 0x6, "Busy" },
+ { 0, NULL }
+};
+
+static value_string_ext selfm_fastmsg_ack_responsecode_vals_ext =
+ VALUE_STRING_EXT_INIT(selfm_fastmsg_ack_responsecode_vals);
/* Fast Message Unsolicited Write COM Port Codes */
static const value_string selfm_fastmsg_unswrite_com_vals[] = {
@@ -1899,8 +1914,8 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o
proto_tree *fastmsg_tree, *fastmsg_def_fc_tree=NULL, *fastmsg_elementlist_tree=NULL;
proto_tree *fastmsg_element_tree=NULL, *fastmsg_datareg_tree=NULL, *fastmsg_tag_tree=NULL, *fastmsg_soeblk_tree=NULL;
gint cnt, cnt1, num_elements, elmt_status32_ofs=0, elmt_status, null_offset;
- guint8 len, funccode, seq, rx_num_fc, tx_num_fc;
- guint8 seq_cnt, elmt_idx, fc_enable, soe_num_reg;
+ guint8 len, funccode, seq=0, rx_num_fc, tx_num_fc;
+ guint8 seq_cnt=0, elmt_idx, fc_enable, soe_num_reg;
guint8 *tag_name_ptr;
guint16 base_addr, num_addr, num_reg, addr1, addr2, crc16, crc16_calc, soe_num_blks;
guint32 tod_ms, elmt_status32, elmt_ts_offset;
@@ -1935,12 +1950,21 @@ dissect_fastmsg_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int o
offset += 1;
- /* Get Sequence Byte, add to Tree */
- seq = tvb_get_guint8(tvb, offset);
- seq_cnt = seq & FAST_MSG_SEQ_CNT;
+ /* If this is an ACK message, process this byte as a Response Code. */
+ if ((funccode == FAST_MSG_EN_UNS_DATA_ACK) ||
+ (funccode == FAST_MSG_DIS_UNS_DATA_ACK) ||
+ (funccode == FAST_MSG_UNS_RESP_ACK)) {
+ proto_tree_add_item(fastmsg_tree, hf_selfm_fastmsg_response_code, tvb, offset, 1, ENC_BIG_ENDIAN);
+ }
+
+ else {
+ /* Otherwise, it is the sequence byte, add to Tree */
+ seq = tvb_get_guint8(tvb, offset);
+ seq_cnt = seq & FAST_MSG_SEQ_CNT;
+ proto_tree_add_bitmask_with_flags(fastmsg_tree, tvb, offset, hf_selfm_fastmsg_seq, ett_selfm_fastmsg_seq,
+ seq_fields, ENC_NA, BMT_NO_APPEND);
+ }
- proto_tree_add_bitmask_with_flags(fastmsg_tree, tvb, offset, hf_selfm_fastmsg_seq, ett_selfm_fastmsg_seq,
- seq_fields, ENC_NA, BMT_NO_APPEND);
offset += 1;
/* Add Response Number to tree */
@@ -2853,6 +2877,8 @@ proto_register_selfm(void)
{ "Status Byte", "selfm.fastmsg.status", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_selfm_fastmsg_funccode,
{ "Function Code", "selfm.fastmsg.funccode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, &selfm_fastmsg_func_code_vals_ext, 0x0, NULL, HFILL }},
+ { &hf_selfm_fastmsg_response_code,
+ { "Response Code", "selfm.fastmsg.responsecode", FT_UINT8, BASE_HEX | BASE_EXT_STRING, &selfm_fastmsg_ack_responsecode_vals_ext, 0x0, NULL, HFILL }},
{ &hf_selfm_fastmsg_seq,
{ "Sequence Byte", "selfm.fastmsg.seq", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
{ &hf_selfm_fastmsg_seq_fir,