summaryrefslogtreecommitdiff
path: root/epan/dissectors
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2017-02-02 15:59:22 +0000
committerMichael Mann <mmann78@netscape.net>2017-02-10 03:45:36 +0000
commit5c7cc28a6c3974d65bf2cb2066f072778a992010 (patch)
tree8cf6691a328c2da1f2d593465f77aca580834302 /epan/dissectors
parentb18245a60c5dc3532d144699dd00f36d84c4e176 (diff)
downloadwireshark-5c7cc28a6c3974d65bf2cb2066f072778a992010.tar.gz
mswsp: Align parse_CAggregSpec function with MS-WSP specification.
Fix some errors in the parsing of the CAggregSpec structure, see 2.2.1.24 in the MS-WSP specification. Change-Id: Ib281c10ab897e5c0282aa1b0d304df97a2fd14a3 Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-on: https://code.wireshark.org/review/20036 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-mswsp.c97
1 files changed, 70 insertions, 27 deletions
diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c
index b31289bc41..dcd8ec1818 100644
--- a/epan/dissectors/packet-mswsp.c
+++ b/epan/dissectors/packet-mswsp.c
@@ -279,6 +279,37 @@ struct CNatLanguageRestriction {
#define PROP_LENGTH 255
+enum aggtype {
+ DBAGGTTYPE_BYNONE = 0x0,
+ DBAGGTTYPE_SUM,
+ DBAGGTTYPE_MAX,
+ DBAGGTTYPE_MIN,
+ DBAGGTTYPE_AVG,
+ DBAGGTTYPE_COUNT,
+ DBAGGTTYPE_CHILDCOUNT,
+ DBAGGTTYPE_BYFREQ,
+ DBAGGTTYPE_FIRST,
+ DBAGGTTYPE_DATERANGE,
+ DBAGGTTYPE_REPRESENTATIVEOF,
+ DBAGGTTYPE_EDITDISTANCE,
+};
+
+static const value_string DBAGGTTYPE[] = {
+ {DBAGGTTYPE_BYNONE, "DBAGGTTYPE_BYNONE"},
+ {DBAGGTTYPE_SUM, "DBAGGTTYPE_SUM"},
+ {DBAGGTTYPE_MAX, "DBAGGTTYPE_MAX"},
+ {DBAGGTTYPE_MIN, "DBAGGTTYPE_MIN"},
+ {DBAGGTTYPE_AVG, "DBAGGTTYPE_AVG"},
+ {DBAGGTTYPE_COUNT, "DBAGGTTYPE_COUNT"},
+ {DBAGGTTYPE_CHILDCOUNT, "DBAGGTTYPE_CHILDCOUNT"},
+ {DBAGGTTYPE_BYFREQ, "DBAGGTTYPE_BYFREQ"},
+ {DBAGGTTYPE_FIRST, "DBAGGTTYPE_FIRST"},
+ {DBAGGTTYPE_DATERANGE, "DBAGGTTYPE_DATERANGE"},
+ {DBAGGTTYPE_REPRESENTATIVEOF, "DBAGGTTYPE_REPRESENTATIVEOF"},
+ {DBAGGTTYPE_EDITDISTANCE, "DBAGGTTYPE_EDITDISTANCE"},
+ {0, NULL}
+};
+
/* 2.2.1.44 */
struct CTableColumn {
/*struct CFullPropSpec propspec;*/
@@ -430,6 +461,8 @@ static int hf_mswsp_caggregspec_type = -1;
static int hf_mswsp_caggregspec_ccalias = -1;
static int hf_mswsp_caggregspec_alias = -1;
static int hf_mswsp_caggregspec_idcolumn = -1;
+static int hf_mswsp_caggregspec_ulmaxnumtoreturn = -1;
+static int hf_mswsp_caggregspec_idrepresentative = -1;
static int hf_mswsp_caggregset_count = -1;
static int hf_mswsp_caggregsortkey_order = -1;
static int hf_mswsp_csortaggregset_count = -1;
@@ -3212,21 +3245,7 @@ static int parse_CSortSet(tvbuff_t *tvb, int offset, proto_tree *parent_tree, pr
static int parse_CTableColumn(tvbuff_t *tvb, int offset, proto_tree *parent_tree, proto_tree *pad_tree, struct CTableColumn *col, const char *fmt, ...)
{
- static const value_string DBAGGTTYPE[] = {
- {0x0, "DBAGGTTYPE_BYNONE"},
- {0x1, "DBAGGTTYPE_SUM"},
- {0x2, "DBAGGTTYPE_MAX"},
- {0x3, "DBAGGTTYPE_MIN"},
- {0x4, "DBAGGTTYPE_AVG"},
- {0x5, "DBAGGTTYPE_COUNT"},
- {0x6, "DBAGGTTYPE_CHILDCOUNT"},
- {0x7, "DBAGGTTYPE_BYFREQ"},
- {0x8, "DBAGGTTYPE_FIRST"},
- {0x9, "DBAGGTTYPE_DATERANGE"},
- {0xA, "DBAGGTTYPE_REPRESENTATIVEOF"},
- {0xB, "DBAGGTTYPE_EDITDISTANCE"},
- {0, NULL}
- };
+
proto_item *item;
proto_tree *tree;
@@ -4705,8 +4724,7 @@ static int parse_CAggregSpec(tvbuff_t *tvb, int offset, proto_tree *parent_tree,
proto_item *item;
proto_tree *tree;
va_list ap;
- guint8 type;
- guint32 ccAlias, idColumn;
+ guint32 type, ccAlias, idColumn;
const char *txt;
va_start(ap, fmt);
@@ -4714,23 +4732,32 @@ static int parse_CAggregSpec(tvbuff_t *tvb, int offset, proto_tree *parent_tree,
va_end(ap);
tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0, ett_CAggregSpec, &item, txt);
- type = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(tree, hf_mswsp_caggregspec_type, tvb, offset, 1, type);
- proto_item_append_text(item, "type: %u", type);
+ proto_tree_add_item_ret_uint(tree, hf_mswsp_caggregspec_type, tvb, offset, 1, ENC_LITTLE_ENDIAN, &type);
offset += 1;
offset = parse_padding(tvb, offset, 4, pad_tree, "padding");
- ccAlias = tvb_get_letohl(tvb, offset);
- proto_tree_add_uint(tree, hf_mswsp_caggregspec_ccalias, tvb, offset, 1, ccAlias);
+ proto_tree_add_item_ret_uint(tree, hf_mswsp_caggregspec_ccalias, tvb, offset, 4, ENC_LITTLE_ENDIAN, &ccAlias);
offset += 4;
proto_tree_add_item(tree, hf_mswsp_caggregspec_alias, tvb, offset, 2*ccAlias, ENC_LITTLE_ENDIAN | ENC_UCS_2);
offset += 2*ccAlias;
- idColumn = tvb_get_letohl(tvb, offset);
- proto_tree_add_uint(tree, hf_mswsp_caggregspec_idcolumn, tvb, offset, 1, idColumn);
+ proto_tree_add_item_ret_uint(tree, hf_mswsp_caggregspec_idcolumn, tvb, offset, 4, ENC_LITTLE_ENDIAN, &idColumn);
offset += 4;
+ if (type == DBAGGTTYPE_REPRESENTATIVEOF
+ || type == DBAGGTTYPE_BYFREQ
+ || type == DBAGGTTYPE_FIRST) {
+ proto_tree_add_uint(tree,
+ hf_mswsp_caggregspec_ulmaxnumtoreturn,
+ tvb, offset, 4, idColumn);
+ offset += 4;
+ if (type == DBAGGTTYPE_REPRESENTATIVEOF) {
+ proto_tree_add_uint(tree,
+ hf_mswsp_caggregspec_idrepresentative,
+ tvb, offset, 4, idColumn);
+ }
+ }
/* Optional ???
ulMaxNumToReturn, idRepresentative;
*/
@@ -6999,14 +7026,14 @@ proto_register_mswsp(void)
&hf_mswsp_caggregspec_type,
{
"type", "mswsp.caggregspec.type",
- FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
+ FT_UINT8, BASE_DEC, VALS(DBAGGTTYPE), 0, NULL, HFILL
}
},
{
&hf_mswsp_caggregspec_ccalias,
{
"ccAlias", "mswsp.caggregspec.ccalias",
- FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
}
},
{
@@ -7020,7 +7047,23 @@ proto_register_mswsp(void)
&hf_mswsp_caggregspec_idcolumn,
{
"idColumn", "mswsp.caggregspec.idcolumn",
- FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
+ }
+ },
+ {
+ &hf_mswsp_caggregspec_ulmaxnumtoreturn,
+ {
+ "ulMaxNumToReturn",
+ "mswsp.caggregspec.ulmaxnumtoreturn",
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
+ }
+ },
+ {
+ &hf_mswsp_caggregspec_idrepresentative,
+ {
+ "idRepresentative",
+ "mswsp.caggregspec.idrepresentative",
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
}
},
{