Hi,
Yeah, that would be nice, having stuff like this:
static const range_string rs_value[] = {
{ 0, 49, "Little" },
{ 50, 99, "Some" },
{100,199, "Considerable" },
{200,255, "High" },
{ 0, 0, NULL }
};
proto_tree_add_item(tree, hf_proto_value, tvb, offset, 1, FALSE);
static hf_register_info hf[] = {
{ &hf_proto_value,
{ "Value", "proto.value",
FT_UINT8, BASE_DEC,
RS(rs_value), 0x0,
"How much is it worth", HFILL }}
};
+ Frame
+ Ethernet II
+ IP
+ TCP
+ Proto
Value: High (220)
That would require weaving in the range string handling along the types
where VALS() and TFS() handling applies (FT_*INT*, and FT_BOOLEAN).
epan/proto.c comes to mind.
Thanx,
Jaap
On Fri, 12 Jan 2007, Anders Broman wrote:
> Hi,
> Does some have an idea on how to implement proto_tree_add_item() with a
> range_string?
> That would be really useful.
> BR
> Anders
>
>