diff options
author | Steve Osselton <steve.osselton@gmail.com> | 2018-12-18 15:55:39 +0000 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-12-19 11:40:12 +0000 |
commit | 9132725ab0ece71b121429210e216f10b238139d (patch) | |
tree | c14a81b025efe03837777148ca08a28848983110 /epan | |
parent | 0fc7f3781351c23cf05bdaafc1dd3dc6f9a08a2c (diff) |
Thrift: Update to support Set types
Change-Id: I8d513c005b6c6221364b695a584267fd57c5f8b8
Reviewed-on: https://code.wireshark.org/review/31094
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-thrift.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/epan/dissectors/packet-thrift.c b/epan/dissectors/packet-thrift.c index 5ff3f24523..a648d4962a 100644 --- a/epan/dissectors/packet-thrift.c +++ b/epan/dissectors/packet-thrift.c @@ -67,6 +67,7 @@ static int hf_thrift_i16 = -1; static int hf_thrift_i32 = -1; static int hf_thrift_utf7str = -1; static int hf_thrift_num_list_item = -1; +static int hf_thrift_num_set_item = -1; static int hf_thrift_num_map_item = -1; static int hf_thrift_bool = -1; static int hf_thrift_byte = -1; @@ -408,6 +409,34 @@ dissect_thrift_list(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, int } static int +dissect_thrift_set(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, int offset, int length) +{ + proto_tree *sub_tree; + proto_item *ti, *type_pi; + guint32 type; + int start_offset = offset, i; + guint32 set_len; + + sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_thrift, &ti, "Set"); + type_pi = proto_tree_add_item_ret_uint(sub_tree, hf_thrift_type, tvb, offset, 1, ENC_BIG_ENDIAN, &type); + offset++; + proto_tree_add_item_ret_uint(sub_tree, hf_thrift_num_set_item, tvb, offset, 4, ENC_BIG_ENDIAN, &set_len); + offset += 4; + + for (i = 0; i < (int)set_len; ++i) { + if (dissect_thrift_type(tvb, pinfo, sub_tree, type_pi, type, &offset, length) < 0) { + break; + } + } + set_len = offset - start_offset; + proto_item_set_len(ti, set_len); + + return offset; + +} + + +static int dissect_thrift_struct(tvbuff_t* tvb, packet_info* pinfo _U_, proto_tree* tree, int offset, int length) { proto_tree *sub_tree; @@ -526,6 +555,10 @@ dissect_thrift_type(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, /* T_MAP */ *offset = dissect_thrift_map(tvb, pinfo, tree, *offset, length); break; + case 14: + /* T_SET */ + *offset = dissect_thrift_set(tvb, pinfo, tree, *offset, length); + break; case 15: /* T_LIST */ *offset = dissect_thrift_list(tvb, pinfo, tree, *offset, length); @@ -807,6 +840,11 @@ void proto_register_thrift(void) { FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_thrift_num_set_item, + { "Number of Set Items", "thrift.num_set_item", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_thrift_num_list_item, { "Number of List Items", "thrift.num_list_item", FT_UINT32, BASE_DEC, NULL, 0x0, |