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

📄 plugins-wimax-msg_ulmap.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 5 页
字号:
{
    /* 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 */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    proto_item *generic_item = NULL;
    gint duci;
    guint16 calculated_crc;

    bit = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_HARQ_IR_CC_Sub_Burst_IE");
    tree = proto_item_add_subtree(ti, ett_302m);

    bit += RCID_IE(tree, bufptr, 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);
    }
    XBIT(data, 4, "UIUC");
    XBIT(data, 2, "Repetition Coding Indication");
    XBIT(data,10, "Duration");
    XBIT(data, 2, "SPID");
    XBIT(data, 4, "ACID");
    XBIT(data, 1, "AI_SN");
    XBIT(data, 1, "ACK_disable");
    XBIT(data, 3, "Reserved");

    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 - offset); /* length in bits */
}

gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, 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 */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    proto_item *generic_item = NULL;
    gint muin,dmci,ackd,i;
    guint16 calculated_crc;

    bit = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_Chase_HARQ_Sub_Burst_IE");
    tree = proto_item_add_subtree(ti, ett_302n);

    XBIT(muin, 1, "MU indicator");
    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);
        if (dmci) {
            bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb);
        }
    } else {
        XBIT(data, 1, "Matrix");
    }
    XBIT(data, 10, "Duration");
    for (i = 0; i < N_layer; i++) {
        if (muin == 1) {
            bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
        }
        XBIT(data, 4, "UIUC");
        XBIT(data, 2, "Repetition Coding Indication");
        if (ackd == 0) {
            XBIT(data, 4, "ACID");
            XBIT(data, 1, "AI_SN");
        }
    }

    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 - offset); /* length in bits */
}

gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, 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 */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    proto_item *generic_item = NULL;
    gint muin,dmci,ackd,i;
    guint16 calculated_crc;

    bit = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_IR_HARQ__Sub_Burst_IE");
    tree = proto_item_add_subtree(ti, ett_302o);

    XBIT(muin, 1, "MU indicator");
    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);
        if (dmci) {
            bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb);
        }
    } else {
        XBIT(data, 1, "Matrix");
    }
    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);
        }
        XBIT(data, 4, "N(EP)");
        if (ackd == 0) {
            XBIT(data, 2, "SPID");
            XBIT(data, 4, "ACID");
            XBIT(data, 1, "AI_SN");
        }
    }

    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 - offset); /* length in bits */
}

gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, const guint8 *bufptr, 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 */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    proto_item *generic_item = NULL;
    gint muin,dmci,ackd,i;
    guint16 calculated_crc;

    bit = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE");
    tree = proto_item_add_subtree(ti, ett_302p);

    XBIT(muin, 1, "MU indicator");
    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);
        if (dmci) {
            bit += Dedicated_MIMO_UL_Control_IE(tree, bufptr, bit, length, tvb);
        }
    } else {
        XBIT(data, 1, "Matrix");
    }
    XBIT(data, 10, "Duration");
    for (i = 0; i < N_layer; i++) {
        if (muin == 1) {
            bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
        }
        XBIT(data, 4, "UIUC");
        XBIT(data, 2, "Repetition Coding Indication");
        if (ackd == 0) {
            XBIT(data, 4, "ACID");
            XBIT(data, 1, "AI_SN");
            XBIT(data, 2, "SPID");
        }
    }

    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 - offset); /* length in bits */
}

gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, const guint8 *bufptr, 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 */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    proto_item *generic_item = NULL;
    gint ackd,txct,sboi;
    guint16 calculated_crc;

    bit = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "MIMO_UL_STC_HARQ_Sub_Burst_IE");
    tree = proto_item_add_subtree(ti, ett_302q);

    XBIT(txct, 2, "Tx count");
    XBIT(data, 10, "Duration");
    XBIT(sboi, 1, "Sub-burst offset indication");
    /*XBIT(muin, 1, "Reserved");*/
    if (sboi == 1) {
        XBIT(data, 8, "Sub-burst offset");
    }
    bit += RCID_IE(tree, bufptr, bit, length, tvb, RCID_Type);
    XBIT(ackd, 1, "ACK Disable");
    if (txct == 0) {
        XBIT(data, 4, "UIUC");
        XBIT(data, 2, "Repetition Coding Indication");
    }
    if (ackd == 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 - offset); /* length in bits */
}

/********************************************************************
 * UL-MAP Extended IEs
 * table 290a
 *******************************************************************/

