static int parse_CAggregSpec(tvbuff_t *tvb, int offset, proto_tree *parent_tree, proto_tree *pad_tree, const char *fmt, ...)
{
	proto_item *item;
	proto_tree *tree;
	va_list ap;
	guint32 type, ccAlias, idColumn;
	const char *txt;

	va_start(ap, fmt);
	txt = wmem_strdup_vprintf(wmem_packet_scope(), fmt, ap);
	va_end(ap);
	tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0, ett_CAggregSpec, &item, txt);

	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");

	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;

	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;
	*/

	proto_item_set_end(item, tvb, offset);
	return offset;
}
static int parse_CAggregSpec(tvbuff_t *tvb, int offset, proto_tree *parent_tree, proto_tree *pad_tree, const char *fmt, ...)
{
	proto_item *item;
	proto_tree *tree;
	va_list ap;
	guint32 type, ccAlias, idColumn;
	const char *txt;

	va_start(ap, fmt);
	txt = wmem_strdup_vprintf(wmem_packet_scope(), fmt, ap);
	va_end(ap);
	tree = proto_tree_add_subtree(parent_tree, tvb, offset, 0, ett_CAggregSpec, &item, txt);

	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");

	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;

	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);
		}
	}
	 

	proto_item_set_end(item, tvb, offset);
	return offset;
}