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

📄 plugins-wimax-msg_dcd.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 4 页
字号:
        {
		&hf_dcd_tlv_t_50_ho_type_support,
		{
			"HO Type Support", "wimax.dcd.ho_type_support",
			FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_50_ho_type_support_fbss_ho,
		{
			"FBSS HO", "wimax.dcd.ho_type_support.fbss_ho",
			FT_UINT8, BASE_HEX, VALS(tfs_support), 0x20, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_50_ho_type_support_ho,
		{
			"HO", "wimax.dcd.ho_type_support.ho",
			FT_UINT8, BASE_HEX, VALS(tfs_support), 0x80, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_50_ho_type_support_mdho,
		{
			"MDHO", "wimax.dcd.ho_type_support.mdho",
			FT_UINT8, BASE_HEX, VALS(tfs_support), 0x40, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_50_ho_type_support_reserved,
		{
			"Reserved", "wimax.dcd.ho_type_support.reserved",
			FT_UINT8, BASE_HEX, NULL, 0x1f, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_51_hysteresis_margin,
		{
			"Hysteresis Margin", "wimax.dcd.hysteresis_margin",
			FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
		}
	},
	{
		&hf_dcd_invalid_tlv,
		{
			"Invalid TLV", "wimax.dcd.invalid_tlv",
			FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
		}
	},
	{
		&hf_dcd_mac_version,
		{
			"MAC Version", "wimax.dcd.mac_version",
			FT_UINT8, BASE_DEC, VALS(vals_dcd_mac_version), 0x00, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_20_maximum_retransmission,
		{
			"Maximum Retransmission", "wimax.dcd.maximum_retransmission",
			FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_60_noise_interference,
		{
			"Noise and Interference", "wimax.dcd.noise_interference",
			FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_35_paging_group_id,
		{
			"Paging Group ID", "wimax.dcd.paging_group_id",
			FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL
		}
	},
	{
		&hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap,
		{
			"TUSC1 permutation active subchannels bitmap", "wimax.dcd.tusc1",
			FT_UINT16, BASE_HEX, NULL, 0xFF80, "", HFILL
		}
	},
	{
		&hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap,
		{
			"TUSC2 permutation active subchannels bitmap", "wimax.dcd.tusc2",
			FT_UINT16, BASE_HEX, NULL, 0xFFF8, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_45_paging_interval_length,
		{
			"Paging Interval Length", "wimax.dcd.paging_interval_length",
			FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone,
		{
			"Permutation Type for Broadcast Region in HARQ Zone", "wimax.dcd.permutation_type_broadcast_region_in_harq_zone",
			FT_UINT8, BASE_DEC, VALS(vals_dcd_permutation_type), 0x00, "", HFILL
		}
	},
	{
		&hf_dcd_phy_type,
		{
			"PHY Type", "wimax.dcd.phy_type",
			FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL
		}
	},
	{
		&hf_dcd_power_adjustment,
		{
			"Power Adjustment Rule", "wimax.dcd.power_adjustment",
			FT_UINT8, BASE_HEX, VALS(vals_dcd_power_adjustmnt), 0x00, "", HFILL
		}
	},
#ifdef WIMAX_16D_2004
	{
		&hf_dcd_rss,
		{
			"RSS (IR, max)", "wimax.dcd.rss",
			FT_INT16, BASE_DEC, NULL, 0x00, "", HFILL
		}
	},
#endif
	{
		&hf_dcd_rtg,
		{
			"RTG", "wimax.dcd.rtg",
			FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL
		}
	},
#ifdef WIMAX_16D_2004
	{
		&hf_dcd_size_cqich_id,
		{
			"Size of CQICH-ID Field", "wimax.dcd.size_cqich_id",
			FT_UINT8, BASE_DEC, VALS(vals_dcd_size_of_cqich_id), 0x00, "", HFILL
		}
	},
#endif
	{
		&hf_dcd_channel_switch_frame_nr,
		{
			"Channel Switch Frame Number", "wimax.dcd.switch_frame",
			FT_UINT24, BASE_DEC, NULL, 0x00, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_52_time_to_trigger_duration,
		{
			"Time to Trigger Duration", "wimax.dcd.time_trigger_duration",
			FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_543_trigger_averaging_duration,
		{
			"Trigger Averaging Duration", "wimax.dcd.trigger_averaging_duration",
			FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_542_trigger_value,
		{
			"Trigger Value", "wimax.dcd.trigger_value",
			FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
		}
	},
	{
		&hf_dcd_ttg,
		{
			"TTG", "wimax.dcd.ttg",
			FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_541_type_function_action,
		{
			"Type/Function/Action", "wimax.dcd.type_function_action",
			FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_541_action,
		{
			"Action", "wimax.dcd.type_function_action.action",
			FT_UINT8, BASE_HEX, VALS(vals_dcd_action), 0x7, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_541_function,
		{
			"Function", "wimax.dcd.type_function_action.function",
			FT_UINT8, BASE_HEX, VALS(vals_dcd_function), 0x38, "", HFILL
		}
	},
        {
		&hf_dcd_tlv_t_541_type,
		{
			"Type", "wimax.dcd.type_function_action.type",
			FT_UINT8, BASE_HEX, VALS(vals_dcd_type), 0xC0, "", HFILL
		}
	},
	{
		&hf_dcd_unknown_type,
		{
			"Unknown DCD Type", "wimax.dcd.unknown_tlv_value",
			FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL
		}
	}
};

/* Register Wimax Mac Payload Protocol and Dissector */
void proto_register_mac_mgmt_msg_dcd(void)
{
	if (proto_mac_mgmt_msg_dcd_decoder == -1)
	{
		proto_mac_mgmt_msg_dcd_decoder = proto_register_protocol (
							"WiMax DCD/UCD Messages", /* name */
							"WiMax DCD/UCD (cd)", /* short name */
							"cd" /* abbrev */
							);

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

/* WiMax MAC Management DCD message (table 15) dissector */
void dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint offset = 0;
	guint tvb_len, payload_type, length;
	guint configChangeCount;
	gint  tlv_type, tlv_len, tlv_offset, tlv_value_offset;
	guint dl_burst_diuc, dl_num_regions;
	proto_item *dcd_item = NULL;
	proto_tree *dcd_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_DCD)
	{
		return;
	}

	if(tree)
	{	/* we are being asked for details */
		/* Get the tvb reported length */
		tvb_len =  tvb_reported_length(tvb);
		/* display MAC payload type DCD */
		dcd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tvb_len, "Downlink Channel Descriptor (DCD) (%u bytes)", tvb_len);
		/* add MAC DCD subtree */
		dcd_tree = proto_item_add_subtree(dcd_item, ett_mac_mgmt_msg_dcd_decoder);
		/* Decode and display the Downlink Channel Descriptor (DCD) */
		/* display the Message Type */
		proto_tree_add_item(dcd_tree, hf_dcd_message_type, tvb, offset, 1, FALSE);
		/* set the offset for the Downlink Channel ID */
		offset++;
		/* display the Downlink Channel ID */
		proto_tree_add_item(dcd_tree, hf_dcd_downlink_channel_id, tvb, offset, 1, FALSE);
		/* set the offset for the Configuration Change Count */
		offset++;
		/* get the Configuration Change Count */
		configChangeCount = tvb_get_guint8(tvb, offset);
		/* display the Configuration Change Count */
		proto_tree_add_item(dcd_tree, hf_dcd_config_change_count, tvb, offset, 1, FALSE);
		/* set the offset for the TLV Encoded info */
		offset++;
		/* process the DCD TLV Encoded information (table 358) */
		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, "DCD TLV error");
				}
				proto_tree_add_item(dcd_tree, hf_dcd_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(dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "DCD 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 DCD TLVs */
			switch (tlv_type)
			{
				case DCD_DOWNLINK_BURST_PROFILE:
				{	/* Downlink Burst Profile TLV (table 363)*/
					/* get the DIUC */
					dl_burst_diuc = (tvb_get_guint8(tvb, offset) & 0x0F);
					/* display TLV info */
					/* add TLV subtree */
					tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tlv_len, "Downlink_Burst_Profile (DIUC=%u) (%u bytes)", (dl_burst_diuc+1), tlv_len);
					/* detail display */
					proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_rsv, tvb, offset, 1, FALSE);
					proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_diuc, tvb, offset, 1, FALSE);
					/* process subTLVs */
					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);
						/* get the TLV length */
						length = get_tlv_length(&tlv_info);
						if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1)
						{	/* invalid tlv info */
							if(pinfo->cinfo)
							{
								col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DL Burst Profile TLV error");
							}
							proto_tree_add_item(tlv_tree, hf_dcd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), FALSE);
							break;
						}
						/* update the offset */
						tlv_offset += get_tlv_value_offset(&tlv_info);
						switch (tlv_type)
						{
							case DCD_BURST_FREQUENCY:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), 1, FALSE);
								tlv_item = proto_tree_add_item(sub_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), 1, FALSE);
								proto_item_append_text(tlv_item, " kHz");
								break;
							}
							case DCD_BURST_FEC_CODE_TYPE:
							{
								sub_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, tlv_tree, hf_dcd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE);
								proto_tree_add_item(sub_tree, hf_dcd_burst_fec, tvb, (offset+tlv_offset), 1, FALSE);
								break;
							}

⌨️ 快捷键说明

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