ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] bitmask handling in wireshark

From: Andrei Emeltchenko <andrei.emeltchenko.news@xxxxxxxxx>
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