/* read a struct and add it to tree  */
static void read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree, int add_type_field)
/* read a struct and add it to tree  */
static void read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree, int add_type_field)
{
  proto_item *ti;
  proto_tree *new_tree;
  int         length;
  int         i;
  ti = proto_tree_add_item(etch_tree, hf_etch_struct, tvb, *offset,
                           tvb_captured_length(tvb) - *offset, ENC_NA);
  new_tree = proto_item_add_subtree(ti, ett_etch_struct);
  if (add_type_field) {
    read_type(offset, tvb, new_tree);
  }
  read_value(offset, tvb, new_tree, hf_etch_value);
  length = read_value(offset, tvb, new_tree, hf_etch_length);
  for (i = 0; i < length; i++) {
    read_key_value(offset, tvb, new_tree);
  }
  read_type(offset, tvb, new_tree);
}