Wireshark-dev: Re: [Wireshark-dev] Field with flags dissected

From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Wed, 14 Aug 2019 10:31:33 +0200
Hi

Look proto_tree_add_bitmask_with_flags and there is a flag for don't append the top

Cheers

On Sat, Aug 10, 2019 at 12:48 AM Crawford, Anthony R <Anthony.R.Crawford@xxxxxxxxxxx> wrote:

Hi all,

I need some help dissecting a field with its flags. I am trying to present the dissection of a single field with its value, then the dissected flags under it, presented like this:

 

Message ID: 0x8013

    10.. .... .... .... = Message Discriminator: Server and Network (2)

    ..00 0000 0001 .... = Message Scenario: Session Setup (1)

    .... .... .... 0011 = Message Type: Response Message (3)

 

However it is being presented like this instead:

 

Message ID: 0x8013, Message Discriminator: Server and Network, Message Scenario: Session Setup, Message Type: Response Message

    10.. .... .... .... = Message Discriminator: Server and Network (2)

    ..00 0000 0001 .... = Message Scenario: Session Setup (1)

    .... .... .... 0011 = Message Type: Response Message (3)

 

Anything after the 0x8013 in the same line I do not need.

 

Here is my code:

 

static const int *message_id_bits[] = {

        &hf_dsmcc_un_sess_flag_message_discriminator,

        &hf_dsmcc_un_sess_flag_message_scenario,

        &hf_dsmcc_un_sess_flag_message_type

    };

 

proto_tree_add_bitmask(sub_tree, tvb, offset, hf_dsmcc_message_id, ett_dsmcc_message_id, message_id_bits, ENC_NA);

 

 

I’ve spent the whole day trying to figure out how to present bitwise dissections. I haven’t been able to find the right solution despite reading dissection docs and other source codes.

 

 

Thanks,

Anthony

 

The contents of this e-mail message and
any attachments are intended solely for the
addressee(s) and may contain confidential
and/or legally privileged information. If you
are not the intended recipient of this message
or if this message has been addressed to you
in error, please immediately alert the sender
by reply e-mail and then delete this message
and any attachments. If you are not the
intended recipient, you are notified that
any use, dissemination, distribution, copying,
or storage of this message or any attachment
is strictly prohibited.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe