Wireshark mailing list archives

Re: Field with flags dissected


From: "Crawford, Anthony R" <Anthony.R.Crawford () charter com>
Date: Wed, 14 Aug 2019 16:11:24 +0000

Thanks this was the elegant solution:

proto_tree_add_bitmask_with_flags(sub_tree, tvb, offset, msg_id, ett_dsmcc_message_id, bf_message_id, ENC_NA, 
BMT_NO_APPEND);

AC
From: Wireshark-dev <wireshark-dev-bounces () wireshark org> On Behalf Of Alexis La Goutte
Sent: Wednesday, August 14, 2019 2:32 AM
To: Developer support list for Wireshark <wireshark-dev () wireshark org>
Subject: Re: [Wireshark-dev] Field with flags dissected

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 () charter com<mailto:Anthony.R.Crawford () 
charter com>> 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 () wireshark org<mailto:wireshark-dev () wireshark org>>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org<mailto:wireshark-dev-request () wireshark 
org>?subject=unsubscribe
E-MAIL CONFIDENTIALITY NOTICE: 
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 () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: