Wireshark-dev: Re: [Wireshark-dev] proto_tree_add_item() with range_string
From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 12 Jan 2007 16:25:10 +0100 (CET)
Hi,

My first impression is that the RS() macro (refer to code sample below)
needs to be implemented to work with the range_string type. I've got
really no idea what is involved with that.

Thanx,
Jaap

On Fri, 12 Jan 2007, Anders Broman wrote:

> 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
>
> _______________________________________________
> Wireshark-dev mailing list
> Wireshark-dev@xxxxxxxxxxxxx
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>
>