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

📄 plugins-wimax-msg_ucd.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 4 页
字号:
		{
			"Unknown UCD Type", "wimax.ucd.unknown_tlv_type",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types,
		{
			"Uplink Burst Profile for Multiple FEC Types", "wimax.ucd.uplink_burst_profile.multiple_fec_types",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation,
		{
			"Uplink PUSC Subchannel Rotation", "wimax.ucd.uplink_burst_profile.ul_pusc_subchannel_rotation",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst,
		{
			"Relative Power Offset UL HARQ Burst", "wimax.ucd.uplink_burst_profile.relative_power_offset_ul_harq_burst",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg,
		{
			"Relative Power Offset UL Burst Containing MAC Mgmt Msg", "wimax.ucd.uplink_burst_profile.relative_power_offset_ul_burst_mac_mgmt_msg",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_207_ul_initial_transmit_timing,
		{
			"UL Initial Transmit Timing", "wimax.ucd.uplink_burst_profile.ul_initial_transmit_timing",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_210_fast_feedback_region,
		{
			"Fast Feedback Region", "wimax.ucd.uplink_burst_profile.fast_feedback_region",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_211_harq_ack_region,
		{
			"HARQ ACK Region", "wimax.ucd.uplink_burst_profile.harq_ack_region",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_212_ranging_region,
		{
			"Ranging Region", "wimax.ucd.uplink_burst_profile.ranging_region",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_213_sounding_region,
		{
			"Sounding Region", "wimax.ucd.uplink_burst_profile.sounding_region",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_186_upper_bound_aas_preamble,
		{
			"Upper Bound AAS Preamble (in units of 0.25 dB)", "wimax.ucd.upper_bound_aas_preamble",
			FT_INT8, BASE_DEC, NULL, 0, "", HFILL
		}
	},
	{
		&hf_ucd_tlv_t_189_use_cqich_indication_flag,
		{
			"Use CQICH Indication Flag", "wimax.ucd.use_cqich_indication_flag",
			FT_UINT8, BASE_HEX, NULL, 0, "", HFILL
		}
	}
};

/* Register Wimax Mac Payload Protocol and Dissector */
void proto_register_mac_mgmt_msg_ucd(void)
{
	if (proto_mac_mgmt_msg_ucd_decoder == -1)
	{
		proto_mac_mgmt_msg_ucd_decoder = proto_mac_mgmt_msg_dcd_decoder;

		proto_register_field_array(proto_mac_mgmt_msg_ucd_decoder, hf, array_length(hf));
		proto_register_subtree_array(ett, array_length(ett));
	}
}

/* UCD dissector */
void dissect_mac_mgmt_msg_ucd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint offset = 0;
	guint tvb_len, payload_type, length;
	guint ucd_config_change_count;
	guint ucd_ranging_backoff_start;
	guint ucd_ranging_backoff_end;
	guint ucd_request_backoff_start;
	guint ucd_request_backoff_end;
	gint  tlv_type, tlv_len, tlv_offset, tlv_value_offset;
	guint ul_burst_uiuc, utemp;
	proto_item *ucd_item = NULL;
	proto_tree *ucd_tree = NULL;
	proto_item *tlv_item = NULL;
	proto_tree *tlv_tree = NULL;
	proto_tree *sub_tree = NULL;
	tlv_info_t tlv_info;

	/* Ensure the right payload type */
	payload_type = tvb_get_guint8(tvb, offset);
	if(payload_type != MAC_MGMT_MSG_UCD)
	{
		return;
	}

	if(tree)
	{	/* we are being asked for details */
		/* Get the tvb reported length */
		tvb_len =  tvb_reported_length(tvb);
		/* display MAC payload type UCD */
		ucd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tvb_len, "Uplink Channel Descriptor (UCD) (%u bytes)", tvb_len);
		/* add MAC UCD subtree */
		ucd_tree = proto_item_add_subtree(ucd_item, ett_mac_mgmt_msg_ucd_decoder);
		/* Decode and display the Uplink Channel Descriptor (UCD) */
		/* display the Message Type */
		proto_tree_add_item(ucd_tree, hf_ucd_message_type, tvb, offset, 1, FALSE);
		/* move to next field */
		offset++;
		/* get the Configuration Change Count */
		ucd_config_change_count = tvb_get_guint8(tvb, offset);
		/* display the Configuration Change Count */
		proto_tree_add_text(ucd_tree, tvb, offset, 1, "Configuration Change Count: %u", ucd_config_change_count);
		/* move to next field */
		offset++;
		/* get the ranging backoff start */
		ucd_ranging_backoff_start = tvb_get_guint8(tvb, offset);
		/* display the ranging backoff start */
		proto_tree_add_text(ucd_tree, tvb, offset, 1, "Ranging Backoff Start: 2^%u = %u", ucd_ranging_backoff_start, (1 << ucd_ranging_backoff_start));
		/* move to next field */
		offset++;
		/* get the ranging backoff end */
		ucd_ranging_backoff_end = tvb_get_guint8(tvb, offset);
		/* display the ranging backoff end */
		proto_tree_add_text(ucd_tree, tvb, offset, 1, "Ranging Backoff End: 2^%u = %u", ucd_ranging_backoff_end, (1 << ucd_ranging_backoff_end));
		/* move to next field */
		offset++;
		/* get the request backoff start */
		ucd_request_backoff_start = tvb_get_guint8(tvb, offset);
		/* display the request backoff start */
		proto_tree_add_text(ucd_tree, tvb, offset, 1, "Request Backoff Start: 2^%u = %u", ucd_request_backoff_start, (1 << ucd_request_backoff_start));
		/* move to next field */
		offset++;
		/* get the request backoff end */
		ucd_request_backoff_end = tvb_get_guint8(tvb, offset);
		/* display the request backoff end */
		proto_tree_add_text(ucd_tree, tvb, offset, 1, "Request Backoff End: 2^%u = %u", ucd_request_backoff_end, (1 << ucd_request_backoff_end));
		/* move to next field */
		offset++;
		while(offset < tvb_len)
		{
			/* get the TLV information */
			init_tlv_info(&tlv_info, tvb, offset);
			/* get the TLV type */
			tlv_type = get_tlv_type(&tlv_info);
			/* get the TLV length */
			tlv_len = get_tlv_length(&tlv_info);
			if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
			{	/* invalid tlv info */
				if(pinfo->cinfo)
				{
					col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "UCD TLV error");
				}
				proto_tree_add_item(ucd_tree,hf_ucd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
				break;
			}
			/* get the TLV value offset */
			tlv_value_offset = get_tlv_value_offset(&tlv_info);
#ifdef DEBUG /* for debug only */
			tlv_item = proto_tree_add_protocol_format(ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "UCD Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len);
#endif
			/* update the offset */
			offset += tlv_value_offset;
			/* process UCD TLV Encoded information */
			if (include_cor2_changes)
			{
				switch (tlv_type)
				{
					case UCD_TLV_T_203_UL_PUSC_SUBCHANNEL_ROTATION:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_205_RELATIVE_POWER_OFFSET_UL_HARQ_BURST:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_206_RELATIVE_POWER_OFFSET_UL_BURST_CONTAINING_MAC_MGMT_MSG:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_207_UL_INITIAL_TRANSMIT_TIMING:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_207_ul_initial_transmit_timing, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_207_ul_initial_transmit_timing, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_210_FAST_FEEDBACK_REGION:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_210_fast_feedback_region, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_210_fast_feedback_region, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_211_HARQ_ACK_REGION:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_211_harq_ack_region, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_211_harq_ack_region, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_212_RANGING_REGION:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_212_ranging_region, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_212_ranging_region, tvb, offset, tlv_len, FALSE);
						break;
					}
					case UCD_TLV_T_213_SOUNDING_REGION:
					{
						tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_tlv_t_213_sounding_region, tvb, offset, tlv_len, FALSE);
						tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_tlv_t_213_sounding_region, tvb, offset, tlv_len, FALSE);
						break;
					}
				}
			}
			switch (tlv_type)
			{
				case UCD_UPLINK_BURST_PROFILE:
				{
					/* get the UIUC */
					ul_burst_uiuc = tvb_get_guint8(tvb, offset) & 0x0F;
					/* add TLV subtree */
					tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, proto_mac_mgmt_msg_ucd_decoder, tvb, offset, tlv_len, "Uplink Burst Profile (UIUC = %u) (%u bytes)", ul_burst_uiuc, tlv_len);
					proto_tree_add_item(tlv_tree, hf_ucd_ul_burst_reserved, tvb, offset, 1, FALSE);
					proto_tree_add_item(tlv_tree, hf_ucd_ul_burst_uiuc, tvb, offset, 1, FALSE);
					for (tlv_offset = 1; tlv_offset < tlv_len;)
					{	/* get the TLV information */
						init_tlv_info(&tlv_info, tvb, (offset+tlv_offset));
						/* get the TLV type */
						tlv_type = get_tlv_type(&tlv_info);
						if(tlv_type == -1)
						{	/* invalid tlv info */
							if(pinfo->cinfo)
							{
								col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "UL Burst Profile error");
							}
							proto_tree_add_item(tlv_tree, hf_ucd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE);
							break;
						}
						/* get the TLV length */
						length = get_tlv_length(&tlv_info);
						/* update the offset */
						tlv_offset += get_tlv_value_offset(&tlv_info);
						switch (tlv_type)
						{
							case UCD_BURST_FEC:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE);
								tlv_item = proto_tree_add_item(sub_tree, hf_ucd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE);
								break;
							}
							case UCD_BURST_RANGING_DATA_RATIO:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), 1, FALSE);
								tlv_item = proto_tree_add_item(sub_tree, hf_ucd_burst_ranging_data_ratio, tvb, (offset+tlv_offset), 1, FALSE);
								proto_item_append_text(tlv_item, " dB");
								break;
							}
#if 0 /* for OFDM */
							case UCD_BURST_POWER_BOOST:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), 1, FALSE);
								tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_burst_power_boost, tvb, (offset+tlv_offset), length, FALSE);
								proto_item_append_text(tlv_item, " dB");
								break;
							}
							case UCD_BURST_TCS_ENABLE:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, tlv_tree, hf_ucd_burst_tcs_enable, tvb, (offset+tlv_offset), 1, FALSE);
								proto_tree_add_item(tlv_tree, hf_ucd_burst_tcs_enable, tvb, (offset+tlv_offset), 1, FALSE);
								break;
							}
#endif
							default:
								/* ??? */
								break;
						}
						tlv_offset += length;
					}
					break;
				}
				case UCD_RESERVATION_TIMEOUT:
				{
					tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_res_timeout, tvb, offset, tlv_len, FALSE);
					proto_tree_add_item(tlv_tree, hf_ucd_res_timeout, tvb, offset, tlv_len, FALSE);
					break;
				}
				case UCD_BW_REQ_SIZE:
				{
					tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_ucd_decoder, ucd_tree, hf_ucd_bw_req_size, tvb, offset, tlv_len, FALSE);
					tlv_item = proto_tree_add_item(tlv_tree, hf_ucd_bw_req_size, tvb, offset, tlv_len, FALSE);
					proto_item_append_text(tlv_item, " PS");
					break;
				}

⌨️ 快捷键说明

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