Wireshark-dev: Re: [Wireshark-dev] How do I dissect a set of flags

From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Mon, 1 Jun 2015 08:50:31 +0200


On Mon, Jun 1, 2015 at 4:55 AM, Richard Sharpe <realrichardsharpe@xxxxxxxxx> wrote:
I have a bunch of flags, many of which can be set at the same time,
and I thought I could use something like this:

static const value_string posix_flags_vals[] = {
        { 0x01, "POSIX_V1_POSIX_LOCK" },
        { 0x08, "POSIX_V1_POSIX_FILE_SEMANTICS" },
        { 0x10, "POSIX_V1_CASE_SENSITIVE" },
        { 0x40, "POSIX_V1_POSIX_STAT_INFO" },
        { 0, NULL }
};

However, when the flags are 0x50 I get unknown.

I probably want a Non Set value, but then if any of the other bits are
set, I should see that flag, but I don't really want things saying NOT
SET.

How do I do that?
Hi Richard,

the better solution is to use proto_tree_add_bitmask with bitmask field.

Regards,
 

--
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe