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>
This commit is contained in:
Michael Mann 2014-07-30 09:58:53 -04:00
parent 82bb8008ce
commit ede5a9d4c0
4 changed files with 425 additions and 378 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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;
}

View File

@ -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);

View File

@ -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) )
? TVB_BIT_BITS32(bit,tvb,num) \
: TVB_BIT_BITS64a(bit,tvb,num) \
| TVB_BIT_BITS64b(bit,tvb,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) : \
#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 */