Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

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

From: Anders Broman <a.broman58@xxxxxxxxx>
Date: Sat, 10 Aug 2019 08:22:03 +0200


Den lör 10 aug. 2019 00:47Crawford, Anthony R <Anthony.R.Crawford@xxxxxxxxxxx> skrev:

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

Isn't there a version of the function with flags to determine what to put in the heading?
Anders

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