gint Power_Control_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* UL-MAP Extended IE = 0 */
    /* 8.4.5.4.5 Power_Control_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint nib;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;

    nib = offset;

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Power_Control_IE");
    tree = proto_item_add_subtree(ti, ett_292);

    XNIB(data, 1, "Extended UIUC");
    XNIB(data, 1, "Length");

    XNIB(data, 2, "Power Control");
    XNIB(data, 2, "Power measurement frame");
    return nib;
}

gint Mini_Subchannel_allocation_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* UL-MAP Extended IE = 1 */
    /* 8.4.5.4.8 [2] Mini-Subchannel_allocation_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    gint j, M;
    const gint m_table[4] = { 2, 2, 3, 6 };

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "Mini_subchannel_allocation_IE");
    tree = proto_item_add_subtree(ti, ett_295);

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

    XBIT(data, 2, "Ctype");
    M = m_table[data];
    XBIT(data, 6, "Duration");

    for (j = 0; j < M; j++) {
        data = BIT_BITS(bit, bufptr, 16);
        proto_tree_add_text(tree, tvb, BITHI(bit, 16), "CID(%d): %d", j, data);
        bit += 16;
        data = BIT_BITS(bit, bufptr, 4);
        proto_tree_add_text(tree, tvb, BITHI(bit, 4), "UIUC(%d): %d", j, data);
        bit += 4;
        data = BIT_BITS(bit, bufptr, 2);
        proto_tree_add_text(tree, tvb, BITHI(bit, 2), "Repetition(%d): %d", j, data);
        bit += 2;
    }
    if (M == 3) {
        XBIT(data, 4, "Padding");
    }
    return BIT_TO_NIB(bit);
}

gint AAS_UL_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* UL-MAP Extended IE = 2 */
    /* 8.4.5.4.6 [2] AAS_UL_IE*/
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "AAS_UL_IE");
    tree = proto_item_add_subtree(ti, ett_293);

    XBIT(data, 4, "Extended UIUC");
    XBIT(data, 4, "Length");

    XBIT(data, 2, "Permutation");
    XBIT(data, 7, "UL_PermBase");
    XBIT(data, 8, "OFDMA symbol offset");
    XBIT(data, 8, "AAS zone length");
    XBIT(data, 2, "Uplink peramble config");
    XBIT(data, 1, "Preamble type");
    XBIT(data, 4, "Reserved");
    return BIT_TO_NIB(bit);
}

gint CQICH_Alloc_IE(proto_tree *uiuc_tree, const guint8 *bufptr, gint offset, gint length, tvbuff_t *tvb)
{
    /* UL-MAP Extended IE = 3 */
    /* 8.4.5.4.12 [2] CQICH_Alloc_IE */
    /* offset of TLV in nibbles, length of TLV in nibbles */
    gint bit;
    gint data;
    proto_item *ti = NULL;
    proto_item *tree = NULL;
    gint rci, rtype, ftype, zperm, mgi, api, pad;

    bit = NIB_TO_BIT(offset);

    ti = proto_tree_add_text(uiuc_tree, tvb, NIBHI(offset, length), "UL_ZONE_IE");
    tree = proto_item_add_subtree(ti, ett_300);

    XBIT(data, 4, "Extended UIUC");
    XBIT(data, 4, "Length");

    if (cqich_id_size == 0) {
        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);
        proto_tree_add_text(tree, tvb, BITHI(bit, cqich_id_size), "CQICH_ID: %d (%d bits)", data, cqich_id_size);
        bit += cqich_id_size;
    }

    XBIT(data, 6, "Allocation offset");
    XBIT(data, 2, "Period (p)");
    XBIT(data, 3, "Frame offset");
    XBIT(data, 3, "Duration (d)");
    XBIT(rci,  1, "Report configuration included");
    if (rci)
    {
        XBIT(ftype, 2, "Feedback Type");
        XBIT(rtype, 1, "Report type");
        if (rtype == 0) {
            XBIT(data, 1, "CINR preamble report type");
        }
        else {
            XBIT(zperm, 3, "Zone permutation");
            XBIT(data, 2, "Zone type");
            XBIT(data, 2, "Zone PRBS_ID");
            if (zperm == 0 || zperm == 1) {
                XBIT(mgi, 1, "Major group indicatioon");
                if (mgi == 1) {
                    /* PUSC major group bitmap*/
                    XBIT(data, 6, "PUSC Major group bitmap");
                }

⌨️ 快捷键说明

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