/* Helper dissector for ZCL attribute set and bag types. */
static void dissect_zcl_set_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 elements_type, guint16 elements_num)
/* Helper dissector for ZCL attribute set and bag types. */
static void dissect_zcl_set_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 elements_type, guint16 elements_num)
{
    proto_tree *sub_tree;
    guint tvb_len;
    guint i = 1;
    tvb_len = tvb_captured_length(tvb);
    while ( (*offset < tvb_len) && (elements_num != 0) ) {
        if (i < ZBEE_ZCL_NUM_ARRAY_ELEM_ETT-1)
            sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 0,
                            ett_zbee_zcl_array_elements[i], NULL, "Element");
        else
            sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 0,
                        ett_zbee_zcl_array_elements[ZBEE_ZCL_NUM_ARRAY_ELEM_ETT-1], NULL, "Element");
        dissect_zcl_attr_data(tvb, sub_tree, offset, elements_type);
        elements_num--;
        i++;
    }
}