Wireshark mailing list archives

bitmask handling in wireshark


From: Andrei Emeltchenko <andrei.emeltchenko.news () gmail com>
Date: Tue, 28 Dec 2010 15:49:51 +0200

Hi all,

I want to check what is the best way to convert code below to value_string

                                proto_tree_add_text(tree, tvb, offset, 1,
                                                "%s%s%s%s",
                                                (buf & 0x80)? "16kHz " : "",
                                                (buf & 0x40)? "32kHz " : "",
                                                (buf & 0x20)? "44.1kHz " : "",
                                                (buf & 0x10)? "48kHz " : "");
                                proto_tree_add_text(tree, tvb, offset, 1,
                                                "%s%s%s%s",
                                                (buf & 0x08)? "Mono " : "",
                                                (buf & 0x04)? "DualChannel " : "",
                                                (buf & 0x02)? "Stereo " : "",
                                                (buf & 0x01)? "JointStereo " : "");
                                offset++;

Could you point me to some example?

So far I've seen only lots of boolean values.

Regards,
Andrei
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: