Wireshark-dev: Re: [Wireshark-dev] How to format a subtree banner?
Date Prev · Date Next · Thread Prev · Thread Next
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 30 Jul 2010 15:44:41 -0700
On Jul 30, 2010, at 2:24 PM, eymanm wrote:

> I've defined a 
> static const value_string String[]  = {
>   { 1, "String1" },
>   { 2, "String2" }
> };

Presumably you mean

static const value_string String[]  = {
  { 1, "String1" },
  { 2, "String2" },
  { 0, NULL }
};

right?  You have to put a terminator - i.e., an element with a null string pointer - at the end of value_string arrays.

> and can perfectly generate output, which looks like 
> string: String1 (1) 
> using proto_tree_add_item() function. In order to make the output a bit more user friendly, I'd prefer to have it as a subtree.

What would be in that subtree?  Presumably there would be more than one value in it (a subtree with only one value is generally not that useful); is the value that's decoded with the value_string in question one of the values?  If so, what are the other values?