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] an FT_UINT8 hf that starts on a specific bit.

From: ivan jr sy <ivan_jr@xxxxxxxxx>
Date: Mon, 31 Aug 2009 02:49:24 -0700 (PDT)
To wireshark dev:

need some tips on how to go about this, i was hoping to revise the patch of bug#3964..
anyways here's my problem.

RFC 2460 uses this, and i wish to make use of traffic class's 6bit and 2 1-bit ECNs

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version| Traffic Class |           Flow Label                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

However, the header fields are registered like this..

    { &hf_ipv6_version,
      { "Version",		"ipv6.version",
				FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL }},
and...

    { &hf_ipv6_flow,
      { "Flowlabel",		"ipv6.flow",
				FT_UINT32, BASE_HEX, NULL, 0x000FFFFF, NULL, HFILL }},

Is there a way to create a header field of FT_UINT8 starting bit#5 of the offset?

I also need to create a subtree for that, with 6-bits, 1-bit and 1-bit

the patch of bug#3964 works (by getting the entire 32-bits and uses bit#5 to bit#10, bit#11 and bit#12), 

but i was hoping to learn more and improvise it. any tips? 

Thanks!