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

📄 plugins-wimax-wimax_utils.c

📁 Intel的WIMAX代码,主要是mac层code
💻 C
📖 第 1 页 / 共 4 页
字号:
plugins/wimax/wimax_utils.c - Google Code Search这是 Google 取自 
      http://anonsvn.wireshark.org/wireshark/trunk 的 plugins/wimax/wimax_utils.c 
      缓存副本

      Google 和网页作者无关,不对网页的内容负责。



http://anonsvn.wireshark.org/wireshark/trunk/plugins/wimax/
          AUTHORS
COPYING
ChangeLog
Makefile.am
Makefile.common
Makefile.nmake
README.wimax
crc.c
crc.h
crc_data.c
mac_hd_generic_decoder.c
mac_hd_type1_decoder.c
mac_hd_type2_decoder.c
mac_mgmt_msg_decoder.c
moduleinfo.h
moduleinfo.nmake
msg_aas_beam.c
msg_aas_fbck.c
msg_arq.c
msg_clk_cmp.c
msg_dcd.c
msg_dlmap.c
msg_dreg.c
msg_dsa.c
msg_dsc.c
msg_dsd.c
msg_dsx_rvd.c
msg_fpc.c
msg_pkm.c
msg_pmc.c
msg_prc_lt_ctrl.c
msg_reg_req.c
msg_reg_rsp.c
msg_rep.c
msg_res_cmd.c
msg_rng_req.c
msg_rng_rsp.c
msg_sbc.c
msg_ucd.c
msg_ulmap.c
packet-wmx.c
plugin.rc.in
wimax_bits.h
wimax_cdma_code_decoder.c
wimax_compact_dlmap_ie_decoder.c
wimax_compact_ulmap_ie_decoder.c
wimax_fch_decoder.c
wimax_ffb_decoder.c
wimax_hack_decoder.c
wimax_harq_map_decoder.c
wimax_mac.h
wimax_pdu_decoder.c
wimax_phy_attributes_decoder.c
wimax_tlv.c
wimax_tlv.h
wimax_utils.c
wimax_utils.h
    f_sfe_sdu_inter_arrival_interval, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_sdu_inter_arrival_interval, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_TIME_BASE:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_time_base, tvb, offset, tlv_len, FALSE);
				tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_time_base, tvb, offset, tlv_len, FALSE);
				proto_item_append_text(tlv_item, " ms");
			break;
			case SFE_PAGING_PREFERENCE:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_paging_preference, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_paging_preference, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_MBS_ZONE_IDENTIFIER_ASSIGNMENT:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_mbs_zone_identifier_assignment, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_mbs_zone_identifier_assignment, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_RESERVED_34:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_reserved_34, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_reserved_34, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_GLOBAL_SERVICE_CLASS_NAME:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_global_service_class_name, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_global_service_class_name, tvb, offset, tlv_len, FALSE);
			break;
/* 36 reserved */
			case SFE_RESERVED_36:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_reserved_36, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_reserved_36, tvb, offset, tlv_len, FALSE);
			break;

			case SFE_SN_FEEDBACK_ENABLED:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_sn_feedback_enabled, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_sn_feedback_enabled, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_FSN_SIZE:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_fsn_size, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_fsn_size, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_CID_ALLOCATION_FOR_ACTIVE_BS:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_cid_alloc_for_active_bs_cid, tvb, offset, tlv_len, FALSE);
				for(i = 0; i < tlv_len; i+=2)
					proto_tree_add_item(tlv_tree, hf_sfe_cid_alloc_for_active_bs_cid, tvb, (offset+i), 2, FALSE);
			break;
			case SFE_UNSOLICITED_GRANT_INTERVAL:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unsolicited_grant_interval, tvb, offset, tlv_len, FALSE);
				tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_unsolicited_grant_interval, tvb, offset, tlv_len, FALSE);
				proto_item_append_text(tlv_item, " ms");
			break;
			case SFE_UNSOLOCITED_POLLING_INTERVAL:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unsolicited_polling_interval, tvb, offset, tlv_len, FALSE);
				tlv_item = proto_tree_add_item(tlv_tree, hf_sfe_unsolicited_polling_interval, tvb, offset, tlv_len, FALSE);
				proto_item_append_text(tlv_item, " ms");
			break;
			case SFE_PDU_SN_EXT_SUBHEADER_HARQ_REORDER:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_pdu_sn_ext_subheader_reorder, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_pdu_sn_ext_subheader_reorder, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_MBS_CONTENTS_ID:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_mbs_contents_ids, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_mbs_contents_ids, tvb, offset, tlv_len, FALSE);
				for(i = 0; i < tlv_len; i+=2)
					proto_tree_add_item(tlv_tree, hf_sfe_mbs_contents_ids_id, tvb, (offset+i), 2, FALSE);
			break;
			case SFE_HARQ_SERVICE_FLOWS:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_harq_service_flows, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_harq_service_flows, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_AUTHORIZATION_TOKEN:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_authorization_token, tvb, offset, tlv_len, FALSE);
				proto_tree_add_item(tlv_tree, hf_sfe_authorization_token, tvb, offset, tlv_len, FALSE);
			break;
			case SFE_HARQ_CHANNEL_MAPPING:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_harq_channel_mapping_index, tvb, offset, tlv_len, FALSE);
				for(i = 0; i < tlv_len; i++)
					proto_tree_add_item(tlv_tree, hf_sfe_harq_channel_mapping_index, tvb, (offset+i), 1, FALSE);
			break;
