⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugins-wimax-msg_dlmap.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 5 页
字号:
}

gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* offset of IE in nibbles, length is variable */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    proto_item *generic_item = NULL;
    gint nsub, sbi, txc, akd, dmci;
    gint j;
    guint16 calculated_crc;

    bit = NIB_TO_BIT(offset);

    /* 8.4.5.3.21 table 286s */
    ti = proto_tree_add_text(diuc_tree, tvb, BITHI(bit, 1), "MIMO DL STC HARQ sub-burst IE");
    tree = proto_item_add_subtree(ti, ett_286s);

    XBIT(nsub, 4, "N sub burst[ISI]");
    XBIT(data, 6, "N ACK channel");

    nsub += 1;
    for (j = 0; j < nsub; j++) {
	XBIT(txc, 2, "TX Count");
	XBIT(data, 10, "Duration");
	XBIT(sbi, 1, "Sub-burst offset indication");
	XBIT(data, 3, "Reserved");
        if (sbi == 1) {
	    XBIT(data, 8, "Sub-burst offset");
        }
        bit += RCID_IE(tree, bufptr, 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);
            }
	    XBIT(data, 4, "DIUC");
	    XBIT(data, 2, "Repetition coding Indication");
        }
        if (akd == 0) {
	    XBIT(data, 4, "ACID");
        }
    }

    if (include_cor2_changes)
    {
	/* CRC-16 is always appended */
	data = BIT_BITS(bit, bufptr, 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));
	if (data != calculated_crc)
	{
		proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc);
	}
	bit += 16;
    }

    return (BIT_TO_NIB(bit) - offset);
}

/********************************************************************
 * DL-MAP Extended-2 IEs
 *******************************************************************/

gint MBS_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 0 */
    /* 8.4.5.3.12 MBS_MAP_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    gint mde, dci, s3i;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MBS_MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286a);

    XBIT(data,  4, "Extended-2 DIUC");
    XBIT(data,  8, "Length");

    XBIT(data, 7, "MBS Zone identifier");
    XBIT(mde, 1, "Macro diversity enhanced");
    if (mde == 1)
    {
	XBIT(data, 2, "Permutation");
	XBIT(data, 5, "DL_PermBase");
	XBIT(data, 2, "PRBS_ID");
	XBIT(data, 7, "OFDMA_Symbol_Offset");
	XBIT(dci, 1, "DIUC_change_indication");
	XBIT(data, 3, "Reserved");
        if (dci == 1) {
	    XBIT(data, 3, "Reserved");
	    XBIT(data, 3, "Boosting");
	    XBIT(data, 4, "DIUC");
	    XBIT(data, 6, "No. Subchannels");
	    XBIT(data, 6, "No. OFDMA Symbols");
	    XBIT(data, 2, "Repetition Coding Indication");
        }
    } else {
	XBIT(data, 4, "DIUC");
	XBIT(data, 16, "CID");
	XBIT(data, 8, "OFDMA Symbols Offset");
	XBIT(data, 6, "Subchannel offset");
	XBIT(data, 3, "Boosting");
	XBIT(s3i, 1, "SLC_3_indication");
	XBIT(data, 6, "No. OFDMA Symbols");
	XBIT(data, 6, "No. Subchannels");
	XBIT(data, 2, "Repetition Coding Indication");
        if (s3i == 1) {
	    XBIT(data, 8, "Next MBS_MAP_IE frame offset");
        }
    }
    data = BIT_PADDING(bit, 4);
    if (data) {
        proto_tree_add_text(tree, tvb, BITHI(bit,data), "Padding: %d bits", data);
        bit += data;
    }
    return BIT_TO_NIB(bit);
}

gint HO_Anchor_Active_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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 */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HO_Anchor_Active_DL_MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286c);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint HO_Active_Anchor_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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 */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HO_Active_Anchor_DL_MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286d);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint HO_CID_Translation_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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 */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "CID_Translation_MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286e);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint MIMO_in_another_BS_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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)*/
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "MIMO_in_another_BS_IE");
    tree = proto_item_add_subtree(ti, ett_286f);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint Macro_MIMO_DL_Basic_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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) */
    /* offset of tlv in nibbles, length of tlv in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Macro_MIMO_DL_Basic_IE");
    tree = proto_item_add_subtree(ti, ett_286g);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint Skip_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 6 */
    /* 8.4.5.3.20.2 Skip_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Skip_IE");
    tree = proto_item_add_subtree(ti, ett_286k);

    XBIT(data,  4, "Extended-2 DIUC");
    XBIT(data,  8, "Length");

    XBIT(data,  1, "Mode");
    XBIT(data,  7, "Reserved");

    return BIT_TO_NIB(bit);
}

gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 7 */
    /* 8.4.5.3.21 [2] HARQ_DL_MAP_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    gint len, lastbit, rui, mode;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HARQ_DL_MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286l);

    XBIT(data,  4, "Extended-2 DIUC");
    XBIT(len,  8, "Length");

    XBIT(RCID_Type,  2, "RCID_Type");
    XBIT(data,  2, "Reserved");

    /* while data remains */
    length = NIB_TO_BIT(length);
    /* Subtract extra nibble to be sure to stop in time. */
    lastbit = bit + BYTE_TO_BIT(len) - 14 - 4;
    while (bit < lastbit) {
        XBIT(data,  3, "Boosting");
        XBIT(rui,  1, "Region_ID use indicator");

        if (rui == 0) {
            XBIT(data,  8, "OFDMA symbol offset");
            XBIT(data,  7, "Subchannel offset");
            XBIT(data,  7, "Number of OFDMA symbols");
            XBIT(data,  7, "Number of subchannels");
	    if (include_cor2_changes)
	    {
		XBIT(data,  1, "Rectangular Sub-Burst Indicator"); /* Implemented: "Rectangular Sub-Burst Indicator" field added */
		XBIT(data,  2, "Reserved");   /* and "Reserved" field resized from 3 bits to 2 bits         */
	    }
	    else
	    {
		XBIT(data,  3, "Reserved");
	    }
        } else {
            XBIT(data,  8, "Region_ID");
        }
        XBIT(mode,  4, "Mode");
        XBIT(data,  8, "Sub-burst IE Length");

        /* 8.4.5.3.21 */
        /* length of these are variable, each returns length in nibbles */
        if (mode == 0) {
            bit += 4*DL_HARQ_Chase_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 1) {
            bit += 4*DL_HARQ_IR_CTC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 2) {
            bit += 4*DL_HARQ_IR_CC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 3) {
            bit += 4*MIMO_DL_Chase_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 4) {
            bit += 4*MIMO_DL_IR_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 5) {
            bit += 4*MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else if (mode == 6) {
            bit += 4*MIMO_DL_STC_HARQ_sub_burst_IE(diuc_tree, bufptr, BIT_TO_NIB(bit), length, tvb);
        } else {
            proto_tree_add_text(diuc_tree, tvb, BITHI(bit,1), "(reserved Mode)");
            break; /* cannot continue */
        }
    }
    return BIT_TO_NIB(bit);
}

