diff options
author | Tomasz Moń <desowin@gmail.com> | 2021-09-15 21:32:56 +0200 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2021-09-26 18:16:28 +0200 |
commit | 7b82110092a105eedd5209e4ed75416098161d1f (patch) | |
tree | f8393d14a485e04f9a3091f04b0cc23606aeffd9 /epan/dissectors/packet-gsm_a_gm.c | |
parent | d87e6e58fae2c36d3834a696b9a5a4ed8cc1d21b (diff) |
USB HID: Parse bit fields with correct bit order
Implement little endian support for tvb_get_bits family of functions.
The big/little endian refers to bit numbering within an octet. In big
endian, the most significant bit is considered bit 0, while in little
endian the least significant bit is considered bit 0.
Add encoding parameters to proto tree bits format family functions.
Specify ENC_BIG_ENDIAN in all dissectors using these functions except in
USB HID that requires ENC_LITTLE_ENDIAN to work correctly.
When formatting bits values, always display most significant bit on the
leftmost position regardless of the encoding. This results in no gaps
between octets and makes the displayed value comprehensible.
Close #4478
Fix #17014
Diffstat (limited to 'epan/dissectors/packet-gsm_a_gm.c')
-rw-r--r-- | epan/dissectors/packet-gsm_a_gm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c index 9238a41fe6..8b4c8f0cdf 100644 --- a/epan/dissectors/packet-gsm_a_gm.c +++ b/epan/dissectors/packet-gsm_a_gm.c @@ -1880,7 +1880,7 @@ de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gui /* decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value)*/ proto_tree_add_uint_format(tf_tree, hf_gsm_a_gm_rf_power_capability, tvb, curr_offset-1-add_octets, 1+add_octets, value, - "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value), str, value); + "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value, ENC_BIG_ENDIAN), str, value); bit_offset += 3; curr_bits_length -= bits_needed; oct <<= bits_needed; @@ -1948,7 +1948,7 @@ de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gui str = "Not specified??"; proto_tree_add_uint_format(tf_tree, hf_gsm_a_gm_rf_power_capability, tvb, curr_offset-1-add_octets, 1+add_octets, value, - "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value), str, value); + "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value, ENC_BIG_ENDIAN), str, value); bit_offset += 3; curr_bits_length -= bits_needed; |