/* 99 - 111 CS parameter encodings */
			case SFE_CSPER_ATM:
			case SFE_CSPER_PACKET_IPV4:
			case SFE_CSPER_PACKET_IPV6:
			case SFE_CSPER_PACKET_802_3:
			case SFE_CSPER_PACKET_802_1Q:
			case SFE_CSPER_PACKET_IPV4_802_3:
			case SFE_CSPER_PACKET_IPV6_802_3:
			case SFE_CSPER_PACKET_IPV4_802_1Q:
			case SFE_CSPER_PACKET_IPV6_802_1Q:
			case SFE_CSPER_PACKET_IP_ROCH_COMPRESSION:
			case SFE_CSPER_PACKET_IP_ECRTP_COMPRESSION:
			case SFE_CSPER_PACKET_IP_802_3_ROCH_COMPRESSION:
			case SFE_CSPER_PACKET_IP_802_3_ECRTP_COMPRESSION:
				/* call CS Parameter Encoding Rules handling function */
				tlv_tree = add_protocol_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, proto_wimax_utility_decoders, tvb, offset, tlv_len, "CS Parameter Encoding Rules (%u byte(s))", tlv_len);
				wimax_convengence_service_parameter_encoding_rules_decoder(tlv_type, tvb_new_subset(tvb, offset, tlv_len, tlv_len), pinfo, tlv_tree);
			break;
			default:
				tlv_tree = add_tlv_subtree(&tlv_info, ett_wimax_service_flow_encodings, tree, hf_sfe_unknown_type, tvb, offset, tlv_len, FALSE);
				/* display the unknown sfe type in hex */
				proto_tree_add_item(tlv_tree, hf_sfe_unknown_type, tvb, offset, tlv_len, FALSE);
			break;
		}	/* end of switch */
		offset += tlv_len;
        }	/* end of while loop */
}

/**************************************************************/
/* wimax_hmac_tuple_decoder()                                 */
/* decode and display the WiMax HMAC Tuple (Table 348)        */
/* parameter:                                                 */
/*   tree - pointer of Wireshark display tree                 */
/*   tvb - pointer of the tvb which contains the HMAC Tuple   */
/*   offset - the HMAC Tuple offset in the tvb                */
/*   length - length of the HMAC Tuple                        */
/**************************************************************/
void wimax_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
{
	guint hmac_offset;
	proto_item *hmac_item = NULL;
	proto_tree *hmac_tree = NULL;

	/* display decoder info (length should be 21 bytes) */
	hmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "HMAC Tuple (%u bytes)", length);
	/* add HMAC subtree */
	hmac_tree = proto_item_add_subtree(hmac_item, ett_wimax_hmac_tuple);
	/* init the local offset */
	hmac_offset = offset;
	/* decode and display HMAC Tuple */
	proto_tree_add_item(hmac_tree, hf_xmac_tuple_rsvd, tvb, hmac_offset, 1, FALSE);
	proto_tree_add_item(hmac_tree, hf_xmac_tuple_key_seq_num, tvb, hmac_offset, 1, FALSE);
	hmac_offset++;
	proto_tree_add_item(hmac_tree, hf_hmac_tuple_hmac_digest, tvb, hmac_offset, (length-1), FALSE);
}

