aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-elmi.c
diff options
context:
space:
mode:
authorMartin Kaiser <martin@skogar.kaiser.cx>2014-04-20 12:53:58 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2014-04-21 17:51:17 +0000
commitbcfa1cc9741716d3c06b4e482d810ac698ed2847 (patch)
treeae2b88fecfa9ad81a856129a0feba5c7f4b94478 /epan/dissectors/packet-elmi.c
parent9c08f8db7c8e0722a4a58501d51f58e8453bf76b (diff)
dissect some more E-LMI fields
Change-Id: I9b0cb7c8602f813fd06f1b3ea6107ed6fe8d72ed Reviewed-on: https://code.wireshark.org/review/1244 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-elmi.c')
-rw-r--r--epan/dissectors/packet-elmi.c120
1 files changed, 118 insertions, 2 deletions
diff --git a/epan/dissectors/packet-elmi.c b/epan/dissectors/packet-elmi.c
index 70074721ae..c2dc077873 100644
--- a/epan/dissectors/packet-elmi.c
+++ b/epan/dissectors/packet-elmi.c
@@ -41,9 +41,16 @@ void proto_register_elmi(void);
void proto_reg_handoff_elmi(void);
static gint ett_elmi = -1;
+static gint ett_elmi_info_elem = -1;
static int hf_elmi_ver = -1;
static int hf_elmi_msg_type = -1;
+static int hf_elmi_info_elem = -1;
+static int hf_elmi_info_elem_len = -1;
+static int hf_elmi_report_type = -1;
+static int hf_elmi_snd_seq_num = -1;
+static int hf_elmi_rcv_seq_num = -1;
+static int hf_elmi_dat_inst = -1;
static const value_string elmi_msg_type[] = {
{ 0x75, "Status enquiry" },
@@ -51,6 +58,85 @@ static const value_string elmi_msg_type[] = {
{ 0, NULL }
};
+#define TAG_REPORT_TYPE 0x01
+#define TAG_SEQ_NUM 0x02
+#define TAG_DATA_INST 0x03
+
+static const value_string elmi_info_elem_tag[] = {
+ { TAG_REPORT_TYPE, "Report type" },
+ { TAG_SEQ_NUM, "Sequence numbers" },
+ { TAG_DATA_INST, "Data instance" },
+ { 0, NULL }
+};
+
+static const value_string elmi_report_type[] = {
+ { 0x00, "Full status" },
+ { 0x01, "E-LMI check" },
+ { 0x02, "Single EVC async status" },
+ { 0x03, "Full status continued" },
+ { 0, NULL }
+};
+
+
+static gint
+dissect_elmi_info_elem(
+ tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree)
+{
+ gint offset_start;
+ guint8 tag, len;
+ proto_item *tree_pi;
+ proto_tree *info_elem_tree;
+
+ offset_start = offset;
+
+ tag = tvb_get_guint8(tvb, offset);
+ if (tag==0)
+ return -1;
+
+ tree_pi = proto_tree_add_text(
+ tree, tvb, offset, -1, "Information element: %s",
+ val_to_str_const(tag, elmi_info_elem_tag, "unknown"));
+ info_elem_tree = proto_item_add_subtree(tree_pi, ett_elmi_info_elem);
+
+ proto_tree_add_item(info_elem_tree, hf_elmi_info_elem,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+
+ len = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(info_elem_tree, hf_elmi_info_elem_len,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+
+ switch (tag) {
+ case TAG_REPORT_TYPE:
+ proto_tree_add_item(info_elem_tree, hf_elmi_report_type,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+ break;
+ case TAG_SEQ_NUM:
+ proto_tree_add_item(info_elem_tree, hf_elmi_snd_seq_num,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+ proto_tree_add_item(info_elem_tree, hf_elmi_rcv_seq_num,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+ break;
+ case TAG_DATA_INST:
+ proto_tree_add_text(info_elem_tree, tvb, offset, 1, "Reserved");
+ offset++;
+ proto_tree_add_item(info_elem_tree, hf_elmi_dat_inst,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
+ break;
+ default:
+ offset += len;
+ break;
+ }
+
+ proto_item_set_len(tree_pi, offset-offset_start);
+ return offset-offset_start;
+}
+
static int
dissect_elmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -59,6 +145,7 @@ dissect_elmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
proto_tree *elmi_tree;
gint offset=0;
guint8 msg_type;
+ gint ret;
col_clear(pinfo->cinfo, COL_INFO);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "E-LMI");
@@ -76,7 +163,17 @@ dissect_elmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
tvb, offset, 1, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
val_to_str(msg_type, elmi_msg_type, "unknown (0x%x)"));
+ offset++;
+
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ ret = dissect_elmi_info_elem(tvb, offset, pinfo, elmi_tree);
+ if (ret<=0)
+ break;
+ offset += ret;
+ }
+ /* XXX - can we make the eth dissector handle our (standard) padding
+ * and FCS? */
return tvb_captured_length(tvb);
}
@@ -90,11 +187,30 @@ proto_register_elmi(void)
NULL, 0, NULL, HFILL } },
{ &hf_elmi_msg_type,
{ "Message type", "elmi.message_type", FT_UINT8, BASE_HEX,
- VALS(elmi_msg_type), 0, NULL, HFILL } }
+ VALS(elmi_msg_type), 0, NULL, HFILL } },
+ { &hf_elmi_info_elem,
+ { "Tag", "elmi.info_element.tag", FT_UINT8, BASE_HEX,
+ VALS(elmi_info_elem_tag), 0, NULL, HFILL } },
+ { &hf_elmi_info_elem_len,
+ { "Length", "elmi.info_element.length", FT_UINT8, BASE_DEC,
+ NULL, 0, NULL, HFILL } },
+ { &hf_elmi_report_type,
+ { "Report type", "elmi.report_type", FT_UINT8, BASE_DEC,
+ VALS(elmi_report_type), 0, NULL, HFILL } },
+ { &hf_elmi_snd_seq_num,
+ { "Send sequence number", "elmi.snd_seq_num", FT_UINT8, BASE_DEC,
+ NULL, 0, NULL, HFILL } },
+ { &hf_elmi_rcv_seq_num,
+ { "Receive sequence number", "elmi.rcv_seq_num", FT_UINT8, BASE_DEC,
+ NULL, 0, NULL, HFILL } },
+ { &hf_elmi_dat_inst,
+ { "Data instance", "elmi.data_instance", FT_UINT32, BASE_HEX,
+ NULL, 0, NULL, HFILL } }
};
static gint *ett[] = {
- &ett_elmi
+ &ett_elmi,
+ &ett_elmi_info_elem
};