summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-11-02 09:31:52 +0100
committerPascal Quantin <pascal.quantin@gmail.com>2016-11-02 13:49:22 +0000
commit2a651cfc663b87dca4a526a71724b13fb45091cf (patch)
treef101047efec658dcd3b1d4fc0a4db5af5f3936e4
parent58335bd86c393943ebb164182f851373d927847e (diff)
downloadwireshark-2a651cfc663b87dca4a526a71724b13fb45091cf.tar.gz
SNA: fix dissection of GDS Variables
Decode the header as specified in http://www.retrocomputing.net/info/doc/GA27-3136-20_SNA_Formats.pdf chapter 13. Note that the Information field is not decoded yet. Bug: 13084 Change-Id: Iaaee344ef0b2805906a3eeae1134479abf9d403e Reviewed-on: https://code.wireshark.org/review/18616 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--epan/dissectors/packet-sna.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index 395677fbf4..92ea0ba728 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -201,6 +201,7 @@ static int hf_sna_gds = -1;
static int hf_sna_gds_len = -1;
static int hf_sna_gds_type = -1;
static int hf_sna_gds_cont = -1;
+static int hf_sna_gds_info = -1;
/* static int hf_sna_xid = -1; */
static int hf_sna_xid_0 = -1;
@@ -2396,24 +2397,34 @@ dissect_gds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint16 length;
int cont;
int offset = 0;
- static const int * flags[] = {
- &hf_sna_gds_len,
- &hf_sna_gds_cont,
- &hf_sna_gds_type,
- NULL
- };
+ proto_item *pi;
+ proto_tree *subtree;
+ gboolean first_ll = TRUE;
do {
length = tvb_get_ntohs(tvb, offset) & 0x7fff;
cont = (tvb_get_ntohs(tvb, offset) & 0x8000) ? 1 : 0;
- if (length < 2 ) /* escape sequence ? */
+ pi = proto_tree_add_item(tree, hf_sna_gds, tvb, offset, -1, ENC_NA);
+ subtree = proto_item_add_subtree(pi, ett_sna_gds);
+ proto_tree_add_item(subtree, hf_sna_gds_len, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(subtree, hf_sna_gds_cont, tvb, offset, 2, ENC_BIG_ENDIAN);
+ if (length < 2 ) /* escape sequence */
return;
-
- proto_tree_add_bitmask(tree, tvb, offset, hf_sna_gds, ett_sna_gds, flags, ENC_BIG_ENDIAN);
- offset += length;
-
+ offset += 2;
+ length -= 2;
+ if (first_ll) {
+ proto_tree_add_item(subtree, hf_sna_gds_type, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ length -= 2;
+ first_ll = FALSE;
+ }
+ if (length > 0) {
+ proto_tree_add_item(subtree, hf_sna_gds_info, tvb, offset, length, ENC_NA);
+ offset += length;
+ }
} while(cont);
+ proto_item_set_len(pi, offset);
if (tvb_offset_exists(tvb, offset))
call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, parent_tree);
}
@@ -3165,6 +3176,10 @@ proto_register_sna(void)
{ "Type of Variable", "sna.gds.type", FT_UINT16, BASE_HEX,
VALS(sna_gds_var_vals), 0x0, NULL, HFILL }},
+ { &hf_sna_gds_info,
+ { "Information", "sna.gds.info", FT_BYTES, BASE_NONE,
+ NULL, 0x0, NULL, HFILL }},
+
#if 0
{ &hf_sna_xid,
{ "XID", "sna.xid", FT_NONE, BASE_NONE, NULL, 0x0,