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

📄 plugins-wimax-wimax_compact_ulmap_ie_decoder.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 5 页
字号:
	},
	{
		&hf_extended_uiuc_ie_mini_subchannel_alloc_padding,
		{"Padding", "wimax.extended_uiuc_ie.mini_subchannel_alloc.padding", FT_UINT8, BASE_HEX, NULL, MINI_SUBCHANNEL_PADDING_MASK, "", HFILL }
	},
	{
		&hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1,
		{"Padding", "wimax.extended_uiuc_ie.mini_subchannel_alloc.padding", FT_UINT24, BASE_HEX, NULL, MINI_SUBCHANNEL_PADDING_MASK_1, "", HFILL }
	},
	{	/* 8.4.5.4.6 AAS_UL_IE */
		&hf_extended_uiuc_ie_aas_ul,
		{"AAS_UL_IE (not implemented)", "wimax.extended_uiuc_ie.aas_ul", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.12 CQICH Allocation IE */
		&hf_extended_uiuc_ie_cqich_alloc,
		{"CQICH Allocation IE (not implemented)", "wimax.extended_uiuc_ie.cqich_alloc", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.7 UL Zone IE */
		&hf_extended_uiuc_ie_ul_zone,
		{"UL Zone IE (not implemented)", "wimax.extended_uiuc_ie.ul_zone", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},

	{	/* 8.4.5.4.14 MIMO_UL_Basic_IE */
		&hf_extended_uiuc_ie_mimo_ul_basic,
		{"MIMO UL Basic IE (not implemented)", "wimax.extended_uiuc_ie.mimo_ul_basic", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.22 UL-MAP Fast Tracking IE */
		&hf_extended_uiuc_ie_fast_tracking,
		{"UL-MAP Fast Tracking IE (not implemented)", "wimax.extended_uiuc_ie.fast_tracking", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.21 Fast Ranging IE */
		&hf_extended_uiuc_ie_fast_ranging,
		{"Fast Ranging IE (not implemented)", "wimax.extended_uiuc_ie.fast_ranging", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.14 UL-MAP Physical Modifier IE */
		&hf_extended_uiuc_ie_phymod_ul,
		{"UL-MAP Physical Modifier IE (not implemented)", "wimax.extended_uiuc_ie.phymod_ul", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.17 UL PUSC Burst Allocation in Other Segment IE */
		&hf_extended_uiuc_ie_ul_pusc_burst_allocation,
		{"UL_PUSC_Burst_Allocation_in_Other_Segment_IE (not implemented)", "wimax.extended_uiuc_ie.ul_pusc_burst_allocation", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* 8.4.5.4.15 UL Allocation Start IE */
		&hf_extended_uiuc_ie_ul_allocation_start,
		{"UL Allocation Start IE (not implemented)", "wimax.extended_uiuc_ie.ul_allocation_start", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	},
	{	/* unknown UIUC */
		&hf_extended_uiuc_ie_unknown_uiuc,
		{"Unknown Extended UIUC", "wimax.extended_uiuc.unknown_uiuc", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
	}
};

/* Register Wimax Compact UL-MAP IE Protocol */
void proto_register_wimax_compact_ulmap_ie(void)
{
	if (proto_wimax_compact_ulmap_ie_decoder == -1)
	{
		proto_wimax_compact_ulmap_ie_decoder = proto_wimax;

		proto_register_subtree_array(ett, array_length(ett));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_compact_ulmap, array_length(hf_compact_ulmap));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_rcid, array_length(hf_rcid));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_harq_control, array_length(hf_harq_control));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_extension_type, array_length(hf_extension_type));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_cdma_allocation, array_length(hf_cdma_allocation));
		proto_register_field_array(proto_wimax_compact_ulmap_ie_decoder, hf_extended_uiuc, array_length(hf_extended_uiuc));
	}
}

/* Compact UL-MAP IE Types (table 90) */
#define COMPACT_UL_MAP_TYPE_NORMAL_SUBCHANNEL	0
#define COMPACT_UL_MAP_TYPE_BAND_AMC		1
#define COMPACT_UL_MAP_TYPE_SAFETY		2
#define COMPACT_UL_MAP_TYPE_UIUC		3
#define COMPACT_UL_MAP_TYPE_HARQ_REGION_IE	4
#define COMPACT_UL_MAP_TYPE_CQICH_REGION_IE	5
#define COMPACT_UL_MAP_TYPE_RESERVED		6
#define COMPACT_UL_MAP_TYPE_EXTENSION		7

/* Compact UL-MAP IE decoder */
guint wimax_compact_ulmap_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset)
{
	guint uiuc, byte, length = 0;
	guint ul_map_type;
	guint harq_region_change_indication;
	guint cqi_region_change_indication;
	guint ul_map_offset, nibble_length;
	guint nband, band_count, i, allocation_mode;

#ifdef DEBUG
	/* update the info column */
	if (check_col(pinfo->cinfo, COL_INFO))
	{
		col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Compact UL-MAP IEs");
	}
#endif
	/* set the local offset */
	ul_map_offset = offset;
	/* Get the first byte */
	byte = tvb_get_guint8(tvb, ul_map_offset);
	/* get the ul-map type */
	if(nibble_offset & 1)
	{
		ul_map_type = ((byte & UL_MAP_TYPE_MASK_1) >> 1);
	}
	else
	{
		ul_map_type = ((byte & UL_MAP_TYPE_MASK) >> 5);
	}
	/* process the Compact UL-MAP IE (table 90) */
	switch (ul_map_type)
	{
		case COMPACT_UL_MAP_TYPE_NORMAL_SUBCHANNEL:/* 6.3.2.3.43.7.1 */
			/* display the UL-MAP type and reserved bit */
			if(nibble_offset & 1)
			{
				proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE);
				/* display the reserved */
				proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE);
				/* move to next byte */
				ul_map_offset++;
				nibble_offset = 0;
			}
			else
			{
				proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE);
				/* display the reserved */
				proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE);
				nibble_offset = 1;
			}
			length = 1;
			/* decode RCID IE */
			nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset);
			length += nibble_length;
			ul_map_offset += (nibble_length >> 1);
			nibble_offset = (nibble_length & 1);
			/* check harq mode */
			if(!harq_mode)
			{	/* display the Nep and Nsch Code */
				if(nibble_offset & 1)
				{
					proto_tree_add_item(tree, hf_culmap_nep_code_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
					proto_tree_add_item(tree, hf_culmap_nsch_code, tvb, ul_map_offset, 1, FALSE);
				}
				else
				{
					proto_tree_add_item(tree, hf_culmap_nep_code, tvb, ul_map_offset, 1, FALSE);
					proto_tree_add_item(tree, hf_culmap_nsch_code_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
				}
				length += 2;
			}
			else if(harq_mode == 1)
			{	/* display the Shortened UIUC and Companded SC */
				if(nibble_offset & 1)
				{
					proto_tree_add_item(tree, hf_culmap_shortened_uiuc_1, tvb, ul_map_offset, 2, FALSE);
					proto_tree_add_item(tree, hf_culmap_companded_sc_1, tvb, ul_map_offset, 2, FALSE);
				}
				else
				{
					proto_tree_add_item(tree, hf_culmap_shortened_uiuc, tvb, ul_map_offset, 1, FALSE);
					proto_tree_add_item(tree, hf_culmap_companded_sc, tvb, ul_map_offset, 1, FALSE);
				}
				/* move to next byte */
				ul_map_offset++;
				length += 2;
			}
			/* decode HARQ Control IE */
			nibble_length = wimax_compact_ulmap_harq_control_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset);
			length += nibble_length;
		break;
		case COMPACT_UL_MAP_TYPE_BAND_AMC:/* 6.3.2.3.43.7.2 */
			/* display the UL-MAP type and reserved bit */
			if(nibble_offset & 1)
			{
				proto_tree_add_item(tree, hf_culmap_ul_map_type_1, tvb, ul_map_offset, 1, FALSE);
				/* display the reserved */
				proto_tree_add_item(tree, hf_culmap_reserved_1, tvb, ul_map_offset, 1, FALSE);
				/* move to next byte */
				ul_map_offset++;
				nibble_offset = 0;
			}
			else
			{
				proto_tree_add_item(tree, hf_culmap_ul_map_type, tvb, ul_map_offset, 1, FALSE);
				/* display the reserved */
				proto_tree_add_item(tree, hf_culmap_reserved, tvb, ul_map_offset, 1, FALSE);
				nibble_offset = 1;
			}
			length = 1;
			/* decode RCID IE */
			nibble_length = wimax_compact_ulmap_rcid_ie_decoder(tree, pinfo, tvb, ul_map_offset, nibble_offset);
			length += nibble_length;
			ul_map_offset += (nibble_length >> 1);
			nibble_offset = (nibble_length & 1);
			/* check harq mode */
			if(!harq_mode)
			{	/* display the Nep and Nsch Code */
				if(nibble_offset & 1)
				{
					proto_tree_add_item(tree, hf_culmap_nep_code_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
					proto_tree_add_item(tree, hf_culmap_nsch_code, tvb, ul_map_offset, 1, FALSE);
				}
				else
				{
					proto_tree_add_item(tree, hf_culmap_nep_code, tvb, ul_map_offset, 1, FALSE);
					proto_tree_add_item(tree, hf_culmap_nsch_code_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
				}
				length += 2;
			}
			else if(harq_mode == 1)
			{	/* display the Shortened UIUC and Companded SC */
				if(nibble_offset & 1)
				{
					proto_tree_add_item(tree, hf_culmap_shortened_uiuc_1, tvb, ul_map_offset, 2, FALSE);
					proto_tree_add_item(tree, hf_culmap_companded_sc_1, tvb, ul_map_offset, 2, FALSE);
				}
				else
				{
					proto_tree_add_item(tree, hf_culmap_shortened_uiuc, tvb, ul_map_offset, 1, FALSE);
					proto_tree_add_item(tree, hf_culmap_companded_sc, tvb, ul_map_offset, 1, FALSE);
				}
				/* move to next byte */
				ul_map_offset++;
				length += 2;
			}
			/* get the Nband */
			if(max_logical_bands)
			{	/* get and display the Nband */
				nband = tvb_get_guint8(tvb, ul_map_offset);
				length++;
				if(nibble_offset & 1)
				{
					nband = (nband & LSB_NIBBLE_MASK);
					/* display the Nband */
					proto_tree_add_item(tree, hf_culmap_num_bands_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
					nibble_offset = 0;
					if(max_logical_bands == 3)
					{
						proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, nband, FALSE);
						length += (nband * 2);
						/* update offset */
						ul_map_offset += nband;
					}
					else
					{
						nibble_offset = (nband & 1);
						proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, ((nband >> 1) + nibble_offset), FALSE);
						length += nband;
						/* update offset */
						ul_map_offset += (nband >> 1);
					}
				}
				else
				{
					nband = ((nband & MSB_NIBBLE_MASK) >> 4);
					/* display the Nband */
					proto_tree_add_item(tree, hf_culmap_num_bands, tvb, ul_map_offset, 1, FALSE);
					nibble_offset = 1;
					if(max_logical_bands == 3)
					{
						proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, (nband + nibble_offset), FALSE);
						length += (nband * 2);
						/* update offset */
						ul_map_offset += nband;
					}
					else
					{
						proto_tree_add_item(tree, hf_culmap_band_index, tvb, ul_map_offset, ((nband >> 1) + nibble_offset), FALSE);
						length += nband;
						/* update offset */
						ul_map_offset += ((nband + nibble_offset) >> 1);
						if(nband & 1)
							nibble_offset = 0;
					}
				}
				band_count = nband;
			}
			else
			{
				nband = 0;
				band_count = 1;
				/* display the Nb-BITMAP */
				if(nibble_offset & 1)
				{
					proto_tree_add_item(tree, hf_culmap_nb_bitmap_1, tvb, ul_map_offset, 1, FALSE);
					/* move to next byte */
					ul_map_offset++;
					nibble_offset = 0;
				}
				else
				{
					proto_tree_add_item(tree, hf_culmap_nb_bitmap, tvb, ul_map_offset, 1, FALSE);
					nibble_offset = 1;
				}
				length++;
			}
			/* Get the Allocation Mode */
			byte = tvb_get_guint8(tvb, ul_map_offset);
			if(nibble_offset & 1)
			{
				allocation_mode = ((byte & ALLOCATION_MODE_MASK_1) >> 2);
				proto_tree_add_item(tree, hf_culmap_allocation_mode_1, tvb, ul_map_offset, 1, FALSE);
				proto_tree_add_item(tree, hf_culmap_allocation_mode_rsvd_1, tvb, ul_map_offset, 1, FALSE);
				nibble_offset = 0;
				ul_map_offset++;
			}
			else
			{
				allocation_mode = ((byte & ALLOCATION_MODE_MASK) >> 6);
				proto_tree_add_item(tree, hf_culmap_allocation_mode, tvb, ul_map_offset, 1, FALSE);
				proto_tree_add_item(tree, hf_culmap_allocation_mode_rsvd, tvb, ul_map_offset, 1, FALSE);
				nibble_offset = 1;
			}
			length++;
			/* Decode Allocation Mode - need to be done */
			if(!allocation_mode)
			{

⌨️ 快捷键说明

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