# Revision history [back]

### Dissector Header Labels

Hello. I have written a dissector for a subset of a protocol called TC that has two subfields. Let's call this implementation "TC_Subset" and the two fields the Primary and Segment fields. I would like the wireshark display for the dissection to look like the below, where > and V indicate collapsed and expanded trees, respectively;

> Frame 1
V TC_Subset


Unfortunately, it currently looks like this:

>Frame 1
V TC_Subset
> TC_Subset
> TC_Subset


I think I know why, but I don't know how to fix it. I'll start by showing the relevant areas of code and point out where I think the issue is. I believe it's from a combination of things in the dissect_ and register_ methods.

## "dissect_tc" excerpt

static int
dissect_tc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
//OFFSET IS IN OCTETS
int          offset          = 0;
proto_item  *tc_packet;
proto_tree  *tc_tree      = NULL;
proto_item  *primary_header  = NULL;
proto_item  *segment_header = NULL;
...additional set up and definitions of things like length, etc...

/* Set up the base tree */
tc_packet = proto_tree_add_item(tree, proto_tc_subset, tvb, 0, length, ENC_BIG_ENDIAN);
tc_tree   = proto_item_add_subtree(tc_packet, ett_tc);

/* build primary header tree */
...program tree accordingly...

/* build segment header tree */
...rest of method, not related to the problem...


Next, let's look at a small section of register_tc.

## "register_tc" excerpt

void
proto_register_tc(void)
{
static hf_register_info hf[] = ...define all fields for both headers in this one array...

/* Setup protocol subtree array */
static gint *ett[] = {
&ett_tc,