gint HARQ_ACK_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 8 */
    /* 8.4.5.3.22 HARQ_ACK IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint data;
    gint nib;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "HARQ_ACK_IE");
    tree = proto_item_add_subtree(ti, ett_286u);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");

    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib,length-3), "(bitmap data)");

    return nib;
}

gint Enhanced_DL_MAP_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 9 */
    /* 8.4.5.3.23 Enhanced DL MAP IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    gint numass, n_cid;
    gint i, n;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "Enhanced_DL-MAP_IE");
    tree = proto_item_add_subtree(ti, ett_286v);

    XBIT(data,  4, "Extended-2 DIUC");
    XBIT(data,  8, "Length");

    XBIT(numass, 4, "Num_Assignment");
    for (i = 0; i < numass; i++) {
        if (INC_CID == 1) {
	    XBIT(n_cid, 8, "N_CID");
            for (n = 0; n < n_cid; n++) {
		XBIT(data, 16, "CID");
            }
        }
	XBIT(data, 4, "DIUC");
	XBIT(data, 3, "Boosting");
	XBIT(data, 2, "Repetition Coding Indication");
	XBIT(data, 8, "Region_ID");
	XBIT(data, 3, "Reserved");
    }
    return BIT_TO_NIB(bit);
}

gint Closed_loop_MIMO_DL_Enhanced_IE(proto_tree *diuc_tree, const guint8 *bufptr, 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) */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "CL_MIMO_DL_Enhanced_IE");
    tree = proto_item_add_subtree(ti, ett_286w);

    XNIB(data,  1, "Extended-2 DIUC");
    XNIB(data,  2, "Length");
    proto_tree_add_text(diuc_tree, tvb, NIBHI(nib, length-3), "(not implemented)");
    return nib;
}

gint AAS_SDMA_DL_IE(proto_tree *diuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* DL-MAP Extended-2 IE = 0xE */
    /* 8.4.5.3.26 AAS_SDMA_DL_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_tree *tree = NULL;
    gint num_region, num_users, pilot_pattern, encoding_mode, ackch_alloc, cqich_alloc;
    gint aas_preamble = 1;
    gint zone_permut = 0; /* TODO */
    gint i, j;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(diuc_tree, tvb, NIBHI(offset, length), "AAS_SDMA_DL_IE");
    tree = proto_item_add_subtree(ti, ett_286y);

    XBIT(data,  4, "Extended-2 DIUC");
    XBIT(data,  8, "Length");

    XBIT(RCID_Type,  2, "RCID_Type");
    XBIT(num_region,  4, "Num_Burst_Region");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -