diff options
author | Michael Mann <mmann78@netscape.net> | 2014-07-30 09:58:53 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-07-30 15:45:26 +0000 |
commit | ede5a9d4c0364c184bb79786128244343b0abe06 (patch) | |
tree | 29ac9cd7e5401cd524a4cff74c14109eedd91a0f /plugins/wimax | |
parent | 82bb8008ce9baf2c509afac1e1e7343cdc2c6c9c (diff) |
Convert tvb_get_ptr buffer access macros to use much safer tvb access macros.
Added a few filterable fields in the process of trying to figure out the macros. Much more can be done to add many more filterable fields (and remove proto_tree_add_text calls hidden in the macros), but that'll be done some other time.
bug:10281
Change-Id: I9788f176c0e721ff4f243d4ecb79d7d0114fffc0
Reviewed-on: https://code.wireshark.org/review/3262
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins/wimax')
-rw-r--r-- | plugins/wimax/msg_dlmap.c | 461 | ||||
-rw-r--r-- | plugins/wimax/msg_ulmap.c | 233 | ||||
-rw-r--r-- | plugins/wimax/packet-wmx.c | 1 | ||||
-rw-r--r-- | plugins/wimax/wimax_bits.h | 110 |
4 files changed, 426 insertions, 379 deletions
diff --git a/plugins/wimax/msg_dlmap.c b/plugins/wimax/msg_dlmap.c index b4176f79db..5078cca92c 100644 --- a/plugins/wimax/msg_dlmap.c +++ b/plugins/wimax/msg_dlmap.c @@ -43,25 +43,32 @@ void proto_reg_handoff_mac_mgmt_msg_dlmap(void); #define XBIT(var, bits, desc) \ do { \ - var = BIT_BITS(bit, bufptr, bits); \ + var = TVB_BIT_BITS(bit, tvb, bits); \ proto_tree_add_text(tree, tvb, BITHI(bit, bits), desc ": %d", var); \ bit += bits; \ } while(0) #define VBIT(var, bits, hf) \ do { \ - var = BIT_BITS(bit, bufptr, bits); \ + var = TVB_BIT_BITS(bit, tvb, bits); \ proto_tree_add_uint(tree, hf, tvb, BITHI(bit,bits), var); \ bit += bits; \ } while(0) #define XNIB(var, nibs, desc) \ do { \ - var = NIB_NIBS(nib, bufptr, nibs); \ + var = TVB_NIB_NIBS(nib, tvb, nibs); \ proto_tree_add_text(tree, tvb, NIBHI(nib, nibs), desc ": %d", var); \ nib += nibs; \ } while(0) +#define VNIB(var, nibs, hf) \ + do { \ + var = TVB_NIB_NIBS(nib, tvb, nibs); \ + proto_tree_add_uint(tree, hf, tvb, NIBHI(nib, nibs), var); \ + nib += nibs; \ + } while(0) + gint harq = 0; /* 1 if HARQ enabled (TODO) */ gint fusc = 0; /* 1 if current zone permutation is FUSC or optional FUSC (TODO) */ gint tusc = 0; /* 1 if current zone permutation is AMC, TUSC1 or TUSC2 (TODO) */ @@ -250,6 +257,17 @@ static gint hf_dlmap_bsid = -1; static gint hf_dlmap_ofdma_sym = -1; /* static gint hf_dlmap_ie = -1; */ static gint hf_dlmap_ie_diuc = -1; +static gint hf_dlmap_ie_diuc_ext = -1; +static gint hf_dlmap_ie_length = -1; +static gint hf_dlmap_ie_bitmap = -1; +static gint hf_dlmap_ie_bitmap_cqi = -1; +static gint hf_dlmap_ie_bitmap_pusc = -1; +static gint hf_dlmap_ie_bitmap_opt_pusc = -1; +static gint hf_dlmap_ie_bitmap_amc = -1; +static gint hf_dlmap_ie_bitmap_aas = -1; +static gint hf_dlmap_ie_bitmap_periodic_ranging = -1; +static gint hf_dlmap_ie_bitmap_sounding = -1; +static gint hf_dlmap_ie_bitmap_mimo = -1; static gint hf_dlmap_ie_ncid = -1; static gint hf_dlmap_ie_cid = -1; static gint hf_dlmap_ie_offsym = -1; @@ -299,7 +317,7 @@ static gint hf_mac_header_compress_dlmap_crc = -1; * DL-MAP Miscellaneous IEs and TLVs *******************************************************************/ -gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type_lcl) +gint RCID_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type_lcl) { /* RCID_IE 8.4.5.3 and 8.4.5.3.20.1 */ /* offset of IE in bits, length is variable */ @@ -312,7 +330,7 @@ gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint leng if (RCID_Type_lcl == 0) length = 16; else { - Prefix = BIT_BIT(bit, bufptr); + Prefix = TVB_BIT_BIT(bit, tvb); if (Prefix == 1) length = 12; else if (RCID_Type_lcl == 1) length = 12; else if (RCID_Type_lcl == 2) length = 8; @@ -353,7 +371,7 @@ gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint leng * DL-MAP Extended-2 HARQ sub-burst IEs (8.4.5.3.21) *******************************************************************/ -static gint Dedicated_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Dedicated_DL_Control_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.3.20 */ /* offset of IE in nibbles, length is variable */ @@ -364,17 +382,17 @@ static gint Dedicated_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, nib = offset; - length = NIB_NIBBLE(nib, bufptr); /* length in nibbles */ + length = TVB_NIB_NIBBLE(nib, tvb); /* length in nibbles */ tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(nib, length+1), ett_286i, NULL, "Dedicated_DL_Control_IE"); proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Length: %d", length); nib++; - nibble = NIB_NIBBLE(nib, bufptr); + nibble = TVB_NIB_NIBBLE(nib, tvb); proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Control Header: %d", nibble); nib++; if ((nibble & 1) == 1) { - nibble = NIB_NIBBLE(nib, bufptr); + nibble = TVB_NIB_NIBBLE(nib, tvb); proto_tree_add_text(tree, tvb, NIBHI(nib,1), "Num SDMA Layers: %d", (nibble >> 2) & 0x3); /* Bit padding */ if ((nib*4)+2 < (offset+length)*4) { @@ -391,7 +409,7 @@ static gint Dedicated_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, return (length + 1); } -static gint Dedicated_MIMO_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Dedicated_MIMO_DL_Control_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in bits, length is variable */ gint bit; @@ -462,7 +480,7 @@ static gint Dedicated_MIMO_DL_Control_IE(proto_tree *diuc_tree, const guint8 *bu return (bit - offset); } -static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.3.21 DL_HARQ_Chase_sub_burst_IE */ /* offset of IE in nibbles, length is variable */ @@ -482,7 +500,7 @@ static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp nsub += 1; for (j = 0; j < nsub; j++) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(dur, 10, "Duration"); XBIT(sbi, 1, "Sub-Burst DIUC Indicator"); XBIT(res, 1, "Reserved"); @@ -508,7 +526,7 @@ static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp } if ((ddci & 2) == 2) { - bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb) * 4; + bit += Dedicated_DL_Control_IE(tree, BIT_TO_NIB(bit), length, tvb) * 4; } } @@ -516,7 +534,7 @@ static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp return (BIT_TO_NIB(bit) - offset); } -static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -537,7 +555,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *buf nsub += 1; for (j = 0; j < nsub; j++) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(data, 4, "N(EP)"); XBIT(data, 4, "N(SCH)"); @@ -558,14 +576,14 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *buf } } if ((ddci & 2) == 2) { - bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + bit += Dedicated_DL_Control_IE(tree, BIT_TO_NIB(bit), length, tvb); } } if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -579,7 +597,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *buf return (BIT_TO_NIB(bit) - offset); } -static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -600,7 +618,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp nsub += 1; for (j = 0; j < nsub; j++) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type) / 4; + bit += RCID_IE(tree, bit, length, tvb, RCID_Type) / 4; XBIT(data, 10, "Duration"); XBIT(sbdi, 1, "Sub-Burst DIUC Indicator"); @@ -629,14 +647,14 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp } } if ((ddci & 2) == 2) { - bit += Dedicated_DL_Control_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + bit += Dedicated_DL_Control_IE(tree, BIT_TO_NIB(bit), length, tvb); } } if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -650,7 +668,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufp return (BIT_TO_NIB(bit) - offset); } -static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -675,15 +693,15 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); XBIT(akd, 1, "ACK Disable"); if (mui == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } if (dci == 1) { - bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_DL_Control_IE(tree, bit, length, tvb); } XBIT(data, 10, "Duration"); for (i = 0; i < N_layer; i++) { if (mui == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "DIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -703,7 +721,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -717,7 +735,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 return (BIT_TO_NIB(bit) - offset); } -static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -742,15 +760,15 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bu XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); XBIT(akd, 1, "ACK Disable"); if (mui == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } if (dci == 1) { - bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_DL_Control_IE(tree, bit, length, tvb); } XBIT(data, 4, "N(SCH)"); for (i = 0; i < N_layer; i++) { if (mui == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "N(EP)"); if (akd) { @@ -764,7 +782,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bu if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -778,7 +796,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bu return (BIT_TO_NIB(bit) - offset); } -static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -803,15 +821,15 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const gui XBIT(dci, 1, "Dedicated MIMO DL Control Indicator"); XBIT(akd, 1, "ACK Disable"); if (mui == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } if (dci == 1) { - bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_DL_Control_IE(tree, bit, length, tvb); } XBIT(data, 10, "Duration"); for (i = 0; i < N_layer; i++) { if (mui == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "DIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -826,7 +844,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const gui if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -840,7 +858,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, const gui return (BIT_TO_NIB(bit) - offset); } -static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* offset of IE in nibbles, length is variable */ gint bit; @@ -868,12 +886,12 @@ static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *b if (sbi == 1) { XBIT(data, 8, "Sub-burst offset"); } - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(akd, 1, "ACK Disable"); if (txc == 0) { XBIT(dmci, 1, "Dedicated MIMO DL Control Indicator"); if (dmci == 1) { - bit += Dedicated_MIMO_DL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_DL_Control_IE(tree, bit, length, tvb); } XBIT(data, 4, "DIUC"); XBIT(data, 2, "Repetition coding Indication"); @@ -886,7 +904,7 @@ static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *b if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -904,7 +922,7 @@ static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *b * DL-MAP Extended-2 IEs *******************************************************************/ -static gint MBS_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MBS_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 0 */ /* 8.4.5.3.12 MBS_MAP_IE */ @@ -919,7 +937,7 @@ static gint MBS_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286a, NULL, "MBS_MAP_IE"); XBIT(data, 4, "Extended-2 DIUC"); - XBIT(data, 8, "Length"); + VBIT(data, 8, hf_dlmap_ie_length); XBIT(data, 7, "MBS Zone identifier"); XBIT(mde, 1, "Macro diversity enhanced"); @@ -961,7 +979,7 @@ static gint MBS_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, return BIT_TO_NIB(bit); } -static gint HO_Anchor_Active_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HO_Anchor_Active_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 1 */ /* 8.4.5.3.14 [2] HO_Anchor_Active_DL-MAP_IE TODO 1.1 */ @@ -975,12 +993,12 @@ static gint HO_Anchor_Active_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufp tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286c, NULL, "HO_Anchor_Active_DL_MAP_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint HO_Active_Anchor_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HO_Active_Anchor_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 2 */ /* 8.4.5.3.15 HO_Active_Anchor_DL_MAP_IE TODO 1.1 */ @@ -994,12 +1012,12 @@ static gint HO_Active_Anchor_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufp tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286d, NULL, "HO_Active_Anchor_DL_MAP_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint HO_CID_Translation_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HO_CID_Translation_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 3 */ /* 8.4.5.3.16 HO_CID_Translation_MAP_IE TODO 1.1 */ @@ -1013,12 +1031,12 @@ static gint HO_CID_Translation_MAP_IE(proto_tree *diuc_tree, const guint8 *bufpt tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286e, NULL, "CID_Translation_MAP_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint MIMO_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_in_another_BS_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 4 */ /* 8.4.5.3.17 [2] MIMO_in_another_BS_IE (not implemented)*/ @@ -1032,12 +1050,12 @@ static gint MIMO_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, g tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286f, NULL, "MIMO_in_another_BS_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint Macro_MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Macro_MIMO_DL_Basic_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* dl-map extended-2 ie = 5 */ /* 8.4.5.3.18 [2] Macro-MIMO_DL_Basic_IE (not implemented) */ @@ -1051,12 +1069,12 @@ static gint Macro_MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286g, NULL, "Macro_MIMO_DL_Basic_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint Skip_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Skip_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 6 */ /* 8.4.5.3.20.2 Skip_IE */ @@ -1070,7 +1088,7 @@ static gint Skip_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gi tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286k, NULL, "Skip_IE"); XBIT(data, 4, "Extended-2 DIUC"); - XBIT(data, 8, "Length"); + VBIT(data, 8, hf_dlmap_ie_length); XBIT(data, 1, "Mode"); XBIT(data, 7, "Reserved"); @@ -1078,7 +1096,7 @@ static gint Skip_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gi return BIT_TO_NIB(bit); } -static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 7 */ /* 8.4.5.3.21 [2] HARQ_DL_MAP_IE */ @@ -1093,7 +1111,7 @@ static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286l, NULL, "HARQ_DL_MAP_IE"); XBIT(data, 4, "Extended-2 DIUC"); - XBIT(len, 8, "Length"); + VBIT(len, 2, hf_dlmap_ie_length); XBIT(RCID_Type, 2, "RCID_Type"); XBIT(data, 2, "Reserved"); @@ -1129,19 +1147,19 @@ static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off /* 8.4.5.3.21 */ /* length of these are variable, each returns length in nibbles */ if (mode == 0) { - DL_HARQ_Chase_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + DL_HARQ_Chase_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 1) { - DL_HARQ_IR_CTC_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + DL_HARQ_IR_CTC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 2) { - DL_HARQ_IR_CC_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + DL_HARQ_IR_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 3) { - MIMO_DL_Chase_HARQ_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + MIMO_DL_Chase_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 4) { - MIMO_DL_IR_HARQ_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + MIMO_DL_IR_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 5) { - MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else if (mode == 6) { - MIMO_DL_STC_HARQ_sub_burst_IE(tree, bufptr, BIT_TO_NIB(bit), length, tvb); + MIMO_DL_STC_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb); } else { proto_tree_add_text(tree, tvb, BITHI(bit,1), "(reserved Mode)"); break; /* cannot continue */ @@ -1158,7 +1176,7 @@ static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off return BIT_TO_NIB(bit); } -static gint HARQ_ACK_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HARQ_ACK_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 8 */ /* 8.4.5.3.22 HARQ_ACK IE */ @@ -1172,14 +1190,14 @@ static gint HARQ_ACK_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286u, NULL, "HARQ_ACK_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib,length-3), "(bitmap data)"); return nib; } -static gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 9 */ /* 8.4.5.3.23 Enhanced DL MAP IE */ @@ -1195,7 +1213,7 @@ static gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286v, NULL, "Enhanced_DL-MAP_IE"); XBIT(data, 4, "Extended-2 DIUC"); - XBIT(data, 8, "Length"); + VBIT(data, 8, hf_dlmap_ie_length); XBIT(numass, 4, "Num_Assignment"); for (i = 0; i < numass; i++) { @@ -1214,7 +1232,7 @@ static gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint return BIT_TO_NIB(bit); } -static gint Closed_loop_MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Closed_loop_MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 0xA */ /* 8.4.5.3.24 Closed-loop MIMO DL Enhanced IE (not implemented) */ @@ -1228,12 +1246,12 @@ static gint Closed_loop_MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286w, NULL, "CL_MIMO_DL_Enhanced_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)"); return nib; } -static gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended-2 IE = 0xE */ /* 8.4.5.3.26 AAS_SDMA_DL_IE */ @@ -1251,7 +1269,7 @@ static gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286y, NULL, "AAS_SDMA_DL_IE"); XBIT(data, 4, "Extended-2 DIUC"); - XBIT(data, 8, "Length"); + VBIT(data, 8, hf_dlmap_ie_length); XBIT(RCID_Type, 2, "RCID_Type"); XBIT(num_region, 4, "Num_Burst_Region"); @@ -1270,7 +1288,7 @@ static gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off XBIT(num_users, 3, "Number of Users"); XBIT(data, 2, "Reserved"); for (j = 0; j < num_users; j++) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(encoding_mode, 2, "Encoding Mode"); XBIT(cqich_alloc, 1, "CQICH Allocation"); XBIT(ackch_alloc, 1, "ACKCH Allocation"); @@ -1347,7 +1365,7 @@ static gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint off * DL-MAP Extended IEs *******************************************************************/ -static gint Channel_Measurement_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Channel_Measurement_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 0 */ /* 8.4.5.3.5 [1] Channel_Measurement_IE */ @@ -1360,18 +1378,18 @@ static gint Channel_Measurement_IE(proto_tree *diuc_tree, const guint8 *bufptr, tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_280, NULL, "Channel_Measurement_IE"); - XNIB(data, 1, "Extended DIUC"); - XNIB(data, 1, "Length"); + VNIB(data, 1, hf_dlmap_ie_diuc_ext); + VNIB(data, 1, hf_dlmap_ie_length); XNIB(data, 2, "Channel Nr"); XNIB(data, 2, "OFDMA Symbol Offset"); - data = NIB_WORD(nib, bufptr); + data = TVB_NIB_WORD(nib, tvb); proto_tree_add_text(tree, tvb, NIBHI(nib,4), "CID: %d", data); nib += 4; return nib; } -static gint STC_Zone_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint STC_Zone_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 1 */ /* 8.4.5.3.4 STC_Zone_IE */ @@ -1386,8 +1404,8 @@ static gint STC_Zone_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_279, NULL, "STC_Zone_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 8, "OFDMA Symbol Offset"); XBIT(data, 2, "Permutations"); @@ -1406,7 +1424,7 @@ static gint STC_Zone_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset return BIT_TO_NIB(bit); } -static gint AAS_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint AAS_DL_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 2 */ /* 8.4.5.3.3 AAS_DL_IE */ @@ -1419,8 +1437,8 @@ static gint AAS_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_278, NULL, "AAS_DL_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 8, "OFDMA Symbol Offset"); XBIT(data, 3, "Permutation"); @@ -1434,7 +1452,7 @@ static gint AAS_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, return BIT_TO_NIB(bit); } -static gint Data_location_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Data_location_in_another_BS_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 3 */ /* 8.4.5.3.6 Data_location_in_another_BS_IE */ @@ -1447,8 +1465,8 @@ static gint Data_location_in_another_BS_IE(proto_tree *diuc_tree, const guint8 * tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_281, NULL, "Data location in another BS IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 2, "Segment"); XBIT(data, 6, "Used subchannels"); @@ -1467,7 +1485,7 @@ static gint Data_location_in_another_BS_IE(proto_tree *diuc_tree, const guint8 * return BIT_TO_NIB(bit); } -static gint CID_Switch_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint CID_Switch_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 4 */ /* 8.4.5.3.7 [1] CID_Switch_IE */ @@ -1482,13 +1500,13 @@ static gint CID_Switch_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offs tree = proto_tree_add_subtree_format(diuc_tree, tvb, NIBHI(offset, length), ett_282, NULL, "CID_Switch_IE (INC_CID = %d)", INC_CID); - XNIB(data, 1, "Extended DIUC"); - XNIB(data, 1, "Length"); + VNIB(data, 1, hf_dlmap_ie_diuc_ext); + VNIB(data, 1, hf_dlmap_ie_length); return nib; } -static gint MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_Basic_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 5 */ /* 8.4.5.3.8 MIMO_DL_Basic_IE (not implemented) */ @@ -1502,12 +1520,12 @@ static gint MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint o tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_283, NULL, "MIMO_DL_Basic_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-2), "(not implemented)"); return nib; } -static gint MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 6 */ /* 8.4.5.3.9 MIMO_DL_Enhanced_IE (not implemented) */ @@ -1521,12 +1539,12 @@ static gint MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, gin tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_284, NULL, "MIMO_DL_Enhanced_IE"); XNIB(data, 1, "Extended-2 DIUC"); - XNIB(data, 2, "Length"); + VNIB(data, 2, hf_dlmap_ie_length); proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-2), "(not implemented)"); return nib; } -static gint HARQ_Map_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HARQ_Map_Pointer_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 7 */ /* 8.4.5.3.10 [2] HARQ_Map_Pointer_IE */ @@ -1540,8 +1558,8 @@ static gint HARQ_Map_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gin tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_285, NULL, "HARQ_Map_Pointer_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); length_in_bits = NIB_TO_BIT(length-1); while (bit < length_in_bits) { @@ -1575,7 +1593,7 @@ static gint HARQ_Map_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gin return BIT_TO_NIB(bit); } -static gint PHYMOD_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint PHYMOD_DL_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 8 */ /* 8.4.5.3.11 PHYMOD_DL_IE */ @@ -1589,8 +1607,8 @@ static gint PHYMOD_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offse tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286, NULL, "PHYMOD_DL_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(pmt, 1, "Preamble Modifier Type"); if (pmt == 0) { @@ -1604,7 +1622,7 @@ static gint PHYMOD_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offse return BIT_TO_NIB(bit); } -static gint Broadcast_Control_Pointer_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Broadcast_Control_Pointer_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 0xA */ /* 8.4.5.3.25 Broadcast Control Pointer IE */ @@ -1618,8 +1636,8 @@ static gint Broadcast_Control_Pointer_IE(proto_tree *diuc_tree, const guint8 *bu tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286x, NULL, "Broadcast Control Pointer IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 7, "DCD_UCD Transmission Frame"); XBIT(skip, 1, "Skip Broadcast_System_Update"); @@ -1630,7 +1648,7 @@ static gint Broadcast_Control_Pointer_IE(proto_tree *diuc_tree, const guint8 *bu return BIT_TO_NIB(bit); } -static gint DL_PUSC_Burst_Allocation_in_Other_Segment_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint DL_PUSC_Burst_Allocation_in_Other_Segment_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 0xB */ /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ @@ -1643,8 +1661,8 @@ static gint DL_PUSC_Burst_Allocation_in_Other_Segment_IE(proto_tree *diuc_tree, tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286b, NULL, "DL_PUSC_Burst_Allocation_in_Other_Segment_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 16, "CID"); XBIT(data, 4, "DIUC"); @@ -1664,7 +1682,7 @@ static gint DL_PUSC_Burst_Allocation_in_Other_Segment_IE(proto_tree *diuc_tree, return BIT_TO_NIB(bit); } -static gint PUSC_ASCA_Alloc_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint PUSC_ASCA_Alloc_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 0xC */ /* 8.4.5.3.27 PUSC_ASCA_Alloc_IE */ @@ -1677,8 +1695,8 @@ static gint PUSC_ASCA_Alloc_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286z, NULL, "PUSC_ASCA_Alloc_IE"); - XBIT(data, 4, "Extended DIUC"); - XBIT(data, 4, "Length"); + VBIT(data, 4, hf_dlmap_ie_diuc_ext); + VBIT(data, 4, hf_dlmap_ie_length); XBIT(data, 4, "DIUC"); XBIT(data, 12, "Short Basic CID"); XBIT(data, 8, "OFDMA Symbol offset"); @@ -1692,48 +1710,44 @@ static gint PUSC_ASCA_Alloc_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint return BIT_TO_NIB(bit); } -static gint UL_interference_and_noise_level_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_interference_and_noise_level_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* DL-MAP Extended IE = 0xF */ /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ /* offset of TLV in nibbles, length of TLV in nibbles */ - gint nib; - gint data; proto_tree *tree; - gint bitmap; - - nib = offset; + gint nib = offset; + gint bitmap, data; tree = proto_tree_add_subtree(diuc_tree, tvb, NIBHI(offset, length), ett_286h, NULL, "UL_interference_and_noise_level_IE"); - XNIB(data, 1, "Extended DIUC"); - XNIB(data, 1, "Length"); - - XNIB(bitmap, 2, "Bitmap"); + VNIB(data, 1, hf_dlmap_ie_diuc_ext); + VNIB(data, 1, hf_dlmap_ie_length); + VNIB(bitmap, 2, hf_dlmap_ie_bitmap); if (bitmap & 0x01) { - XNIB(data, 2, "CQI/ACK/Periodic Ranging region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_cqi); } if (bitmap & 0x02) { - XNIB(data, 2, "PUSC region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_pusc); } if (bitmap & 0x04) { - XNIB(data, 2, "Optional PUSC region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_opt_pusc); } if (bitmap & 0x08) { - XNIB(data, 2, "AMC region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_amc); } if (bitmap & 0x10) { - XNIB(data, 2, "AAS region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_aas); } if (bitmap & 0x20) { - XNIB(data, 2, "Periodic Ranging region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_periodic_ranging); } if (bitmap & 0x40) { - XNIB(data, 2, "Sounding region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_sounding); } if (bitmap & 0x80) { - XNIB(data, 2, "MIMO region NI"); + VNIB(data, 2, hf_dlmap_ie_bitmap_mimo); } return nib; @@ -1743,15 +1757,14 @@ static gint UL_interference_and_noise_level_IE(proto_tree *diuc_tree, const guin * DL-MAP Plugin *******************************************************************/ -extern gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); +extern gint wimax_decode_ulmapc(proto_tree *base_tree, gint offset, gint length, tvbuff_t *tvb); - -static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint dissect_dlmap_ie(proto_tree *ie_tree, gint offset, gint length, tvbuff_t *tvb) { /* decode a single DL-MAP IE and return the * length of the IE in nibbles * offset = start of IE (nibbles) - * length = total length of bufptr (nibbles) */ + * length = total length of IE (nibbles) */ proto_item *ti = NULL; proto_tree *tree = NULL; @@ -1770,12 +1783,12 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off gint n_cid; /* 8.4.5.3 DL-MAP IE format - table 275 */ - diuc = NIB_NIBBLE(nibble, bufptr); + diuc = TVB_NIB_NIBBLE(nibble, tvb); if (diuc == 14) { /* 8.4.5.3.2.2 [2] Extended-2 DIUC dependent IE table 277b */ - ext2_diuc = NIB_NIBBLE(1+nibble, bufptr); - len = NIB_BYTE(1+nibble+1, bufptr); + ext2_diuc = TVB_NIB_NIBBLE(1+nibble, tvb); + len = TVB_NIB_BYTE(1+nibble+1, tvb); ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+3+len*2), diuc); proto_item_append_text(ti, " (Extended-2)"); @@ -1789,57 +1802,57 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off { case 0x00: /* 8.4.5.3.12 MBS_MAP_IE */ - nibble = MBS_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = MBS_MAP_IE(tree, nibble, len, tvb); break; case 0x01: /* 8.4.5.3.14 HO_Anchor_Active_DL-MAP_IE */ - nibble = HO_Anchor_Active_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HO_Anchor_Active_DL_MAP_IE(tree, nibble, len, tvb); break; case 0x02: /* 8.4.5.3.15 HO_Active_Anchor_DL_MAP_IE */ - nibble = HO_Active_Anchor_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HO_Active_Anchor_DL_MAP_IE(tree, nibble, len, tvb); break; case 0x03: /* 8.4.5.3.16 HO_CID_Translation_MAP_IE */ - nibble = HO_CID_Translation_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HO_CID_Translation_MAP_IE(tree, nibble, len, tvb); break; case 0x04: /* 8.4.5.3.17 MIMO_in_another_BS_IE */ - nibble = MIMO_in_another_BS_IE(tree, bufptr, nibble, len, tvb); + nibble = MIMO_in_another_BS_IE(tree, nibble, len, tvb); break; case 0x05: /* 8.4.5.3.18 Macro-MIMO_DL_Basic_IE */ - nibble = Macro_MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); + nibble = Macro_MIMO_DL_Basic_IE(tree, nibble, len, tvb); break; case 0x06: /* 8.4.5.3.20.2 Skip_IE */ - nibble = Skip_IE(tree, bufptr, nibble, len, tvb); + nibble = Skip_IE(tree, nibble, len, tvb); break; case 0x07: /* 8.4.5.3.21 HARQ_DL_MAP_IE */ - nibble = HARQ_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HARQ_DL_MAP_IE(tree, nibble, len, tvb); break; case 0x08: /* 8.4.5.3.22 HARQ_ACK IE */ - nibble = HARQ_ACK_IE(tree, bufptr, nibble, len, tvb); + nibble = HARQ_ACK_IE(tree, nibble, len, tvb); break; case 0x09: /* 8.4.5.3.23 Enhanced DL MAP IE */ - nibble = Enhanced_DL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = Enhanced_DL_MAP_IE(tree, nibble, len, tvb); break; case 0x0a: /* 8.4.5.3.24 Closed-loop MIMO DL Enhanced IE */ - nibble = Closed_loop_MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + nibble = Closed_loop_MIMO_DL_Enhanced_IE(tree, nibble, len, tvb); break; case 0x0b: - nibble = MIMO_DL_Basic_IE(tree, bufptr, nibble, len, tvb); + nibble = MIMO_DL_Basic_IE(tree, nibble, len, tvb); break; case 0x0c: - nibble = MIMO_DL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + nibble = MIMO_DL_Enhanced_IE(tree, nibble, len, tvb); break; case 0x0e: - nibble = AAS_SDMA_DL_IE(tree, bufptr, nibble, len, tvb); + nibble = AAS_SDMA_DL_IE(tree, nibble, len, tvb); break; default: @@ -1852,8 +1865,8 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off else if (diuc == 15) { /* 8.4.5.3.2.1 [1] Extended DIUC dependent IE - table 277 */ - ext_diuc = NIB_NIBBLE(1+nibble, bufptr); - len = NIB_NIBBLE(1+nibble+1, bufptr); + ext_diuc = TVB_NIB_NIBBLE(1+nibble, tvb); + len = TVB_NIB_NIBBLE(1+nibble+1, tvb); ti = proto_tree_add_uint(ie_tree, hf_dlmap_ie_diuc, tvb, NIBHI(nibble, 1+2+len*2), diuc); proto_item_append_text(ti, " (Extended)"); @@ -1869,47 +1882,47 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off { case 0x00: /* 8.4.5.3.? Channel_Measurement_IE */ - nibble = Channel_Measurement_IE(tree, bufptr, nibble, len, tvb); + nibble = Channel_Measurement_IE(tree, nibble, len, tvb); break; case 0x01: /* 8.4.5.3.4 STC_Zone_IE */ - nibble = STC_Zone_IE(tree, bufptr, nibble, len, tvb); + nibble = STC_Zone_IE(tree, nibble, len, tvb); break; case 0x02: /* 8.4.5.3.3 AAS_DL_IE */ - nibble = AAS_DL_IE(tree, bufptr, nibble, len, tvb); + nibble = AAS_DL_IE(tree, nibble, len, tvb); break; case 0x03: /* 8.4.5.3.6 Data_location_in_another_BS_IE */ - nibble = Data_location_in_another_BS_IE(tree, bufptr, nibble, len, tvb); + nibble = Data_location_in_another_BS_IE(tree, nibble, len, tvb); break; case 0x04: /* 8.4.5.3.7 CID_Switch_IE */ - nibble = CID_Switch_IE(tree, bufptr, nibble, len, tvb); + nibble = CID_Switch_IE(tree, nibble, len, tvb); break; case 0x07: /* 8.4.5.3.10 HARQ_Map_Pointer_IE */ - nibble = HARQ_Map_Pointer_IE(tree, bufptr, nibble, len, tvb); + nibble = HARQ_Map_Pointer_IE(tree, nibble, len, tvb); break; case 0x08: /* 8.4.5.3.11 PHYMOD_DL_IE */ - nibble = PHYMOD_DL_IE(tree, bufptr, nibble, len, tvb); + nibble = PHYMOD_DL_IE(tree, nibble, len, tvb); break; case 0x0a: /* 8.4.5.3.25 Broadcast Control Pointer IE */ - nibble = Broadcast_Control_Pointer_IE(tree, bufptr, nibble, len, tvb); + nibble = Broadcast_Control_Pointer_IE(tree, nibble, len, tvb); break; case 0x0b: /* 8.4.5.3.13 DL PUSC Burst Allocation in Other Segment IE */ - nibble = DL_PUSC_Burst_Allocation_in_Other_Segment_IE(tree, bufptr, nibble, len, tvb); + nibble = DL_PUSC_Burst_Allocation_in_Other_Segment_IE(tree, nibble, len, tvb); break; case 0x0c: - nibble = PUSC_ASCA_Alloc_IE(tree, bufptr, nibble, len, tvb); + nibble = PUSC_ASCA_Alloc_IE(tree, nibble, len, tvb); break; case 0x0f: /* 8.4.5.3.19 UL_interference_and_noise_level_IE */ - nibble = UL_interference_and_noise_level_IE(tree, bufptr, nibble, len, tvb); + nibble = UL_interference_and_noise_level_IE(tree, nibble, len, tvb); break; default: @@ -1929,7 +1942,7 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off /* precalculate IE len for correct highlighting */ if (INC_CID && !sub_dl_ul_map) { - ie_len += 2 + (NIB_BYTE(nibble+1, bufptr) * 4); + ie_len += 2 + (TVB_NIB_BYTE(nibble+1, tvb) * 4); } /* DL-MAP_IE */ @@ -1946,7 +1959,7 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off if (INC_CID) { - n_cid = NIB_BYTE(nibble, bufptr); + n_cid = TVB_NIB_BYTE(nibble, tvb); proto_tree_add_uint(tree, hf_dlmap_ie_ncid, tvb, NIBHI(nibble, 2), n_cid); nibble += 2; @@ -1955,16 +1968,16 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, const guint8 *bufptr, gint off if (sub_dl_ul_map) { /* RCID_IE 8.4.5.3 and 8.4.5.3.20.1, only part of SUB-DL-UL-MAP */ /* RCID_Type comes from 6.3.2.3.43.2 [2] Format_configuration_IE in Compact_DL-MAP_IE */ - nibble += RCID_IE(tree, bufptr, nibble*4, length, tvb, RCID_Type) / 4; + nibble += RCID_IE(tree, nibble*4, length, tvb, RCID_Type) / 4; } else { - data = NIB_WORD(nibble, bufptr); + data = TVB_NIB_WORD(nibble, tvb); proto_tree_add_uint(tree, hf_dlmap_ie_cid, tvb, NIBHI(nibble, 4), data); nibble += 4; } } } - data = NIB_LONG(nibble, bufptr); + data = TVB_NIB_LONG(nibble, tvb); if (alt_format) { proto_tree_add_uint(tree, hf_dlmap_ie_offsym2, tvb, NIBHI(nibble, 8), data); proto_tree_add_uint(tree, hf_dlmap_ie_offsub2, tvb, NIBHI(nibble, 8), data); @@ -1998,8 +2011,6 @@ static void dissect_mac_mgmt_msg_dlmap_decoder(tvbuff_t *tvb, packet_info *pinfo proto_tree *ie_tree = NULL; proto_tree *phy_tree = NULL; gint tvb_len = tvb_reported_length(tvb); - /* XXX This should be removed, and regular tvb accessors should be used instead. */ - const guint8 *bufptr = tvb_get_ptr(tvb, offset, tvb_len); INC_CID = 0; @@ -2032,7 +2043,7 @@ static void dissect_mac_mgmt_msg_dlmap_decoder(tvbuff_t *tvb, packet_info *pinfo nib = BYTE_TO_NIB(offset); while (nib < ((tvb_len*2)-1)) { - nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); + nib += dissect_dlmap_ie(ie_tree, nib, tvb_len * 2, tvb); } pad = NIB_PADDING(nib); if (pad) { @@ -2058,8 +2069,6 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre guint length, lennib, pad; guint mac_len, dl_ie_count; guint tvb_len = tvb_reported_length(tvb); - /* XXX This should be removed, and regular tvb accessors should be used instead. */ - const guint8 * bufptr = tvb_get_ptr(tvb, offset, tvb_len); guint nib = 0; guint32 mac_crc, calculated_crc; @@ -2107,7 +2116,7 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre /* length = BYTE_TO_NIB(mac_len - (int)sizeof(mac_crc) - 1); */ /* convert length to nibbles */ while (dl_ie_count--) { - nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); + nib += dissect_dlmap_ie(ie_tree, nib, tvb_len * 2, tvb); } pad = NIB_PADDING(nib); if (pad) { @@ -2129,7 +2138,7 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Compressed UL-MAP"); /* subtract 8 from lennib (CRC) */ - wimax_decode_ulmapc(base_tree, bufptr, nib, lennib - 8, tvb); + wimax_decode_ulmapc(base_tree, nib, lennib - 8, tvb); } /* CRC is always appended */ @@ -2154,16 +2163,13 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre return mac_len; } -extern gint dissect_ulmap_ie(proto_tree *ie_tree, - const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); -extern gint wimax_decode_ulmap_reduced_aas(proto_tree *ie_tree, - const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb); +extern gint dissect_ulmap_ie(proto_tree *ie_tree, gint offset, gint length, tvbuff_t *tvb); +extern gint wimax_decode_ulmap_reduced_aas(proto_tree *ie_tree, gint offset, gint length, tvbuff_t *tvb); gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *base_tree) { /* decode a SUB-DL-UL-MAP message 6.3.2.3.60 and return the length in bytes */ /* first three bits are 0x7, which following a compressed DL map indicates this message */ - guint offset = 0; proto_tree *tree = NULL; proto_tree *ie_tree = NULL; proto_item *generic_item = NULL; @@ -2172,8 +2178,6 @@ gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre guint16 calculated_crc; gint length = tvb_reported_length(tvb); - /* XXX This should be removed, and regular tvb accessors should be used instead. */ - const guint8 * bufptr = tvb_get_ptr(tvb, offset, length); gint nib = 0; gint lennib = BYTE_TO_NIB(length); @@ -2181,7 +2185,7 @@ gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre tree = proto_tree_add_subtree(base_tree, tvb, NIBHI(nib,lennib-nib), ett_109x, NULL, "SUB-DL-UL-MAP"); - data = NIB_WORD(nib,bufptr); + data = TVB_NIB_WORD(nib,tvb); proto_tree_add_uint(tree, hf_109x_cmi, tvb, NIBHI(nib,4), data); proto_tree_add_uint(tree, hf_109x_len, tvb, NIBHI(nib,4), data); proto_tree_add_uint(tree, hf_109x_rcid, tvb, NIBHI(nib,4), data); @@ -2190,28 +2194,28 @@ gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* HARQ ACK offset indicator */ if (data & 1) { - data = NIB_BYTE(nib,bufptr); + data = TVB_NIB_BYTE(nib,tvb); proto_tree_add_uint(tree, hf_109x_dl, tvb, NIBHI(nib,2), data); nib += 2; - data = NIB_BYTE(nib,bufptr); + data = TVB_NIB_BYTE(nib,tvb); proto_tree_add_uint(tree, hf_109x_ul, tvb, NIBHI(nib,2), data); nib += 2; } - numie = NIB_BYTE(nib,bufptr); + numie = TVB_NIB_BYTE(nib,tvb); proto_tree_add_uint(tree, hf_109x_dlie, tvb, NIBHI(nib,2), numie); nib += 2; /* DL-MAP IEs */ ie_tree = proto_tree_add_subtree(tree, tvb, NIBHI(nib,1), ett_109x_dl, NULL, "DL-MAP IEs"); for (i = 0; i < numie; i++) { - nib += dissect_dlmap_ie(ie_tree, bufptr, nib, lennib - nib, tvb); + nib += dissect_dlmap_ie(ie_tree, nib, lennib - nib, tvb); } - data = NIB_BYTE(nib,bufptr); + data = TVB_NIB_BYTE(nib,tvb); proto_tree_add_uint(tree, hf_109x_symofs, tvb, NIBHI(nib,2), data); nib += 2; - data = NIB_BYTE(nib,bufptr); + data = TVB_NIB_BYTE(nib,tvb); proto_tree_add_uint(tree, hf_109x_subofs, tvb, NIBHI(nib,2), data); proto_tree_add_uint(tree, hf_109x_rsv, tvb, NIBHI(nib,2), data); nib += 2; @@ -2219,7 +2223,7 @@ gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* UL-MAP IEs */ ie_tree = proto_tree_add_subtree(tree, tvb, NIBHI(nib,lennib-nib), ett_109x_ul, NULL, "UL-MAP IEs"); for ( ; nib < lennib - 1; ) { - nib += dissect_ulmap_ie(ie_tree, bufptr, nib, lennib - nib, tvb); + nib += dissect_ulmap_ie(ie_tree, nib, lennib - nib, tvb); } /* padding */ @@ -2229,7 +2233,7 @@ gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre } /* CRC-16 is always appended */ - data = NIB_WORD(nib, bufptr); + data = TVB_NIB_WORD(nib, tvb); generic_item = proto_tree_add_text(tree, tvb, NIBHI(nib,4), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, NIB_TO_BYTE(nib)), NIB_TO_BYTE(nib)); @@ -2255,8 +2259,6 @@ gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo _U_, proto gint ulmap_appended; gint length; gint tvb_len = tvb_reported_length(tvb); - /* XXX This should be removed, and regular tvb accessors should be used instead. */ - const guint8 * bufptr = tvb_get_ptr(tvb, offset, tvb_len); gint bit = 0; guint data, pad, mult; gint numie = 1; @@ -2343,7 +2345,7 @@ gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo _U_, proto XBIT(data, 2, "Repetition Coding Indication"); if (ulmap_appended) { /* offset and length are in bits */ - bit += wimax_decode_ulmap_reduced_aas(tree, bufptr, offset, length*8, tvb); + bit += wimax_decode_ulmap_reduced_aas(tree, offset, length*8, tvb); } XBIT(data, 3, "Reserved"); } @@ -2356,7 +2358,7 @@ gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo _U_, proto } /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -2434,6 +2436,83 @@ void proto_register_mac_mgmt_msg_dlmap(void) } }, { + &hf_dlmap_ie_diuc_ext, + { + "Extended DIUC", "wmx.dlmap.ie.ext_diuc", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_length, + { + "Length", "wmx.dlmap.ie.length", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap, + { + "Bitmap", "wmx.dlmap.ie.bitmap", + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_cqi, + { + "CQI/ACK/Periodic Ranging region NI", "wmx.dlmap.ie.bitmap.cqi", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_pusc, + { + "PUSC region NI", "wmx.dlmap.ie.bitmap.pusc", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_opt_pusc, + { + "Optional PUSC region NI", "wmx.dlmap.ie.bitmap.opt_pusc", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_amc, + { + "AMC region NI", "wmx.dlmap.ie.bitmap.amc", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_aas, + { + "AAS region NI", "wmx.dlmap.ie.bitmap.aas", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_periodic_ranging, + { + "Periodic Ranging region NI", "wmx.dlmap.ie.bitmap.periodic_ranging", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_sounding, + { + "Sounding region NI", "wmx.dlmap.ie.bitmap.sounding", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { + &hf_dlmap_ie_bitmap_mimo, + { + "MIMO region NI", "wmx.dlmap.ie.bitmap.mimo", + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL + } + }, + { &hf_dlmap_ie_ncid, { "N_CID", "wmx.dlmap.ie.ncid", diff --git a/plugins/wimax/msg_ulmap.c b/plugins/wimax/msg_ulmap.c index a177424f62..835f4eb2a0 100644 --- a/plugins/wimax/msg_ulmap.c +++ b/plugins/wimax/msg_ulmap.c @@ -43,14 +43,14 @@ void proto_reg_handoff_mac_mgmt_msg_ulmap(void); #define XBIT(var, bits, desc) \ do { \ - var = BIT_BITS(bit, bufptr, bits); \ + var = TVB_BIT_BITS(bit, tvb, bits); \ proto_tree_add_text(tree, tvb, BITHI(bit, bits), desc ": %d", var); \ bit += bits; \ } while(0) #define XNIB(var, nibs, desc) \ do { \ - var = NIB_NIBS(nib, bufptr, nibs); \ + var = TVB_NIB_NIBS(nib, tvb, nibs); \ proto_tree_add_text(tree, tvb, NIBHI(nib, nibs), desc ": %d", var); \ nib += nibs; \ } while(0) @@ -63,7 +63,7 @@ extern gint harq; extern gint ir_type; extern gint N_layer; extern gint RCID_Type; -extern gint RCID_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type); +extern gint RCID_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb, gint RCID_Type); static gint proto_mac_mgmt_msg_ulmap_decoder = -1; @@ -269,7 +269,7 @@ void init_wimax_globals(void) * these functions take offset/length in bits *******************************************************************/ -static gint Dedicated_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Dedicated_UL_Control_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24.1 Dedicated_UL_Control_IE -- table 302r */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -291,7 +291,7 @@ static gint Dedicated_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, return (bit - offset); /* length in bits */ } -static gint Dedicated_MIMO_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Dedicated_MIMO_UL_Control_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24.2 Dedicated_MIMO_UL_Control_IE -- table 302s */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -311,7 +311,7 @@ static gint Dedicated_MIMO_UL_Control_IE(proto_tree *uiuc_tree, const guint8 *bu /* begin Sub-Burst IEs */ -static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 UL_HARQ_Chase_sub_burst_IE -- table 302k */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -326,10 +326,10 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp tree = proto_tree_add_subtree(uiuc_tree, tvb, BITHI(offset,length), ett_302k, NULL, "UL_HARQ_Chase_Sub_Burst_IE"); - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(duci, 1, "Dedicated UL Control Indicator"); if (duci == 1) { - bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_UL_Control_IE(tree, bit, length, tvb); } XBIT(data, 4, "UIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -343,7 +343,7 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -358,7 +358,7 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp return (bit - offset); /* length in bits */ } -static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 UL_HARQ_IR_CTC_sub_burst_IE -- table 302l */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -373,10 +373,10 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *buf tree = proto_tree_add_subtree(uiuc_tree, tvb, NIBHI(offset, length), ett_302l, NULL, "UL_HARQ_IR_CTC_Sub_Burst_IE"); - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(duci, 1, "Dedicated UL Control Indicator"); if (duci == 1) { - bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_UL_Control_IE(tree, bit, length, tvb); } XBIT(data, 4, "N(EP)"); XBIT(data, 4, "N(SCH)"); @@ -390,7 +390,7 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *buf if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -405,7 +405,7 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *buf return (bit - offset); /* length in bits */ } -static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 UL_HARQ_IR_CC_sub_burst_IE -- table 302m */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -420,10 +420,10 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp tree = proto_tree_add_subtree(uiuc_tree, tvb, NIBHI(offset, length), ett_302m, NULL, "UL_HARQ_IR_CC_Sub_Burst_IE"); - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(duci, 1, "Dedicated UL Control Indicator"); if (duci == 1) { - bit += Dedicated_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_UL_Control_IE(tree, bit, length, tvb); } XBIT(data, 4, "UIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -438,7 +438,7 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -453,7 +453,7 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufp return (bit - offset); /* length in bits */ } -static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 MIMO_UL_Chase_HARQ_Sub_Burst_IE -- table 302n */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -472,9 +472,9 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 XBIT(dmci, 1, "Dedicated MIMO ULControl Indicator"); XBIT(ackd, 1, "ACK Disable"); if (muin == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); if (dmci) { - bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_UL_Control_IE(tree, bit, length, tvb); } } else { XBIT(data, 1, "Matrix"); @@ -482,7 +482,7 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 XBIT(data, 10, "Duration"); for (i = 0; i < N_layer; i++) { if (muin == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "UIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -496,7 +496,7 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -511,7 +511,7 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 return (bit - offset); /* length in bits */ } -static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 MIMO_UL_IR_HARQ__Sub_Burst_IE -- table 302o */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -530,9 +530,9 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b XBIT(dmci, 1, "Dedicated MIMO UL Control Indicator"); XBIT(ackd, 1, "ACK Disable"); if (muin == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); if (dmci) { - bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_UL_Control_IE(tree, bit, length, tvb); } } else { XBIT(data, 1, "Matrix"); @@ -540,7 +540,7 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b XBIT(data, 4, "N(SCH)"); for (i = 0; i < N_layer; i++) { if (muin == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "N(EP)"); if (ackd == 0) { @@ -554,7 +554,7 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -569,7 +569,7 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b return (bit - offset); /* length in bits */ } -static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE -- table 302p */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -588,9 +588,9 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const gu XBIT(dmci, 1, "Dedicated MIMO UL Control Indicator"); XBIT(ackd, 1, "ACK Disable"); if (muin == 0) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); if (dmci) { - bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb); + bit += Dedicated_MIMO_UL_Control_IE(tree, bit, length, tvb); } } else { XBIT(data, 1, "Matrix"); @@ -598,7 +598,7 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const gu XBIT(data, 10, "Duration"); for (i = 0; i < N_layer; i++) { if (muin == 1) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); } XBIT(data, 4, "UIUC"); XBIT(data, 2, "Repetition Coding Indication"); @@ -613,7 +613,7 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const gu if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -628,7 +628,7 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const gu return (bit - offset); /* length in bits */ } -static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.4.24 MIMO_UL_STC_HARQ_Sub_Burst_IE -- table 302q */ /* UL-MAP HARQ Sub-Burst IE * offset/length are in bits */ @@ -650,7 +650,7 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b if (sboi == 1) { XBIT(data, 8, "Sub-burst offset"); } - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(ackd, 1, "ACK Disable"); if (txct == 0) { XBIT(data, 4, "UIUC"); @@ -664,7 +664,7 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b if (include_cor2_changes) { /* CRC-16 is always appended */ - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); generic_item = proto_tree_add_text(tree, tvb, BITHI(bit,16), "CRC-16: 0x%04x",data); /* calculate the CRC */ calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit)); @@ -684,7 +684,7 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *b * table 290a *******************************************************************/ -static gint Power_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Power_Control_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 0 */ /* 8.4.5.4.5 Power_Control_IE */ @@ -705,7 +705,7 @@ static gint Power_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint o return nib; } -static gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 1 */ /* 8.4.5.4.8 [2] Mini-Subchannel_allocation_IE */ @@ -728,13 +728,13 @@ static gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, const guint8 *b XBIT(data, 6, "Duration"); for (j = 0; j < M; j++) { - data = BIT_BITS(bit, bufptr, 16); + data = TVB_BIT_BITS(bit, tvb, 16); proto_tree_add_text(tree, tvb, BITHI(bit, 16), "CID(%d): %d", j, data); bit += 16; - data = BIT_BITS(bit, bufptr, 4); + data = TVB_BIT_BITS(bit, tvb, 4); proto_tree_add_text(tree, tvb, BITHI(bit, 4), "UIUC(%d): %d", j, data); bit += 4; - data = BIT_BITS(bit, bufptr, 2); + data = TVB_BIT_BITS(bit, tvb, 2); proto_tree_add_text(tree, tvb, BITHI(bit, 2), "Repetition(%d): %d", j, data); bit += 2; } @@ -744,7 +744,7 @@ static gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, const guint8 *b return BIT_TO_NIB(bit); } -static gint AAS_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint AAS_UL_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 2 */ /* 8.4.5.4.6 [2] AAS_UL_IE*/ @@ -770,7 +770,7 @@ static gint AAS_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, return BIT_TO_NIB(bit); } -static gint CQICH_Alloc_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint CQICH_Alloc_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 3 */ /* 8.4.5.4.12 [2] CQICH_Alloc_IE */ @@ -793,7 +793,7 @@ static gint CQICH_Alloc_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint off proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); } else { /* variable from 0-9 bits */ - data = BIT_BITS16(bit, bufptr, cqich_id_size); + data = TVB_BIT_BITS16(bit, tvb, cqich_id_size); proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size); bit += cqich_id_size; } @@ -840,7 +840,7 @@ static gint CQICH_Alloc_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint off return BIT_TO_NIB(bit); /* Return position in nibbles. */ } -static gint UL_Zone_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_Zone_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 4 */ /* 8.4.5.4.7 [2] UL_Zone_IE */ @@ -866,7 +866,7 @@ static gint UL_Zone_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, return BIT_TO_NIB(bit); } -static gint PHYMOD_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint PHYMOD_UL_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 5 */ /* 8.4.5.4.14 [2] PHYMOD_UL_IE */ @@ -894,7 +894,7 @@ static gint PHYMOD_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offse return BIT_TO_NIB(bit); } -static gint MIMO_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 6 */ /* 8.4.5.4.11 MIMO_UL_Basic_IE (not implemented) */ @@ -913,7 +913,7 @@ static gint MIMO_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, return nib; } -static gint ULMAP_Fast_Tracking_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint ULMAP_Fast_Tracking_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 7 */ /* 8.4.5.4.22 [2] ULMAP_Fast_Tracking_IE */ @@ -941,7 +941,7 @@ static gint ULMAP_Fast_Tracking_IE(proto_tree *uiuc_tree, const guint8 *bufptr, return BIT_TO_NIB(bit); } -static gint UL_PUSC_Burst_Allocation_in_other_segment_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_PUSC_Burst_Allocation_in_other_segment_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 8 */ /* 8.4.5.4.17 [2] UL_PUSC_Burst_Allocation_in_other_segment_IE */ @@ -968,7 +968,7 @@ static gint UL_PUSC_Burst_Allocation_in_other_segment_IE(proto_tree *uiuc_tree, return BIT_TO_NIB(bit); } -static gint Fast_Ranging_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Fast_Ranging_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 9 */ /* 8.4.5.4.21 [2] Fast_Ranging_IE */ @@ -1001,7 +1001,7 @@ static gint Fast_Ranging_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint of return BIT_TO_NIB(bit); } -static gint UL_Allocation_Start_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_Allocation_Start_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended IE = 0xA */ /* 8.4.5.4.15 [2] UL_Allocation_Start_IE */ @@ -1029,7 +1029,7 @@ static gint UL_Allocation_Start_IE(proto_tree *uiuc_tree, const guint8 *bufptr, * table 290c *******************************************************************/ -static gint CQICH_Enhanced_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint CQICH_Enhanced_Allocation_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 0 */ /* 8.4.5.4.16 [2] CQICH_Enhanced_Allocation_IE */ @@ -1051,7 +1051,7 @@ static gint CQICH_Enhanced_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bu proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); } else { /* variable from 0-9 bits */ - data = BIT_BITS16(bit, bufptr, cqich_id_size); + data = TVB_BIT_BITS16(bit, tvb, cqich_id_size); proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size); bit += cqich_id_size; } @@ -1080,7 +1080,7 @@ static gint CQICH_Enhanced_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bu return BIT_TO_NIB(bit); } -static gint HO_Anchor_Active_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HO_Anchor_Active_UL_MAP_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 1 */ /* 8.4.5.4.18 [2] HO_Anchor_Active_UL_MAP_IE (not implemented) */ @@ -1099,7 +1099,7 @@ static gint HO_Anchor_Active_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufp return nib; } -static gint HO_Active_Anchor_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HO_Active_Anchor_UL_MAP_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 2 */ /* 8.4.5.4.19 [2] HO_Active_Anchor_UL_MAP_IE (not implemented) */ @@ -1118,7 +1118,7 @@ static gint HO_Active_Anchor_UL_MAP_IE(proto_tree *uiuc_tree, const guint8 *bufp return nib; } -static gint Anchor_BS_switch_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Anchor_BS_switch_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 3 */ /* 8.4.5.4.23 [2] Anchor_BS_switch_IE */ @@ -1153,7 +1153,7 @@ static gint Anchor_BS_switch_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gin if (cqich_id_size == 0) { proto_tree_add_text(tree, tvb, BITHI(bit, 1), "CQICH_ID: n/a (size == 0 bits)"); } else { - data = BIT_BITS16(bit, bufptr, cqich_id_size); + data = TVB_BIT_BITS16(bit, tvb, cqich_id_size); proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size); bit += cqich_id_size; @@ -1176,7 +1176,7 @@ static gint Anchor_BS_switch_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gin return BIT_TO_NIB(bit); } -static gint UL_sounding_command_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint UL_sounding_command_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 4 */ /* 8.4.5.4.26 [2] UL_sounding_command_IE */ @@ -1281,7 +1281,7 @@ static gint UL_sounding_command_IE(proto_tree *uiuc_tree, const guint8 *bufptr, return BIT_TO_NIB(bit); } -static gint MIMO_UL_Enhanced_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint MIMO_UL_Enhanced_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 6 */ /* 8.4.5.4.20 [2] MIMO_UL_Enhanced_IE (not implemented) */ @@ -1300,7 +1300,7 @@ static gint MIMO_UL_Enhanced_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gin return nib; } -static gint HARQ_ULMAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HARQ_ULMAP_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 7 */ /* 8.4.5.4.24 HARQ_ULMAP_IE */ @@ -1336,19 +1336,19 @@ static gint HARQ_ULMAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offs nsub++; for (i = 0; i < nsub; i++) { if (mode == 0) { - bit += UL_HARQ_Chase_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += UL_HARQ_Chase_Sub_Burst_IE(tree, bit, bitlength, tvb); } else if (mode == 1) { - bit += UL_HARQ_IR_CTC_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += UL_HARQ_IR_CTC_Sub_Burst_IE(tree, bit, bitlength, tvb); } else if (mode == 2) { - bit += UL_HARQ_IR_CC_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += UL_HARQ_IR_CC_Sub_Burst_IE(tree, bit, bitlength, tvb); } else if (mode == 3) { - bit += MIMO_UL_Chase_HARQ_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += MIMO_UL_Chase_HARQ_Sub_Burst_IE(tree, bit, bitlength, tvb); } else if (mode == 4) { - bit += MIMO_UL_IR_HARQ__Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += MIMO_UL_IR_HARQ__Sub_Burst_IE(tree, bit, bitlength, tvb); } else if (mode == 5) { - bit += MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(tree, bufptr, bit, bitlength, tvb); + bit += MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(tree, bit, bitlength, tvb); } else if (mode == 6) { - bit += MIMO_UL_STC_HARQ_Sub_Burst_IE(tree, bufptr, bit, bitlength, tvb); + bit += MIMO_UL_STC_HARQ_Sub_Burst_IE(tree, bit, bitlength, tvb); } } } @@ -1361,7 +1361,7 @@ static gint HARQ_ULMAP_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offs return BIT_TO_NIB(bit); } -static gint HARQ_ACKCH_Region_Allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint HARQ_ACKCH_Region_Allocation_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 8 */ /* 8.4.5.4.25 [2] HARQ_ACKCH_Region_Allocation_IE */ @@ -1384,7 +1384,7 @@ static gint HARQ_ACKCH_Region_Allocation_IE(proto_tree *uiuc_tree, const guint8 return BIT_TO_NIB(bit); } -static gint AAS_SDMA_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint AAS_SDMA_UL_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 0xE */ /* 8.4.5.4.27 [2] AAS_SDMA_UL_IE */ @@ -1412,7 +1412,7 @@ static gint AAS_SDMA_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint off XBIT(user, 3, "Number of users"); XBIT(data, 3, "Reserved"); for (jj = 0; jj < user; jj++) { - bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type); + bit += RCID_IE(tree, bit, length, tvb, RCID_Type); XBIT(encm, 2, "Encoding Mode"); XBIT(padj, 1, "Power Adjust"); XBIT(ppmd, 1, "Pilot Pattern Modifier"); @@ -1466,7 +1466,7 @@ static gint AAS_SDMA_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint off return BIT_TO_NIB(bit); } -static gint Feedback_Polling_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +static gint Feedback_Polling_IE(proto_tree *uiuc_tree, gint offset, gint length, tvbuff_t *tvb) { /* UL-MAP Extended-2 IE = 0xF */ /* 8.4.5.4.28 [2] Feedback_Polling_IE */ @@ -1516,12 +1516,12 @@ static gint Feedback_Polling_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gin * UL-MAP Miscellany *******************************************************************/ -gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, gint length _U_, tvbuff_t *tvb) +gint dissect_ulmap_ie( proto_tree *ie_tree, gint offset, gint length _U_, tvbuff_t *tvb) { /* decode a single UL-MAP IE and return the * length of the IE in nibbles * offset = start of IE (nibbles) - * length = total length of bufptr (nibbles) */ + * length = total length of tvb (nibbles) */ proto_item *ti; proto_tree *tree; gint nibble; @@ -1546,7 +1546,7 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); nibble += 1; - data = NIB_LONG(nibble, bufptr); + data = TVB_NIB_LONG(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc0_symofs, tvb, NIBHI(nibble, 8), data); proto_tree_add_uint(tree, hf_ulmap_uiuc0_subofs, tvb, NIBHI(nibble, 8), data); proto_tree_add_uint(tree, hf_ulmap_uiuc0_numsym, tvb, NIBHI(nibble, 8), data); @@ -1557,8 +1557,8 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g else if (uiuc == 11) { /* 8.4.5.4.4.2 [2] extended-2 UIUC IE table 290b */ - ext2_uiuc = NIB_NIBBLE(5+nibble, bufptr); - len = NIB_BYTE(5+nibble+1, bufptr); + ext2_uiuc = TVB_NIB_NIBBLE(5+nibble, tvb); + len = TVB_NIB_BYTE(5+nibble+1, tvb); tree = proto_tree_add_subtree_format(ie_tree, tvb, NIBHI(nibble, 5+3+len*2), ett_290b, NULL, "UIUC: %d (Extended-2 IE)", uiuc); @@ -1580,43 +1580,43 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g switch (ext2_uiuc) { case 0x00: /* 8.4.5.4.16 CQICH_Enhanced_Allocation_IE */ - nibble = CQICH_Enhanced_Allocation_IE(tree, bufptr, nibble, len, tvb); + nibble = CQICH_Enhanced_Allocation_IE(tree, nibble, len, tvb); break; case 0x01: /* 8.4.5.4.18 HO_Anchor_Active_UL_MAP_IE */ - nibble = HO_Anchor_Active_UL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HO_Anchor_Active_UL_MAP_IE(tree, nibble, len, tvb); break; case 0x02: /* 8.4.5.4.19 HO_Active_Anchor_UL_MAP_IE */ - nibble = HO_Active_Anchor_UL_MAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HO_Active_Anchor_UL_MAP_IE(tree, nibble, len, tvb); break; case 0x03: /* 8.4.5.4.23 Anchor_BS_switch_IE */ - nibble = Anchor_BS_switch_IE(tree, bufptr, nibble, len, tvb); + nibble = Anchor_BS_switch_IE(tree, nibble, len, tvb); break; case 0x04: /* 8.4.5.4.26 UL_sounding_command_IE */ - nibble = UL_sounding_command_IE(tree, bufptr, nibble, len, tvb); + nibble = UL_sounding_command_IE(tree, nibble, len, tvb); break; case 0x06: /* 8.4.5.4.20 MIMO_UL_Enhanced_IE */ - nibble = MIMO_UL_Enhanced_IE(tree, bufptr, nibble, len, tvb); + nibble = MIMO_UL_Enhanced_IE(tree, nibble, len, tvb); break; case 0x07: /* 8.4.5.4.24 HARQ_ULMAP_IE */ - nibble = HARQ_ULMAP_IE(tree, bufptr, nibble, len, tvb); + nibble = HARQ_ULMAP_IE(tree, nibble, len, tvb); break; case 0x08: /* 8.4.5.4.25 HARQ_ACKCH_Region_Allocation_IE */ - nibble = HARQ_ACKCH_Region_Allocation_IE(tree, bufptr, nibble, len, tvb); + nibble = HARQ_ACKCH_Region_Allocation_IE(tree, nibble, len, tvb); break; case 0x0e: /* 8.4.5.4.27 AAS_SDMA_UL_IE */ - nibble = AAS_SDMA_UL_IE(tree, bufptr, nibble, len, tvb); + nibble = AAS_SDMA_UL_IE(tree, nibble, len, tvb); break; case 0x0f: /* 8.4.5.4.28 Feedback_Polling_IE */ - nibble = Feedback_Polling_IE(tree, bufptr, nibble, len, tvb); + nibble = Feedback_Polling_IE(tree, nibble, len, tvb); break; default: @@ -1636,7 +1636,7 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); nibble += 1; - data32 = NIB_LONG(nibble, bufptr); + data32 = TVB_NIB_LONG(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc12_symofs, tvb, NIBHI(nibble,8), data32); proto_tree_add_uint(tree, hf_ulmap_uiuc12_subofs, tvb, NIBHI(nibble,8), data32); proto_tree_add_uint(tree, hf_ulmap_uiuc12_numsym, tvb, NIBHI(nibble,8), data32); @@ -1656,7 +1656,7 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); nibble += 1; - data = NIB_LONG(nibble, bufptr); + data = TVB_NIB_LONG(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc13_symofs, tvb, NIBHI(nibble,8), data); proto_tree_add_uint(tree, hf_ulmap_uiuc13_subofs, tvb, NIBHI(nibble,8), data); proto_tree_add_uint(tree, hf_ulmap_uiuc13_numsym, tvb, NIBHI(nibble,8), data); @@ -1676,24 +1676,24 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); nibble += 1; - data = NIB_WORD(nibble, bufptr); + data = TVB_NIB_WORD(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc14_dur, tvb, NIBHI(nibble,2), data); proto_tree_add_uint(tree, hf_ulmap_uiuc14_uiuc, tvb, NIBHI(nibble+1,2), data); proto_tree_add_uint(tree, hf_ulmap_uiuc14_rep, tvb, NIBHI(nibble+2,1), data); proto_tree_add_uint(tree, hf_ulmap_uiuc14_idx, tvb, NIBHI(nibble+3,1), data); nibble += 4; - data = NIB_BYTE(nibble, bufptr); + data = TVB_NIB_BYTE(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc14_code, tvb, NIBHI(nibble,2), data); proto_item_append_text(ti, " (0x%02x)", data); nibble += 2; - data = NIB_BYTE(nibble, bufptr); + data = TVB_NIB_BYTE(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc14_sym, tvb, NIBHI(nibble,2), data); proto_item_append_text(ti, " (0x%02x)", data); nibble += 2; - data = NIB_BYTE(nibble, bufptr); + data = TVB_NIB_BYTE(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc14_sub, tvb, NIBHI(nibble,2), data); proto_item_append_text(ti, " (0x%02x)", data >> 1); proto_tree_add_uint(tree, hf_ulmap_uiuc14_bwr, tvb, NIBHI(nibble+1,1), data); @@ -1702,8 +1702,8 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g else if (uiuc == 15) { /* 8.4.5.4.4 [1] Extended UIUC dependent IE table 291 */ - ext_uiuc = NIB_NIBBLE(5+nibble, bufptr); - len = NIB_NIBBLE(5+nibble+1, bufptr); + ext_uiuc = TVB_NIB_NIBBLE(5+nibble, tvb); + len = TVB_NIB_NIBBLE(5+nibble+1, tvb); tree = proto_tree_add_subtree_format(ie_tree, tvb, NIBHI(nibble, 5+2+len*2), ett_291, NULL, "UIUC: %d (Extended IE)", uiuc); @@ -1725,47 +1725,47 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g switch (ext_uiuc) { case 0x00: /* 8.4.5.4.5 Power_Control_IE */ - nibble = Power_Control_IE(tree, bufptr, nibble, len, tvb); + nibble = Power_Control_IE(tree, nibble, len, tvb); break; case 0x01: /* 8.4.5.4.8 Mini-Subchannel_allocation_IE*/ - nibble = Mini_Subchannel_allocation_IE(tree, bufptr, nibble, len, tvb); + nibble = Mini_Subchannel_allocation_IE(tree, nibble, len, tvb); break; case 0x02: /* 8.4.5.4.6 AAS_UL_IE*/ - nibble = AAS_UL_IE(tree, bufptr, nibble, len, tvb); + nibble = AAS_UL_IE(tree, nibble, len, tvb); break; case 0x03: /* 8.4.5.4.12 CQICH_Alloc_IE */ - nibble = CQICH_Alloc_IE(tree, bufptr, nibble, len, tvb); + nibble = CQICH_Alloc_IE(tree, nibble, len, tvb); break; case 0x04: /* 8.4.5.4.7 UL_Zone_IE */ - nibble = UL_Zone_IE(tree, bufptr, nibble, len, tvb); + nibble = UL_Zone_IE(tree, nibble, len, tvb); break; case 0x05: /* 8.4.5.4.14 PHYMOD_UL_IE */ - nibble = PHYMOD_UL_IE(tree, bufptr, nibble, len, tvb); + nibble = PHYMOD_UL_IE(tree, nibble, len, tvb); break; case 0x06: /* 8.4.5.4.11 MIMO_UL_IE */ - nibble = MIMO_UL_IE(tree, bufptr, nibble, len, tvb); + nibble = MIMO_UL_IE(tree, nibble, len, tvb); break; case 0x07: /* 8.4.5.4.22 ULMAP_Fast_Tracking_IE */ - nibble = ULMAP_Fast_Tracking_IE(tree, bufptr, nibble, len, tvb); + nibble = ULMAP_Fast_Tracking_IE(tree, nibble, len, tvb); break; case 0x08: /* 8.4.5.4.17 UL_PUSC_Burst_Allocation_in_other_segment_IE */ - nibble = UL_PUSC_Burst_Allocation_in_other_segment_IE(tree, bufptr, nibble, len, tvb); + nibble = UL_PUSC_Burst_Allocation_in_other_segment_IE(tree, nibble, len, tvb); break; case 0x09: /* 8.4.5.4.21 Fast_Ranging_IE */ - nibble = Fast_Ranging_IE(tree, bufptr, nibble, len, tvb); + nibble = Fast_Ranging_IE(tree, nibble, len, tvb); break; case 0x0a: /* 8.4.5.4.15 UL_Allocation_Start_IE */ - nibble = UL_Allocation_Start_IE(tree, bufptr, nibble, len, tvb); + nibble = UL_Allocation_Start_IE(tree, nibble, len, tvb); break; default: proto_tree_add_text(tree, tvb, NIBHI(nibble,len), "(reserved Extended UIUC: %d)", ext_uiuc); @@ -1788,13 +1788,13 @@ gint dissect_ulmap_ie( proto_tree *ie_tree, const guint8 *bufptr, gint offset, g proto_tree_add_uint(tree, hf_ulmap_ie_uiuc, tvb, NIBHI(nibble, 1), uiuc); nibble += 1; - data = NIB_WORD(nibble, bufptr); + data = TVB_NIB_WORD(nibble, tvb); proto_tree_add_uint(tree, hf_ulmap_uiuc10_dur, tvb, NIBHI(nibble,3), data); proto_tree_add_uint(tree, hf_ulmap_uiuc10_rep, tvb, NIBHI(nibble+2,1), data); nibble += 3; if (aas_or_amc) { - data = NIB_BITS12(nibble, bufptr); + data = TVB_NIB_BITS12(nibble, tvb); proto_tree_add_text(tree, tvb, NIBHI(nibble,3), "Slot offset: %d", data); nibble += 3; } @@ -1814,11 +1814,8 @@ static void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo proto_tree *ulmap_tree = NULL; proto_tree *ie_tree = NULL; guint tvb_len; - const guint8 *bufptr; tvb_len = tvb_reported_length(tvb); - /* XXX This should be removed, and regular tvb accessors should be used instead. */ - bufptr = tvb_get_ptr(tvb, offset, tvb_len); /* display MAC UL-MAP */ ti = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_ulmap_decoder, tvb, offset, -1, "UL-MAP"); @@ -1840,7 +1837,7 @@ static void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo /* length = BYTE_TO_NIB(length); */ /* convert length to nibbles */ nib = BYTE_TO_NIB(offset); while (nib < ((tvb_len*2)-1)) { - nib += dissect_ulmap_ie(ie_tree, bufptr, nib, tvb_len*2, tvb); + nib += dissect_ulmap_ie(ie_tree, nib, tvb_len*2, tvb); } pad = NIB_PADDING(nib); if (pad) { @@ -1850,7 +1847,7 @@ static void dissect_mac_mgmt_msg_ulmap_decoder(tvbuff_t *tvb, packet_info *pinfo } /*gint wimax_decode_ulmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)*/ -gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +gint wimax_decode_ulmapc(proto_tree *base_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.6.2 [2] Compressed UL-MAP */ /* returns length in nibbles */ @@ -1867,19 +1864,19 @@ gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offse tree = proto_item_add_subtree(ti, ett_306); /* Decode and display the UL-MAP */ - data = NIB_BYTE(nib, bufptr); + data = TVB_NIB_BYTE(nib, tvb); proto_tree_add_uint(tree, hf_ulmap_ucd_count, tvb, NIBHI(nib,2), data); nib += 2; - data = NIB_LONG(nib, bufptr); + data = TVB_NIB_LONG(nib, tvb); proto_tree_add_uint(tree, hf_ulmap_alloc_start_time, tvb, NIBHI(nib,8), data); nib += 8; - data = NIB_BYTE(nib, bufptr); + data = TVB_NIB_BYTE(nib, tvb); proto_tree_add_uint(tree, hf_ulmap_ofdma_sym, tvb, NIBHI(nib,2), data); /* added 2005 */ nib += 2; ie_tree = proto_tree_add_subtree_format(tree, tvb, NIBHI(nib,length-nib), ett_306_ul, NULL, "UL-MAP IEs (%u bytes)", NIB_ADDR(length-nib)); while (nib < length-1) { - nib += dissect_ulmap_ie(ie_tree, bufptr, nib, length-nib, tvb); + nib += dissect_ulmap_ie(ie_tree, nib, length-nib, tvb); } /* padding */ @@ -1893,7 +1890,7 @@ gint wimax_decode_ulmapc(proto_tree *base_tree, const guint8 *bufptr, gint offse } -gint wimax_decode_ulmap_reduced_aas(proto_tree *base_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb) +gint wimax_decode_ulmap_reduced_aas(proto_tree *base_tree, gint offset, gint length, tvbuff_t *tvb) { /* 8.4.5.8.2 Reduced AAS private UL-MAP */ /* offset and length are in bits since this is called from within @@ -1929,7 +1926,7 @@ gint wimax_decode_ulmap_reduced_aas(proto_tree *base_tree, const guint8 *bufptr, } if (umii) { XBIT(data, 8, "UCD Count"); - data = BIT_BITS64(bit,bufptr,32); + data = TVB_BIT_BITS64(bit,tvb,32); proto_tree_add_text(tree, tvb, BITHI(bit,32), "Private Map Allocation Start Time: %u",data); bit += 32; } @@ -1937,7 +1934,7 @@ gint wimax_decode_ulmap_reduced_aas(proto_tree *base_tree, const guint8 *bufptr, XBIT(data, 1, "Preamble Select"); XBIT(data, 4, "Preamble Shift Index"); XBIT(data, 1, "Pilot Pattern Modifier"); - data = BIT_BITS32(bit,bufptr,22); + data = TVB_BIT_BITS32(bit,tvb,22); proto_tree_add_text(tree, tvb, BITHI(bit,22), "Pilot Pattern Index: %u",data); bit += 22; } diff --git a/plugins/wimax/packet-wmx.c b/plugins/wimax/packet-wmx.c index fdbf2aa75d..74dddcdd19 100644 --- a/plugins/wimax/packet-wmx.c +++ b/plugins/wimax/packet-wmx.c @@ -35,7 +35,6 @@ #include <epan/address.h> #include <epan/wmem/wmem.h> #include "wimax_tlv.h" -#include "wimax_bits.h" void proto_register_wimax(void); diff --git a/plugins/wimax/wimax_bits.h b/plugins/wimax/wimax_bits.h index ed5b00442d..ae0ab4e3a8 100644 --- a/plugins/wimax/wimax_bits.h +++ b/plugins/wimax/wimax_bits.h @@ -48,62 +48,42 @@ #define NIBBLE_MASK 0x0F #define BYTE_MASK 0xFF -/* extract the nibble at the given nibble address 'n' of buffer 'b' */ -#define NIB_NIBBLE(n,b) \ - (((n) & 1) \ - ? (b)[(n)/2] & NIBBLE_MASK \ - : ((b)[(n)/2] >> 4) & NIBBLE_MASK) +/* extract the nibble at the given nibble address 'n' of tvbuff_t 't' */ #define TVB_NIB_NIBBLE(n,t) \ (((n) & 1) \ ? tvb_get_guint8((t), (n)/2) & NIBBLE_MASK \ : (tvb_get_guint8((t), (n)/2) >> 4) & NIBBLE_MASK) -/* extract the byte at the given nibble address 'n' of buffer 'b' */ -#define NIB_BYTE(n,b) \ +/* extract the byte at the given nibble address 'n' of tvbuff_t 't' */ +#define TVB_NIB_BYTE(n,t) \ (n) & 1 \ - ? (pntoh16( (b)+(n)/2 ) >> 4) & BYTE_MASK \ - : (b)[(n)/2] - /* - ? (pletoh16((b)+(n)/2) >> 4) & BYTE_MASK \ - */ + ? (tvb_get_ntohs((t), (n)/2) >> 4) & BYTE_MASK \ + : tvb_get_guint8((t), (n)/2) /* extract 12 bits at the given nibble address */ -#define NIB_BITS12(n,b) \ - (NIB_NIBBLE(n,b+1) | (NIB_BYTE(n,b) << 4)) +#define TVB_NIB_BITS12(n,t) \ + (TVB_NIB_NIBBLE(n+2,t) | (TVB_NIB_BYTE(n,t) << 4)) -/* extract the word at the given nibble address 'n' of buffer 'b' */ -#define NIB_WORD(n,b) \ - (n) & 1 \ - ? (gint)((pntoh32(((b) + (n)/2)) >> 12) & 0x0000FFFF) \ - : pntoh16((b) + (n)/2) - /* - : pletoh16((b) + (n)/2) - ? (pletoh32((b)+(n)/2) >> 12) & 0x0000FFFF \ - */ +/* extract the word at the given nibble address 'n' of tvbuff_t 't' */ #define TVB_NIB_WORD(n,t) \ (n) & 1 \ ? (gint)((tvb_get_ntohl((t), (n)/2) >> 12) & 0x0000FFFF) \ : tvb_get_ntohs((t), (n)/2) -/* extract the word at the given nibble address 'n' of buffer 'b' */ -#define NIB_LONG(n,b) \ +/* extract the word at the given nibble address 'n' of tvbuff_t 't' */ +#define TVB_NIB_LONG(n,t) \ (n) & 1 \ - ? (pntoh32(((b) + (n)/2)) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \ - : pntoh32((b) + (n)/2) - /* - ? (pletoh32((b) + (n)/2) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \ - : pletoh32((b) + (n)/2) - */ + ? (tvb_get_ntohl((t), (n)/2) << 4) | ((tvb_get_guint8((t), (n)/2 + 4) >> 4) & NIBBLE_MASK) \ + : tvb_get_ntohl((t), (n)/2) /* Only currently used with nib == 1 or 2 */ -#define NIB_NIBS(nib, buf, num) \ - ((num) == 1 ? NIB_NIBBLE(nib,buf) : \ - ((num) == 2 ? NIB_BYTE(nib,buf) : \ - ((num) == 3 ? NIB_BITS12(nib,buf) : \ - ((num) == 4 ? NIB_WORD(nib,buf) : \ +#define TVB_NIB_NIBS(nib, t, num) \ + ((num) == 1 ? TVB_NIB_NIBBLE(nib,t) : \ + ((num) == 2 ? TVB_NIB_BYTE(nib,t) : \ + ((num) == 3 ? TVB_NIB_BITS12(nib,t) : \ + ((num) == 4 ? TVB_NIB_WORD(nib,t) : \ 0)))) - /* to highlight nibfields correctly in wireshark * AddItem(..., WSADDR(buf,bit), WSLEN(bit), ...) */ @@ -147,50 +127,50 @@ #define MASK64b(bit,num) (MASK32(num - (32 - OFFSET32(bit)))) /* note that if you have a bitfield of length 2 or more, it may cross a - * byte boundary so you should use BIT_BITS16 */ + * byte boundary so you should use TVB_BIT_BITS16 */ /* extract a single bit * bit ... bit address - * buf ... buffer + * tvb ... tvbuff_t */ -#define BIT_BIT(bit, buf) \ - (( (buf)[ADDR(bit)] >> SHIFT(bit,1) ) & 0x1) +#define TVB_BIT_BIT(bit, tvb) \ + (( tvb_get_guint8(tvb, ADDR(bit)) >> SHIFT(bit,1) ) & 0x1) /* extract bitfield up to 9 bits * bit ... bit address - * buf ... buffer + * tvb ... tvbuff_t * num ... length of bitfield */ -#define BIT_BITS16(bit, buf, num) \ - (( pntoh16(buf+ADDR16(bit)) >> SHIFT16(bit,num) ) & MASK16(num)) +#define TVB_BIT_BITS16(bit, tvb, num) \ + (( tvb_get_ntohs(tvb, ADDR16(bit)) >> SHIFT16(bit,num) ) & MASK16(num)) /* extract bitfield up to 24 bits * bit ... bit address - * buf ... buffer + * tvb ... tvbuff_t * num ... length of bitfield */ -#define BIT_BITS32(bit, buf, num) \ - ((pntoh32(buf+ADDR32(bit)) >> SHIFT32(bit,num) ) & MASK32(num)) +#define TVB_BIT_BITS32(bit, tvb, num) \ + ((tvb_get_ntohl(tvb, ADDR32(bit)) >> SHIFT32(bit,num) ) & MASK32(num)) /* bitfield up to 32 bits */ -#define BIT_BITS64a(bit, buf, num) \ - ((pntoh32(buf+ADDR32(bit)) & MASK64a(bit)) << SHIFT64a(bit,num)) +#define TVB_BIT_BITS64a(bit, tvb, num) \ + ((tvb_get_ntohl(tvb, ADDR32(bit)) & MASK64a(bit)) << SHIFT64a(bit,num)) -#define BIT_BITS64b(bit, buf, num) \ - ((pntoh32(buf+ADDR32(bit)+4) >> SHIFT64b(bit,num) ) & MASK64b(bit,num)) +#define TVB_BIT_BITS64b(bit, tvb, num) \ + ((tvb_get_ntohl(tvb, ADDR32(bit)+4) >> SHIFT64b(bit,num) ) & MASK64b(bit,num)) -#define BIT_BITS64(bit, buf, num) \ +#define TVB_BIT_BITS64(bit, tvb, num) \ ( (OFFSET32(bit)+(num)) <= 32 \ - ? BIT_BITS32(bit,buf,num) \ - : BIT_BITS64a(bit,buf,num) \ - | BIT_BITS64b(bit,buf,num) ) - -#define BIT_BITS(bit, buf, num) \ - ((num) == 1 ? (gint)BIT_BIT(bit,buf) : \ - ((num) <= 9 ? (gint)BIT_BITS16(bit,buf,num) : \ - ((num) <= 24 ? (gint)BIT_BITS32(bit,buf,num) : \ - ((num) <= 32 ? (gint)BIT_BITS64(bit,buf,num) : \ + ? TVB_BIT_BITS32(bit,tvb,num) \ + : TVB_BIT_BITS64a(bit,tvb,num) \ + | TVB_BIT_BITS64b(bit,tvb,num) ) + +#define TVB_BIT_BITS(bit, tvb, num) \ + ((num) == 1 ? (gint)TVB_BIT_BIT(bit,tvb) : \ + ((num) <= 9 ? (gint)TVB_BIT_BITS16(bit,tvb,num) : \ + ((num) <= 24 ? (gint)TVB_BIT_BITS32(bit,tvb,num) : \ + ((num) <= 32 ? (gint)TVB_BIT_BITS64(bit,tvb,num) : \ (gint)0 )))) /* to highlight bitfields correctly in wireshark @@ -203,14 +183,6 @@ #define BITHI(bit,len) BIT_ADDR(bit),BIT_LEN(bit,len) -/* CONVENIENCE FUNCTIONS */ - -#define BIT_NIBBLE(bit,buf) BIT_BITS16(bit,buf,4) -#define BIT_BYTE(bit,buf) BIT_BITS16(bit,buf,8) -#define BIT_WORD(bit,buf) BIT_BITS32(bit,buf,16) -#define BIT_WORD24(bit,buf) BIT_BITS32(bit,buf,24) -#define BIT_LONG(bit,buf) BIT_BITS64(bit,buf,32) - /******************************************************************** * padding functions - return number of nibbles/bits needed to * pad to a byte boundary */ |