Wireshark-bugs: [Wireshark-bugs] [Bug 7310] Initial support for the GlusterFS RPC-protocol
Date: Fri, 1 Jun 2012 09:18:34 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7310

--- Comment #8 from Pascal Quantin <pascal.quantin@xxxxxxxxx> 2012-06-01 09:18:34 PDT ---
(In reply to comment #7)
> (In reply to comment #6)

> > According to README.developer, a FT_BOOLEAN type with an empty bitmask should
> > use BASE_NONE:
> >     { &hf_glusterfs_flags_rdonly,
> >         { "O_RDONLY", "glusterfs.flags.rdonly", FT_BOOLEAN, BASE_NONE,
> >             TFS(&tfs_set_notset), 00000000, NULL, HFILL }
> >     },
> 
> I've tried this, but when I update the code but adding the
> hf_glusterfs_flags_rdonly to the flag_bits in glusterfs_rpc_dissect_flags() and
> removing the rdonly_item and rdonly_tree parts, I hit an assertion error:
> 
> proto.c:7187: failed assertion "hf->bitmask != 0"
> 
> When using value 32 instead of BASE_NONE and the explicit rdonly_item,
> rdonly_tree in glusterfs_rpc_dissect_flags() all looks good at least. I'm not
> sure what how it's supposed to work with BASE_NONE :-/

You could get completely rid of the rdonly_item and proto_item_set_text stuff
with something like that:

static const true_false_string glusterfs_read_only_value[] = {
    "Not set",
    "Set"
};
[...]
proto_tree_add_bits_item(flag_tree, hf_glusterfs_flags_rdonly, tvb, offset<<3,
32, ENC_LITTLE_ENDIAN);
[...]
{ &hf_glusterfs_flags_rdonly,
    { "O_RDONLY", "glusterfs.flags.rdonly", FT_BOOLEAN, BASE_NONE,
        TFS(&glusterfs_read_only_value), 0, NULL, HFILL }
},

The problem is that proto_tree_add_bits_item does not display the bits the same
way as proto_tree_add_bitmask. So either you use proto_tree_add_bits_item for
all flags, or you continue the way you do.

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.