/**************************************************************/
/* wimax_cmac_tuple_decoder()                                 */
/* decode and display the WiMax CMAC Tuple (Table 348b)       */
/* parameter:                                                 */
/*   tree - pointer of Wireshark display tree                 */
/*   tvb - pointer of the tvb which contains the CMAC Tuple   */
/*   offset - the CMAC Tuple offset in the tvb                */
/*   length - length of the CMAC Tuple                        */
/**************************************************************/
void wimax_cmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
{
	guint cmac_offset;
	proto_item *cmac_item = NULL;
	proto_tree *cmac_tree = NULL;

	/* display decoder info (length should be 13 or 19 bytes) */
	cmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "CMAC Tuple (%u bytes)", length);
	/* add CMAC subtree */
	cmac_tree = proto_item_add_subtree(cmac_item, ett_wimax_cmac_tuple);
	/* init the local offset */
	cmac_offset = offset;
	/* decode and display CMAC Tuple */
	proto_tree_add_item(cmac_tree, hf_xmac_tuple_rsvd, tvb, cmac_offset, 1, FALSE);
	proto_tree_add_item(cmac_tree, hf_xmac_tuple_key_seq_num, tvb, cmac_offset, 1, FALSE);
	cmac_offset++;
	if(length > 13)
	{
		proto_tree_add_item(cmac_tree, hf_cmac_tuple_bsid, tvb, cmac_offset, 6, FALSE);
		cmac_offset += 6;
	}
	proto_tree_add_item(cmac_tree, hf_packet_number_counter, tvb, cmac_offset, 4, FALSE);
	cmac_offset += 4;
	proto_tree_add_item(cmac_tree, hf_cmac_tuple_cmac_value, tvb, cmac_offset, 8, FALSE);
}

/******************************************************************/
/* wimax_short_hmac_tuple_decoder()                               */
/* decode and display the WiMax Short-HMAC Tuple (Table 348d)     */
/* parameter:                                                     */
/*   tree - pointer of Wireshark display tree                     */
/*   tvb - pointer of the tvb which contains the Short-HMAC Tuple */
/*   offset - the Short-HMAC Tuple offset in the tvb              */
/*   length - length of the Short-HMAC Tuple                      */
/******************************************************************/
void wimax_short_hmac_tuple_decoder(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
{
	guint hmac_offset;
	proto_item *hmac_item = NULL;
	proto_tree *hmac_tree = NULL;

	/* display decoder info (length should be at least 13 bytes ???) */
	hmac_item = proto_tree_add_protocol_format(tree, proto_wimax_utility_decoders, tvb, offset, length, "Short-HMAC Tuple (%u bytes)", length);
	/* add Short-HMAC subtree */
	hmac_tree = proto_item_add_subtree(hmac_item, ett_wimax_short_hmac_tuple);
	/* init the local offset */
	hmac_offset = offset;
	/* decode and display Short-HMAC Tuple */
	proto_tree_add_item(hmac_tree, hf_xmac_tuple_rsvd, tvb, hmac_offset, 1, FALSE);
	proto_tree_add_item(hmac_tree, hf_xmac_tuple_key_seq_num, tvb, hmac_offset, 1, FALSE);
	hmac_offset++;
	proto_tree_add_item(hmac_tree, hf_packet_number_counter, tvb, hmac_offset, 4, FALSE);
	hmac_offset += 4;
	proto_tree_add_item(hmac_tree, hf_hmac_tuple_hmac_digest, tvb, hmac_offset, length - offset - 3, FALSE);
}

/******************************************************************/
/* wimax_security_negotiation_parameters_decoder()                */
/* decode and display the WiMax Security Negotiation Parameters   */
/* parameter:                                                     */
/*   tvb - pointer of the tvb of service flow encodings           */
/*   tree - pointer of Wireshark display tree                     */
/*   pinfo - pointer of Wireshark packet information structure    */
/******************************************************************/
void wimax_security_negotiation_parameters_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint offset;
	guint tvb_len, tlv_len, tlv_value_offset;
	gint  tlv_type;
	proto_tree *tlv_tree = NULL;
	tlv_info_t tlv_info;

	/* get the tvb reported length */
	tvb_len = tvb_reported_length(tvb);
	/* do nothing if the TLV fields is not exist */
	if(!tvb_len)
		return;
	/* report error if the packet size is less than 2 bytes (type+length) */
	if(tvb_len < 2)
	{	/* invalid tlv info */
		if(pinfo->cinfo)
		{
			col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid Security Negotiation Parameters");
		}
		return;
	}
	/* process Security Negotiation Parameter TLVs */
	for(offset = 0; 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, "Security Negotiation Params TLV error");
			}
			proto_tree_add_item(tree, hf_cst_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
			break;
		}

⌨️ 快捷键说明

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