Wireshark-dev: Re: [Wireshark-dev] proto_tree_add_item() with range_string
From: "Anders Broman" <a.broman@xxxxxxxxx>
Date: Fri, 12 Jan 2007 15:57:51 +0100
Hi,
I had a brief look some time ago and it looked
To me like it would require new FT_x:s or
That the macros VAL and TFS would have to be changed to supply
the needed functions. Is there a better way to do it?

BR
Anders

-----Ursprungligt meddelande-----
Från: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] För Jaap Keuter
Skickat: den 12 januari 2007 15:48
Till: Developer support list for Wireshark
Ämne: Re: [Wireshark-dev] proto_tree_add_item() with range_string

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
>
>

_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev