コード例 #1
0
ファイル: msg_pkm.c プロジェクト: hashbrowncipher/wireshark
/* Wimax Mac PKM-REQ Message Dissector */
static void dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint offset = 0;
	proto_item *pkm_item;
	proto_tree *pkm_tree;

	/* display MAC payload type PKM-REQ */
	pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, -1, "Privacy Key Management Request (PKM-REQ)");
	/* add MAC PKM subtree */
	pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_req_decoder);
	/* Decode and display the Privacy Key Management Request Message (PKM-REQ) (table 24) */
	/* display the PKM Code */
	proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, ENC_BIG_ENDIAN);
	/* set the offset for the PKM ID */
	offset++;
	/* display the PKM ID */
	proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, ENC_BIG_ENDIAN);
	/* set the offset for the TLV Encoded info */
	offset++;
	wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, pkm_tree);
}
コード例 #2
0
/* Wimax Mac PKM-REQ Message Dissector */
void dissect_mac_mgmt_msg_pkm_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint offset = 0;
	guint tvb_len, payload_type, length;
	proto_item *pkm_item = NULL;
	proto_tree *pkm_tree = NULL;

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

	{	/* we are being asked for details */
		/* Get the tvb reported length */
		tvb_len =  tvb_reported_length(tvb);
		/* display MAC payload type PKM-REQ */
		pkm_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_pkm_decoder, tvb, offset, tvb_len, "Privacy Key Management Request (PKM-REQ) (%u bytes)", tvb_len);
		/* add MAC PKM subtree */
		pkm_tree = proto_item_add_subtree(pkm_item, ett_mac_mgmt_msg_pkm_req_decoder);
		/* Decode and display the Privacy Key Management Request Message (PKM-REQ) (table 24) */
		/* display the Message Type */
		proto_tree_add_item(pkm_tree, hf_pkm_req_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
		/* set the offset for the PKM Code */
		offset++;
		/* display the PKM Code */
		proto_tree_add_item(pkm_tree, hf_pkm_msg_code, tvb, offset, 1, ENC_BIG_ENDIAN);
		/* set the offset for the PKM ID */
		offset++;
		/* display the PKM ID */
		proto_tree_add_item(pkm_tree, hf_pkm_msg_pkm_id, tvb, offset, 1, ENC_BIG_ENDIAN);
		/* set the offset for the TLV Encoded info */
		offset++;
		/* process the PKM TLV Encoded Attributes */
		length = tvb_len - offset;
		wimax_pkm_tlv_encoded_attributes_decoder(tvb_new_subset(tvb, offset, length, length), pinfo, pkm_tree);
	}
}