Wireshark-dev: Re: [Wireshark-dev] r45266: proto_tree_add_uint_format_value(..., value, ..., va
Date: Wed, 10 Oct 2012 23:10:56 -0400 (EDT)
Pascal,
 
Did you settle on the value, value+1?  I think I have the exact same problem in bug 7728 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7768)
-----Original Message-----
From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Sent: Wed, Oct 3, 2012 8:18 am
Subject: Re: [Wireshark-dev] r45266: proto_tree_add_uint_format_value(..., value, ..., value + 1)

Hi,

2012/10/3 Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Hi Pascal,

On Wed, Oct 03, 2012 at 10:36:47AM +0200, Pascal Quantin wrote:
> 2012/10/3 Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
>
> > Hi,
> >
> > part of r45266 (or 6427287[1]):
> >
> > #v+
> > -  proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_pkt_flt_id, tvb,
> > curr_offset, 1, ENC_BIG_ENDIAN);
> > +  oct = tvb_get_guint8(tvb, curr_offset) & 0x0f;
> > +  proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_sm_tft_pkt_flt_id,
> > tvb, curr_offset, 1, oct, "%d", oct+1);
> > #v-
> >
> > Now user type display filter: 'gsm_a.gm.sm.tft.pkt_flt_id == 4',
> > later he checks the value in tree and there is 5.
> >
> > I'm not sure if it's odd only for me (have not read 3GPP 27.007) or if it
> > could confuse all the users,
> > also familiar with this specification.
> >
> > [1]
> > http://code.wireshark.org/git/?p=wireshark;a=commitdiff;h=64272873f088a62b8db71e23e0e38c5c8d80194d
> >
>
> a packet filter identifier goes from 1 to 16 but is encoded on 4 bits, thus
> my modification.

> But I understand the confusion it can create when applying
> a filter. I could add the raw value in parenthesis (as we do for value
> string arrays) to make things a bit clearer.
> What do you think? Any other suggestion?

Still I don't understand why you decided to have different values for tree and filter.
Why not:
  proto_tree_add_uint(tf_tree, hf_gsm_a_sm_tft_pkt_flt_id, tvb, curr_offset, 1, oct + 1); ?

That's what I did first but in that case the bit string displayed before the filter name does not correspond to the real bit string of the message in the hex pane:
.... 0010 = Packet filter identifier: 2
while the byte in the hex pane ix 0x31.
I found it even more confusing.

Pascal.
 

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe