eapol/eapol_framework/eapol_common/core/eapol_message_wlan_authentication.cpp
changeset 26 9abfd4f00d37
parent 2 1c7bc153c08e
child 36 c98682f98478
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 46.1.2 %
    19 * %version: 60 %
    20 */
    20 */
    21 
    21 
    22 // This is enumeration of EAPOL source code.
    22 // This is enumeration of EAPOL source code.
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    24 	#undef EAP_FILE_NUMBER_ENUM
    24 	#undef EAP_FILE_NUMBER_ENUM
    80 	, m_wlan_database_reference(tools)
    80 	, m_wlan_database_reference(tools)
    81 	, m_header_offset(0ul)
    81 	, m_header_offset(0ul)
    82 	, m_MTU(0ul)
    82 	, m_MTU(0ul)
    83 	, m_trailer_length(0ul)
    83 	, m_trailer_length(0ul)
    84 	, m_error_code(wlan_eap_if_send_status_ok)
    84 	, m_error_code(wlan_eap_if_send_status_ok)
    85 	, m_error_function(eapol_tlv_message_type_function_none)
    85 	, m_error_function(eap_tlv_message_type_function_none)
    86 	, m_use_asyncronous_test(false)
    86 	, m_use_asyncronous_test(false)
    87 	, m_is_valid(true)
    87 	, m_is_valid(true)
    88 {
    88 {
    89 }
    89 }
    90 
    90 
   107 
   107 
   108 	// eapol_wlan_authentication_c object uses the tools object.
   108 	// eapol_wlan_authentication_c object uses the tools object.
   109 	m_wauth = eapol_wlan_authentication_c::new_eapol_wlan_authentication(
   109 	m_wauth = eapol_wlan_authentication_c::new_eapol_wlan_authentication(
   110 		m_am_tools,
   110 		m_am_tools,
   111 		this,
   111 		this,
   112 		true,
   112 		true);
   113 		this);
       
   114 	if (m_wauth != 0
   113 	if (m_wauth != 0
   115 		&& m_wauth->get_is_valid() == true)
   114 		&& m_wauth->get_is_valid() == true)
   116 	{
   115 	{
   117 		status = m_wauth->configure();
   116 		status = m_wauth->configure();
   118 		if (status != eap_status_ok)
   117 		if (status != eap_status_ok)
   181 {
   180 {
   182 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   181 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   183 	
   182 	
   184 	EAP_TRACE_DEBUG(
   183 	EAP_TRACE_DEBUG(
   185 		m_am_tools, 
   184 		m_am_tools, 
   186 		TRACE_FLAGS_DEFAULT, 
   185 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   187 		(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired")
   186 		(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired")
   188 		 EAPL("(id 0x%02x, data 0x%08x).\n"),
   187 		 EAPL("(id 0x%02x, data 0x%08x).\n"),
   189 		 this, id, data));
   188 		 this, id, data));
   190 	
   189 	
   191 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
   190 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
   192 
   191 
   193 	if (id == EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID)
   192 	if (id == EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID)
   194 	{
   193 	{
   195 		EAP_TRACE_DEBUG(
   194 		EAP_TRACE_DEBUG(
   196 			m_am_tools, 
   195 			m_am_tools, 
   197 			TRACE_FLAGS_DEFAULT, 
   196 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
   198 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID")
   197 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID")
   199 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   198 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   200 			 this, id, data));
   199 			 this, id, data));
   201 	
   200 	
   202 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   201 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   209 	}
   208 	}
   210 	else if (id == EAPOL_MESSAGE_TIMER_SEND_DATA_ID)
   209 	else if (id == EAPOL_MESSAGE_TIMER_SEND_DATA_ID)
   211 	{
   210 	{
   212 		EAP_TRACE_DEBUG(
   211 		EAP_TRACE_DEBUG(
   213 			m_am_tools, 
   212 			m_am_tools, 
   214 			TRACE_FLAGS_DEFAULT, 
   213 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
   215 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_SEND_DATA_ID")
   214 			(EAPL("TIMER: [0x%08x]->eapol_message_wlan_authentication_c::timer_expired: EAPOL_MESSAGE_TIMER_SEND_DATA_ID")
   216 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   215 			 EAPL("(id 0x%02x, data 0x%08x).\n"),
   217 			 this, id, data));
   216 			 this, id, data));
   218 	
   217 	
   219 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   218 		eapol_handle_tlv_message_data_c * const message = reinterpret_cast<eapol_handle_tlv_message_data_c *>(data);
   333 			return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error);
   332 			return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error);
   334 		}
   333 		}
   335 	}
   334 	}
   336 	else
   335 	else
   337 	{
   336 	{
       
   337 
       
   338 #if !defined(EAPOL_SKIP_ETHERNET_HEADER)
       
   339 
   338 		// Always we need at least the Ethernet header.
   340 		// Always we need at least the Ethernet header.
   339 		if (sent_packet->get_data_length()
   341 		if (sent_packet->get_data_length()
   340 			< eapol_ethernet_header_wr_c::get_header_length())
   342 			< eapol_ethernet_header_wr_c::get_header_length())
   341 		{
   343 		{
   342 			EAP_TRACE_ERROR(
   344 			EAP_TRACE_ERROR(
   347 				 EAPL("eapol_ethernet_header_wr_c::get_header_length() %d).\n"),
   349 				 EAPL("eapol_ethernet_header_wr_c::get_header_length() %d).\n"),
   348 				 sent_packet->get_data_length(),
   350 				 sent_packet->get_data_length(),
   349 				 eapol_ethernet_header_wr_c::get_header_length()));
   351 				 eapol_ethernet_header_wr_c::get_header_length()));
   350 			return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error);
   352 			return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error);
   351 		}
   353 		}
       
   354 
       
   355 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER)
       
   356 
   352 	}
   357 	}
   353 	
   358 	
   354 	eapol_ethernet_header_wr_c eth(
   359 	eapol_ethernet_header_wr_c eth(
   355 		m_am_tools,
   360 		m_am_tools,
   356 		sent_packet->get_data_offset(header_offset, data_length),
   361 		sent_packet->get_data_offset(header_offset, data_length),
   370 		{
   375 		{
   371 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   376 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   372 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   377 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   373 		}
   378 		}
   374 
   379 
   375 		status = message.add_parameter_data(eapol_tlv_message_type_function_packet_send);
   380 		status = message.add_parameter_data(eap_tlv_message_type_function_packet_send);
   376 		if (status != eap_status_ok)
   381 		if (status != eap_status_ok)
   377 		{
   382 		{
   378 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   383 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   379 			return EAP_STATUS_RETURN(m_am_tools, status);
   384 			return EAP_STATUS_RETURN(m_am_tools, status);
   380 		}
   385 		}
   437 		{
   442 		{
   438 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   443 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   439 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   444 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   440 		}
   445 		}
   441 
   446 
   442 		status = message.add_parameter_data(eapol_tlv_message_type_function_associate);
   447 		status = message.add_parameter_data(eap_tlv_message_type_function_associate);
   443 		if (status != eap_status_ok)
   448 		if (status != eap_status_ok)
   444 		{
   449 		{
   445 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   450 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   446 			return EAP_STATUS_RETURN(m_am_tools, status);
   451 			return EAP_STATUS_RETURN(m_am_tools, status);
   447 		}
   452 		}
   448 
   453 
   449 		status = message.add_parameter_data(
   454 		status = message.add_parameter_data(
   450 			eapol_tlv_message_type_eapol_key_802_11_authentication_mode,
   455 			eap_tlv_message_type_eapol_key_802_11_authentication_mode,
   451 			static_cast<u32_t>(authentication_mode));
   456 			static_cast<u32_t>(authentication_mode));
   452 		if (status != eap_status_ok)
   457 		if (status != eap_status_ok)
   453 		{
   458 		{
   454 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   459 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   455 			return EAP_STATUS_RETURN(m_am_tools, status);
   460 			return EAP_STATUS_RETURN(m_am_tools, status);
   483 		{
   488 		{
   484 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   489 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   485 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   490 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   486 		}
   491 		}
   487 
   492 
   488 		status = message.add_parameter_data(eapol_tlv_message_type_function_disassociate);
   493 		status = message.add_parameter_data(eap_tlv_message_type_function_disassociate);
   489 		if (status != eap_status_ok)
   494 		if (status != eap_status_ok)
   490 		{
   495 		{
   491 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   496 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   492 			return EAP_STATUS_RETURN(m_am_tools, status);
   497 			return EAP_STATUS_RETURN(m_am_tools, status);
   493 		}
   498 		}
   538 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   543 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   539 	}
   544 	}
   540 	
   545 	
   541 	EAP_TRACE_DEBUG(
   546 	EAP_TRACE_DEBUG(
   542 		m_am_tools,
   547 		m_am_tools,
   543 		TRACE_FLAGS_DEFAULT,
   548 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   544 		(EAPL("test_eapol_c::packet_data_session_key(): key_type 0x%02x, key_index %d\n"),
   549 		(EAPL("test_eapol_c::packet_data_session_key(): key_type 0x%02x, key_index %d\n"),
   545 		 key->get_key_type(),
   550 		 key->get_key_type(),
   546 		 key->get_key_index()));
   551 		 key->get_key_index()));
   547 	
   552 	
   548 	EAP_TRACE_DATA_DEBUG(
   553 	EAP_TRACE_DATA_DEBUG(
   549 		m_am_tools,
   554 		m_am_tools,
   550 		TRACE_FLAGS_DEFAULT,
   555 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   551 		(EAPL("test_eapol_c::packet_data_session_key"), 
   556 		(EAPL("test_eapol_c::packet_data_session_key"), 
   552 		 key->get_key()->get_data(key->get_key()->get_data_length()),
   557 		 key->get_key()->get_data(key->get_key()->get_data_length()),
   553 		 key->get_key()->get_data_length()));
   558 		 key->get_key()->get_data_length()));
   554 	
   559 	
   555 	{
   560 	{
   560 		{
   565 		{
   561 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   566 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   562 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   567 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   563 		}
   568 		}
   564 
   569 
   565 		status = message.add_parameter_data(eapol_tlv_message_type_function_packet_data_session_key);
   570 		status = message.add_parameter_data(eap_tlv_message_type_function_packet_data_session_key);
   566 		if (status != eap_status_ok)
   571 		if (status != eap_status_ok)
   567 		{
   572 		{
   568 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   573 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   569 			return EAP_STATUS_RETURN(m_am_tools, status);
   574 			return EAP_STATUS_RETURN(m_am_tools, status);
   570 		}
   575 		}
   613 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   618 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   614 			(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   619 			(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   615 			return;
   620 			return;
   616 		}
   621 		}
   617 
   622 
   618 		status = message.add_parameter_data(eapol_tlv_message_type_function_state_notification);
   623 		status = message.add_parameter_data(eap_tlv_message_type_function_state_notification);
   619 		if (status != eap_status_ok)
   624 		if (status != eap_status_ok)
   620 		{
   625 		{
   621 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   626 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   622 			(void)EAP_STATUS_RETURN(m_am_tools, status);
   627 			(void)EAP_STATUS_RETURN(m_am_tools, status);
   623 			return;
   628 			return;
   671 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   676 		return EAP_STATUS_RETURN(m_am_tools, eap_status_key_error);
   672 	}
   677 	}
   673 	
   678 	
   674 	EAP_TRACE_DATA_DEBUG(
   679 	EAP_TRACE_DATA_DEBUG(
   675 		m_am_tools,
   680 		m_am_tools,
   676 		TRACE_FLAGS_DEFAULT,
   681 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   677 		(EAPL("eapol_message_wlan_authentication_c::reassociate"), 
   682 		(EAPL("eapol_message_wlan_authentication_c::reassociate"), 
   678 		 PMKID->get_data(PMKID->get_data_length()),
   683 		 PMKID->get_data(PMKID->get_data_length()),
   679 		 PMKID->get_data_length()));
   684 		 PMKID->get_data_length()));
   680 	
   685 	
   681 	{
   686 	{
   686 		{
   691 		{
   687 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   692 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   688 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   693 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   689 		}
   694 		}
   690 
   695 
   691 		status = message.add_parameter_data(eapol_tlv_message_type_function_reassociate);
   696 		status = message.add_parameter_data(eap_tlv_message_type_function_reassociate);
   692 		if (status != eap_status_ok)
   697 		if (status != eap_status_ok)
   693 		{
   698 		{
   694 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   699 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   695 			return EAP_STATUS_RETURN(m_am_tools, status);
   700 			return EAP_STATUS_RETURN(m_am_tools, status);
   696 		}
   701 		}
   701 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   706 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   702 			return EAP_STATUS_RETURN(m_am_tools, status);
   707 			return EAP_STATUS_RETURN(m_am_tools, status);
   703 		}
   708 		}
   704 
   709 
   705 		status = message.add_parameter_data(
   710 		status = message.add_parameter_data(
   706 			eapol_tlv_message_type_eapol_key_authentication_type,
   711 			eap_tlv_message_type_eapol_key_authentication_type,
   707 			static_cast<u32_t>(authentication_type));
   712 			static_cast<u32_t>(authentication_type));
   708 		if (status != eap_status_ok)
   713 		if (status != eap_status_ok)
   709 		{
   714 		{
   710 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   715 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   711 			return EAP_STATUS_RETURN(m_am_tools, status);
   716 			return EAP_STATUS_RETURN(m_am_tools, status);
   726 		}
   731 		}
   727 	}
   732 	}
   728 
   733 
   729 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   734 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   730 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
   735 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
   731 }
       
   732 
       
   733 //--------------------------------------------------
       
   734 
       
   735 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::get_wlan_database_reference_values(
       
   736 	eap_variable_data_c * const reference) const
       
   737 {
       
   738 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   739 
       
   740 	if (m_wlan_database_reference.get_is_valid_data() == true
       
   741 		&& m_wlan_database_reference.get_data_length() > 0ul)
       
   742 	{
       
   743 
       
   744 		return reference->set_copy_of_buffer(&m_wlan_database_reference);
       
   745 	}
       
   746 	else
       
   747 	{
       
   748 		EAP_TRACE_ERROR(
       
   749 			m_am_tools,
       
   750 			TRACE_FLAGS_DEFAULT,
       
   751 			(EAPL("ERROR: get_header_offset(): no completed parameters.\n")));
       
   752 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT)
       
   753 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
   754 	}
       
   755 }
   736 }
   756 
   737 
   757 //--------------------------------------------------
   738 //--------------------------------------------------
   758 
   739 
   759 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::send_error_message(
   740 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::send_error_message(
   760 	const eap_status_e function_status,
   741 	const eap_status_e function_status,
   761 	const eapol_tlv_message_type_function_e function)
   742 	const eap_tlv_message_type_function_e function)
   762 {
   743 {
   763 	wlan_eap_if_send_status_e error_code = wlan_eap_if_send_status_conversion_c::convert(function_status);
   744 	wlan_eap_if_send_status_e error_code = wlan_eap_if_send_status_conversion_c::convert(function_status);
   764 
   745 
   765 	eap_status_e status(eap_status_ok);
   746 	eap_status_e status(eap_status_ok);
   766 
   747 
   773 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   754 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   774 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   755 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   775 		}
   756 		}
   776 
   757 
   777 		status = message.add_parameter_data(
   758 		status = message.add_parameter_data(
   778 			eapol_tlv_message_type_error,
   759 			eap_tlv_message_type_error,
   779 			static_cast<u32_t>(error_code));
   760 			static_cast<u32_t>(error_code));
   780 		if (status != eap_status_ok)
   761 		if (status != eap_status_ok)
   781 		{
   762 		{
   782 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   763 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   783 			return EAP_STATUS_RETURN(m_am_tools, status);
   764 			return EAP_STATUS_RETURN(m_am_tools, status);
   925 		{
   906 		{
   926 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   907 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   927 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   908 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   928 		}
   909 		}
   929 
   910 
   930 		status = message.add_parameter_data(eapol_tlv_message_type_function_new_protected_setup_credentials);
   911 		status = message.add_parameter_data(eap_tlv_message_type_function_new_protected_setup_credentials);
   931 		if (status != eap_status_ok)
   912 		if (status != eap_status_ok)
   932 		{
   913 		{
   933 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   914 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   934 			return EAP_STATUS_RETURN(m_am_tools, status);
   915 			return EAP_STATUS_RETURN(m_am_tools, status);
   935 		}
   916 		}
   952 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   933 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   953 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
   934 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
   954 }
   935 }
   955 
   936 
   956 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
   937 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
       
   938 
       
   939 //--------------------------------------------------
       
   940 
       
   941 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::complete_check_pmksa_cache(
       
   942 	EAP_TEMPLATE_CONST eap_array_c<eap_am_network_id_c> * const bssid_sta_receive_network_ids)
       
   943 {
       
   944 	EAP_TRACE_DEBUG(
       
   945 		m_am_tools,
       
   946 		TRACE_FLAGS_DEFAULT,
       
   947 		(EAPL("eapol_message_wlan_authentication_c::complete_check_pmksa_cache()\n")));
       
   948 
       
   949 	eap_status_e status(eap_status_process_general_error);
       
   950 
       
   951 	// Creates message data composed of Attribute-Value Pairs.
       
   952 	eapol_handle_tlv_message_data_c message(m_am_tools);
       
   953 
       
   954 	if (message.get_is_valid() == false)
       
   955 	{
       
   956 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   957 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   958 	}
       
   959 
       
   960 	status = message.add_parameter_data(eap_tlv_message_type_function_complete_check_pmksa_cache);
       
   961 	if (status != eap_status_ok)
       
   962 	{
       
   963 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   964 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   965 	}
       
   966 
       
   967 	{
       
   968 		u32_t bssid_sta_receive_network_ids_size(0ul);
       
   969 		u32_t ind(0ul);
       
   970 
       
   971 		for (ind = 0ul; ind < bssid_sta_receive_network_ids->get_object_count(); ++ind)
       
   972 		{
       
   973 			const eap_am_network_id_c * const network_id = bssid_sta_receive_network_ids->get_object(ind);
       
   974 			if (network_id == 0)
       
   975 			{
       
   976 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   977 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   978 			}
       
   979 
       
   980 			const u32_t size_of_network_id = 
       
   981 				eap_tlv_header_c::get_header_length()
       
   982 				+ message.get_payload_size(network_id);
       
   983 
       
   984 			bssid_sta_receive_network_ids_size += size_of_network_id;
       
   985 		} // for()
       
   986 
       
   987 		eap_status_e status = message.add_structured_parameter_header(
       
   988 			eap_tlv_message_type_array,
       
   989 			bssid_sta_receive_network_ids_size);
       
   990 		if (status != eap_status_ok)
       
   991 		{
       
   992 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   993 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   994 		}
       
   995 
       
   996 		for (ind = 0ul; ind < bssid_sta_receive_network_ids->get_object_count(); ++ind)
       
   997 		{
       
   998 			status = message.add_parameter_data(
       
   999 				bssid_sta_receive_network_ids->get_object(ind));
       
  1000 			if (status != eap_status_ok)
       
  1001 			{
       
  1002 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1003 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  1004 			}
       
  1005 		} // for()
       
  1006 	}
       
  1007 
       
  1008 	status = send_message(&message);
       
  1009 	if (status != eap_status_ok)
       
  1010 	{
       
  1011 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1012 		return EAP_STATUS_RETURN(m_am_tools, status);
       
  1013 	}
       
  1014 
       
  1015 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1016 	return EAP_STATUS_RETURN(m_am_tools, status);
       
  1017 }
       
  1018 
       
  1019 //--------------------------------------------------
       
  1020 
       
  1021 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::complete_disassociation(
       
  1022 	const eap_am_network_id_c * const receive_network_id) ///< source includes remote address, destination includes local address.
       
  1023 {
       
  1024 	eap_status_e status(eap_status_ok);
       
  1025 
       
  1026 	{
       
  1027 		// Creates message data composed of Attribute-Value Pairs.
       
  1028 		eapol_handle_tlv_message_data_c message(m_am_tools);
       
  1029 
       
  1030 		if (message.get_is_valid() == false)
       
  1031 		{
       
  1032 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1033 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1034 		}
       
  1035 
       
  1036 		status = message.add_parameter_data(eap_tlv_message_type_function_complete_disassociation);
       
  1037 		if (status != eap_status_ok)
       
  1038 		{
       
  1039 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1040 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1041 		}
       
  1042 
       
  1043 		status = message.add_parameter_data(receive_network_id);
       
  1044 		if (status != eap_status_ok)
       
  1045 		{
       
  1046 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1047 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1048 		}
       
  1049 
       
  1050 		status = send_message(&message);
       
  1051 		if (status != eap_status_ok)
       
  1052 		{
       
  1053 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1054 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1055 		}
       
  1056 	}
       
  1057 
       
  1058 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1059 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
       
  1060 }
   957 
  1061 
   958 //--------------------------------------------------
  1062 //--------------------------------------------------
   959 
  1063 
   960 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::process_message_type_error(
  1064 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::process_message_type_error(
   961 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
  1065 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
   962 {
  1066 {
   963 	eap_status_e status(eap_status_ok);
  1067 	eap_status_e status(eap_status_ok);
   964 
  1068 
   965 	{
  1069 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
   966 		// Error payload is the first in this case.
  1070 
   967 		const eap_tlv_header_c * const error_header = parameters->get_object(eapol_message_payload_index_function);
  1071 	if (message_data.get_is_valid() == false)
   968 
  1072 	{
   969 		if (error_header == 0
  1073 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   970 			|| error_header->get_type() != eapol_tlv_message_type_error)
  1074 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
   971 		{
  1075 	}
   972 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1076 
   973 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  1077 	eap_status_e code(eap_status_process_general_error);
   974 		}
  1078 
   975 
  1079 	// Error payload is the first in this case.
   976 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
  1080 	status = message_data.read_parameter_data(parameters, eap_message_payload_index_function, eap_tlv_message_type_error, &code);
   977 
  1081 	if (status != eap_status_ok)
   978 		if (message_data.get_is_valid() == false)
  1082 	{
   979 		{
  1083 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   980 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1084 		return EAP_STATUS_RETURN(m_am_tools, status);
   981 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1085 	}
   982 		}
  1086 
   983 
  1087 	m_error_code = wlan_eap_if_send_status_conversion_c::convert(code);
   984 		u32_t value(0ul);
  1088 
   985 
  1089 	// Fuction payload is the second in this case.
   986 		status = message_data.get_parameter_data(error_header, &value);
  1090 	status = message_data.read_parameter_data(parameters, eap_message_payload_index_first_parameter, &m_error_function);
   987 		if (status != eap_status_ok)
  1091 	if (status != eap_status_ok)
   988 		{
  1092 	{
   989 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1093 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   990 			return EAP_STATUS_RETURN(m_am_tools, status);
  1094 		return EAP_STATUS_RETURN(m_am_tools, status);
   991 		}
       
   992 
       
   993 		m_error_code = static_cast<wlan_eap_if_send_status_e>(value);
       
   994 	}
       
   995 
       
   996 	{
       
   997 		// Fuction payload is the second in this case.
       
   998 		const eap_tlv_header_c * const function_header = parameters->get_object(eapol_message_payload_index_first_parameter);
       
   999 
       
  1000 		if (function_header == 0
       
  1001 			|| function_header->get_type() != eapol_tlv_message_type_function)
       
  1002 		{
       
  1003 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1004 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1005 		}
       
  1006 
       
  1007 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1008 
       
  1009 		if (message_data.get_is_valid() == false)
       
  1010 		{
       
  1011 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1012 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1013 		}
       
  1014 
       
  1015 		status = message_data.get_parameter_data(function_header, &m_error_function);
       
  1016 		if (status != eap_status_ok)
       
  1017 		{
       
  1018 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1019 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1020 		}
       
  1021 	}
  1095 	}
  1022 
  1096 
  1023 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1097 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1024 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  1098 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  1025 }
  1099 }
  1054 
  1128 
  1055 			status = eap_status_allocation_error;
  1129 			status = eap_status_allocation_error;
  1056 
  1130 
  1057 			(void) send_error_message(
  1131 			(void) send_error_message(
  1058 				status,
  1132 				status,
  1059 				eapol_tlv_message_type_function_none);
  1133 				eap_tlv_message_type_function_none);
  1060 
  1134 
  1061 			return EAP_STATUS_RETURN(m_am_tools, status);
  1135 			return EAP_STATUS_RETURN(m_am_tools, status);
  1062 		}
  1136 		}
  1063 
  1137 
  1064 		status = copy_message->copy_message_data(
  1138 		status = copy_message->copy_message_data(
  1068 		{
  1142 		{
  1069 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1143 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1070 
  1144 
  1071 			(void) send_error_message(
  1145 			(void) send_error_message(
  1072 				status,
  1146 				status,
  1073 				eapol_tlv_message_type_function_none);
  1147 				eap_tlv_message_type_function_none);
  1074 
  1148 
  1075 			return EAP_STATUS_RETURN(m_am_tools, status);
  1149 			return EAP_STATUS_RETURN(m_am_tools, status);
  1076 		}
  1150 		}
  1077 
  1151 
  1078 		automatic_message.do_not_free_variable();
  1152 		automatic_message.do_not_free_variable();
  1142 
  1216 
  1143 			status = eap_status_allocation_error;
  1217 			status = eap_status_allocation_error;
  1144 
  1218 
  1145 			(void) send_error_message(
  1219 			(void) send_error_message(
  1146 				status,
  1220 				status,
  1147 				eapol_tlv_message_type_function_none);
  1221 				eap_tlv_message_type_function_none);
  1148 
  1222 
  1149 			return wlan_eap_if_send_status_conversion_c::convert(
  1223 			return wlan_eap_if_send_status_conversion_c::convert(
  1150 				EAP_STATUS_RETURN(m_am_tools, status));
  1224 				EAP_STATUS_RETURN(m_am_tools, status));
  1151 		}
  1225 		}
  1152 
  1226 
  1155 		{
  1229 		{
  1156 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1230 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1157 
  1231 
  1158 			(void) send_error_message(
  1232 			(void) send_error_message(
  1159 				status,
  1233 				status,
  1160 				eapol_tlv_message_type_function_none);
  1234 				eap_tlv_message_type_function_none);
  1161 
  1235 
  1162 			return wlan_eap_if_send_status_conversion_c::convert(
  1236 			return wlan_eap_if_send_status_conversion_c::convert(
  1163 				EAP_STATUS_RETURN(m_am_tools, status));
  1237 				EAP_STATUS_RETURN(m_am_tools, status));
  1164 		}
  1238 		}
  1165 
  1239 
  1166 		automatic_message.do_not_free_variable();
  1240 		automatic_message.do_not_free_variable();
  1167 
  1241 
  1168 		EAP_TRACE_DEBUG(
  1242 		EAP_TRACE_DEBUG(
  1169 			m_am_tools, 
  1243 			m_am_tools, 
  1170 			TRACE_FLAGS_DEFAULT, 
  1244 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1171 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1245 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1172 	
  1246 	
  1173 		status = m_am_tools->am_set_timer(
  1247 		status = m_am_tools->am_set_timer(
  1174 			this,
  1248 			this,
  1175 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1249 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1195 
  1269 
  1196 			status = eap_status_allocation_error;
  1270 			status = eap_status_allocation_error;
  1197 
  1271 
  1198 			(void) send_error_message(
  1272 			(void) send_error_message(
  1199 				status,
  1273 				status,
  1200 				eapol_tlv_message_type_function_none);
  1274 				eap_tlv_message_type_function_none);
  1201 
  1275 
  1202 			return wlan_eap_if_send_status_conversion_c::convert(
  1276 			return wlan_eap_if_send_status_conversion_c::convert(
  1203 				EAP_STATUS_RETURN(m_am_tools, status));
  1277 				EAP_STATUS_RETURN(m_am_tools, status));
  1204 		}
  1278 		}
  1205 
  1279 
  1208 		{
  1282 		{
  1209 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1283 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1210 
  1284 
  1211 			(void) send_error_message(
  1285 			(void) send_error_message(
  1212 				status,
  1286 				status,
  1213 				eapol_tlv_message_type_function_none);
  1287 				eap_tlv_message_type_function_none);
  1214 
  1288 
  1215 			return wlan_eap_if_send_status_conversion_c::convert(
  1289 			return wlan_eap_if_send_status_conversion_c::convert(
  1216 				EAP_STATUS_RETURN(m_am_tools, status));
  1290 				EAP_STATUS_RETURN(m_am_tools, status));
  1217 		}
  1291 		}
  1218 
  1292 
  1243 	{
  1317 	{
  1244 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1318 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1245 
  1319 
  1246 		(void) send_error_message(
  1320 		(void) send_error_message(
  1247 			status,
  1321 			status,
  1248 			eapol_tlv_message_type_function_none);
  1322 			eap_tlv_message_type_function_none);
  1249 
  1323 
  1250 		return EAP_STATUS_RETURN(m_am_tools, status);
  1324 		return EAP_STATUS_RETURN(m_am_tools, status);
  1251 	}
  1325 	}
  1252 
  1326 
  1253 	if (parameters.get_object_count() == 0)
  1327 	if (parameters.get_object_count() == 0)
  1256 
  1330 
  1257 		status = eap_status_illegal_parameter;
  1331 		status = eap_status_illegal_parameter;
  1258 
  1332 
  1259 		(void) send_error_message(
  1333 		(void) send_error_message(
  1260 			status,
  1334 			status,
  1261 			eapol_tlv_message_type_function_none);
  1335 			eap_tlv_message_type_function_none);
  1262 
  1336 
  1263 		return EAP_STATUS_RETURN(m_am_tools, status);
  1337 		return EAP_STATUS_RETURN(m_am_tools, status);
  1264 	}
  1338 	}
  1265 
  1339 
  1266 	const eap_tlv_header_c * const function_header = parameters.get_object(eapol_message_payload_index_function);
  1340 	const eap_tlv_header_c * const function_header = parameters.get_object(eap_message_payload_index_function);
  1267 	if (function_header == 0
  1341 	if (function_header == 0
  1268 		|| (function_header->get_type() != eapol_tlv_message_type_error
  1342 		|| (function_header->get_type() != eap_tlv_message_type_error
  1269 			&& function_header->get_type() != eapol_tlv_message_type_function))
  1343 			&& function_header->get_type() != eap_tlv_message_type_function))
  1270 	{
  1344 	{
  1271 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1345 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1272 
  1346 
  1273 		status = eap_status_illegal_parameter;
  1347 		status = eap_status_illegal_parameter;
  1274 
  1348 
  1275 		(void) send_error_message(
  1349 		(void) send_error_message(
  1276 			status,
  1350 			status,
  1277 			eapol_tlv_message_type_function_none);
  1351 			eap_tlv_message_type_function_none);
  1278 
  1352 
  1279 		return EAP_STATUS_RETURN(m_am_tools, status);
  1353 		return EAP_STATUS_RETURN(m_am_tools, status);
  1280 	}
  1354 	}
  1281 
  1355 
  1282 	if (function_header->get_type() == eapol_tlv_message_type_error)
  1356 	if (function_header->get_type() == eap_tlv_message_type_error)
  1283 	{
  1357 	{
  1284 		status = process_message_type_error(&parameters);
  1358 		status = process_message_type_error(&parameters);
  1285 	}
  1359 	}
  1286 	else // function_header->get_type() == eapol_tlv_message_type_function
  1360 	else // function_header->get_type() == eap_tlv_message_type_function
  1287 	{
  1361 	{
  1288 		eapol_tlv_message_type_function_e function(eapol_tlv_message_type_function_none);
  1362 		eap_tlv_message_type_function_e function(eap_tlv_message_type_function_none);
  1289 
  1363 
  1290 		status = message->get_parameter_data(function_header, &function);
  1364 		status = message->get_parameter_data(function_header, &function);
  1291 		if (status != eap_status_ok)
  1365 		if (status != eap_status_ok)
  1292 		{
  1366 		{
  1293 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1367 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1294 
  1368 
  1295 			(void) send_error_message(
  1369 			(void) send_error_message(
  1296 				status,
  1370 				status,
  1297 				eapol_tlv_message_type_function_none);
  1371 				eap_tlv_message_type_function_none);
  1298 
  1372 
  1299 			return EAP_STATUS_RETURN(m_am_tools, status);
  1373 			return EAP_STATUS_RETURN(m_am_tools, status);
  1300 		}
  1374 		}
  1301 
  1375 
  1302 		switch(function)
  1376 		switch(function)
  1303 		{
  1377 		{
  1304 		case eapol_tlv_message_type_function_check_pmksa_cache:
  1378 		case eap_tlv_message_type_function_check_pmksa_cache:
  1305 			status = check_pmksa_cache(&parameters);
  1379 			status = check_pmksa_cache(&parameters);
  1306 			break;
  1380 			break;
  1307 		case eapol_tlv_message_type_function_start_authentication:
  1381 		case eap_tlv_message_type_function_start_authentication:
  1308 			status = start_authentication(&parameters);
  1382 			status = start_authentication(&parameters);
  1309 			break;
  1383 			break;
  1310 		case eapol_tlv_message_type_function_complete_association:
  1384 		case eap_tlv_message_type_function_complete_association:
  1311 			status = complete_association(&parameters);
  1385 			status = complete_association(&parameters);
  1312 			break;
  1386 			break;
  1313 		case eapol_tlv_message_type_function_disassociation:
  1387 		case eap_tlv_message_type_function_disassociation:
  1314 			status = disassociation(&parameters);
  1388 			status = disassociation(&parameters);
  1315 			break;
  1389 			break;
  1316 		case eapol_tlv_message_type_function_start_preauthentication:
  1390 		case eap_tlv_message_type_function_start_preauthentication:
  1317 			status = start_preauthentication(&parameters);
  1391 			status = start_preauthentication(&parameters);
  1318 			break;
  1392 			break;
  1319 		case eapol_tlv_message_type_function_start_reassociation:
  1393 		case eap_tlv_message_type_function_start_reassociation:
  1320 			status = start_reassociation(&parameters);
  1394 			status = start_reassociation(&parameters);
  1321 			break;
  1395 			break;
  1322 		case eapol_tlv_message_type_function_complete_reassociation:
  1396 		case eap_tlv_message_type_function_complete_reassociation:
  1323 			status = complete_reassociation(&parameters);
  1397 			status = complete_reassociation(&parameters);
  1324 			break;
  1398 			break;
  1325 		case eapol_tlv_message_type_function_start_WPXM_reassociation:
  1399 		case eap_tlv_message_type_function_start_WPXM_reassociation:
  1326 			status = start_WPXM_reassociation(&parameters);
  1400 			status = start_WPXM_reassociation(&parameters);
  1327 			break;
  1401 			break;
  1328 		case eapol_tlv_message_type_function_complete_WPXM_reassociation:
  1402 		case eap_tlv_message_type_function_complete_WPXM_reassociation:
  1329 			status = complete_WPXM_reassociation(&parameters);
  1403 			status = complete_WPXM_reassociation(&parameters);
  1330 			break;
  1404 			break;
  1331 		case eapol_tlv_message_type_function_packet_process:
  1405 		case eap_tlv_message_type_function_packet_process:
  1332 			status = packet_process(&parameters);
  1406 			status = packet_process(&parameters);
  1333 			break;
  1407 			break;
  1334 		case eapol_tlv_message_type_function_tkip_mic_failure:
  1408 		case eap_tlv_message_type_function_tkip_mic_failure:
  1335 			status = tkip_mic_failure(&parameters);
  1409 			status = tkip_mic_failure(&parameters);
  1336 			break;
  1410 			break;
  1337 		case eapol_tlv_message_type_function_eap_acknowledge:
  1411 		case eap_tlv_message_type_function_eap_acknowledge:
  1338 			status = eap_acknowledge(&parameters);
  1412 			status = eap_acknowledge(&parameters);
  1339 			break;
  1413 			break;
  1340 		case eapol_tlv_message_type_function_update_header_offset:
  1414 		case eap_tlv_message_type_function_update_header_offset:
  1341 			status = update_header_offset(&parameters);
  1415 			status = update_header_offset(&parameters);
  1342 			break;
  1416 			break;
  1343 		case eapol_tlv_message_type_function_update_wlan_database_reference_values:
  1417 		case eap_tlv_message_type_function_update_wlan_database_reference_values:
  1344 			status = update_wlan_database_reference_values(&parameters);
  1418 			status = update_wlan_database_reference_values(&parameters);
  1345 			break;
  1419 			break;
  1346 		default:
  1420 		default:
  1347 			EAP_TRACE_ERROR(
  1421 			EAP_TRACE_ERROR(
  1348 				m_am_tools,
  1422 				m_am_tools,
  1378 
  1452 
  1379 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1453 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1380 
  1454 
  1381 	eap_status_e status(eap_status_ok);
  1455 	eap_status_e status(eap_status_ok);
  1382 
  1456 
  1383 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1457 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1458 
       
  1459 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1460 
       
  1461 	if (message_data.get_is_valid() == false)
       
  1462 	{
       
  1463 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1464 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1465 	}
       
  1466 
       
  1467 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1384 
  1468 
  1385 	eap_array_c<eap_am_network_id_c> bssid_sta_receive_network_ids(m_am_tools);
  1469 	eap_array_c<eap_am_network_id_c> bssid_sta_receive_network_ids(m_am_tools);
  1386 
  1470 
  1387 	{
  1471 	status = message_data.read_parameter_data(parameters, parameter_index, &bssid_sta_receive_network_ids);
  1388 		const eap_tlv_header_c * const array_of_network_ids
  1472 	if (status != eap_status_ok)
  1389 			= parameters->get_object(parameter_index);
  1473 	{
  1390 
  1474 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1391 		if (array_of_network_ids == 0
  1475 		return EAP_STATUS_RETURN(m_am_tools, status);
  1392 			|| array_of_network_ids->get_type() != eapol_tlv_message_type_array)
  1476 	}
  1393 		{
  1477 
  1394 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1478 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1395 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1396 		}
       
  1397 
       
  1398 		eapol_handle_tlv_message_data_c array_data(m_am_tools);
       
  1399 
       
  1400 		if (array_data.get_is_valid() == false)
       
  1401 		{
       
  1402 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1403 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1404 		}
       
  1405 
       
  1406 		status = array_data.set_message_data(
       
  1407 			array_of_network_ids->get_value_length(),
       
  1408 			array_of_network_ids->get_value(array_of_network_ids->get_value_length()));
       
  1409 
       
  1410 		if (status != eap_status_ok)
       
  1411 		{
       
  1412 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1413 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1414 		}
       
  1415 
       
  1416 		eap_array_c<eap_tlv_header_c> network_ids(m_am_tools);
       
  1417 
       
  1418 		status = array_data.parse_message_data(
       
  1419 			&network_ids);
       
  1420 		if (status != eap_status_ok)
       
  1421 		{
       
  1422 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1423 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1424 		}
       
  1425 
       
  1426 		for (u32_t ind = 0ul; ind < network_ids.get_object_count(); ++ind)
       
  1427 		{
       
  1428 			const eap_tlv_header_c * const header = network_ids.get_object(ind);
       
  1429 
       
  1430 			if (header == 0)
       
  1431 			{
       
  1432 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1433 				return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1434 			}
       
  1435 
       
  1436 			eap_am_network_id_c * const new_network_id = new eap_am_network_id_c(m_am_tools);
       
  1437 			if (new_network_id == 0)
       
  1438 			{
       
  1439 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1440 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1441 			}
       
  1442 
       
  1443 			eap_automatic_variable_c<eap_am_network_id_c> automatic_new_network_id(m_am_tools, new_network_id);
       
  1444 
       
  1445 			status = array_data.get_parameter_data(header, new_network_id);
       
  1446 			if (status != eap_status_ok)
       
  1447 			{
       
  1448 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1449 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  1450 			}
       
  1451 
       
  1452 			automatic_new_network_id.do_not_free_variable();
       
  1453 
       
  1454 			status = bssid_sta_receive_network_ids.add_object(
       
  1455 				new_network_id,
       
  1456 				true);
       
  1457 			if (status != eap_status_ok)
       
  1458 			{
       
  1459 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1460 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  1461 			}
       
  1462 
       
  1463 		} // for()
       
  1464 	}
       
  1465 
       
  1466 
  1479 
  1467 	++parameter_index;
  1480 	++parameter_index;
  1468 
  1481 
  1469 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1482 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1470 
  1483 
  1471 	{
  1484 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  1472 		const eap_tlv_header_c * const authentication_type
  1485 	if (status != eap_status_ok)
  1473 			= parameters->get_object(parameter_index);
  1486 	{
  1474 
  1487 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1475 		if (authentication_type == 0
  1488 		return EAP_STATUS_RETURN(m_am_tools, status);
  1476 			|| authentication_type->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1489 	}
  1477 		{
  1490 
  1478 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1491 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1479 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1480 		}
       
  1481 
       
  1482 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1483 
       
  1484 		if (message_data.get_is_valid() == false)
       
  1485 		{
       
  1486 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1487 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1488 		}
       
  1489 
       
  1490 		u32_t value(0ul);
       
  1491 
       
  1492 		status = message_data.get_parameter_data(authentication_type, &value);
       
  1493 		if (status != eap_status_ok)
       
  1494 		{
       
  1495 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1496 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1497 		}
       
  1498 
       
  1499 		selected_eapol_key_authentication_type = static_cast<eapol_key_authentication_type_e>(value);
       
  1500 	}
       
  1501 
       
  1502 
  1492 
  1503 	++parameter_index;
  1493 	++parameter_index;
  1504 
  1494 
  1505 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1495 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1506 
  1496 
  1507 	{
  1497 	status = message_data.read_parameter_data(parameters, parameter_index, &pairwise_key_cipher_suite);
  1508 		const eap_tlv_header_c * const authentication_type
  1498 	if (status != eap_status_ok)
  1509 			= parameters->get_object(parameter_index);
  1499 	{
  1510 
  1500 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1511 		if (authentication_type == 0
  1501 		return EAP_STATUS_RETURN(m_am_tools, status);
  1512 			|| authentication_type->get_type() != eapol_tlv_message_type_RSNA_cipher)
  1502 	}
  1513 		{
  1503 
  1514 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1504 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1515 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1516 		}
       
  1517 
       
  1518 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1519 
       
  1520 		if (message_data.get_is_valid() == false)
       
  1521 		{
       
  1522 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1523 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1524 		}
       
  1525 
       
  1526 		u32_t value(0ul);
       
  1527 
       
  1528 		status = message_data.get_parameter_data(authentication_type, &value);
       
  1529 		if (status != eap_status_ok)
       
  1530 		{
       
  1531 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1532 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1533 		}
       
  1534 
       
  1535 		pairwise_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  1536 	}
       
  1537 
       
  1538 
  1505 
  1539 	++parameter_index;
  1506 	++parameter_index;
  1540 
  1507 
  1541 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1508 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1542 
  1509 
  1543 	{
  1510 	status = message_data.read_parameter_data(parameters, parameter_index, &group_key_cipher_suite);
  1544 		const eap_tlv_header_c * const authentication_type
  1511 	if (status != eap_status_ok)
  1545 			= parameters->get_object(parameter_index);
  1512 	{
  1546 
  1513 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1547 		if (authentication_type == 0
  1514 		return EAP_STATUS_RETURN(m_am_tools, status);
  1548 			|| authentication_type->get_type() != eapol_tlv_message_type_RSNA_cipher)
       
  1549 		{
       
  1550 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1551 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1552 		}
       
  1553 
       
  1554 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1555 
       
  1556 		if (message_data.get_is_valid() == false)
       
  1557 		{
       
  1558 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1559 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1560 		}
       
  1561 
       
  1562 		u32_t value(0ul);
       
  1563 
       
  1564 		status = message_data.get_parameter_data(authentication_type, &value);
       
  1565 		if (status != eap_status_ok)
       
  1566 		{
       
  1567 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1568 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1569 		}
       
  1570 
       
  1571 		group_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  1572 	}
  1515 	}
  1573 
  1516 
  1574 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1517 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1575 
  1518 
  1576 	status = m_wauth->check_pmksa_cache(
  1519 	status = m_wauth->check_pmksa_cache(
  1579 		pairwise_key_cipher_suite,
  1522 		pairwise_key_cipher_suite,
  1580 		group_key_cipher_suite);
  1523 		group_key_cipher_suite);
  1581 
  1524 
  1582 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1525 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1583 
  1526 
       
  1527 #if 0
       
  1528 
  1584 	if (status == eap_status_ok
  1529 	if (status == eap_status_ok
  1585 		|| status == eap_status_not_found)
  1530 		|| status == eap_status_not_found)
  1586 	{
  1531 	{
  1587 		// Creates message data composed of Attribute-Value Pairs.
  1532 		// Creates message data composed of Attribute-Value Pairs.
  1588 		eapol_handle_tlv_message_data_c message(m_am_tools);
  1533 		eapol_handle_tlv_message_data_c message(m_am_tools);
  1592 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1537 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1593 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1538 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1594 		}
  1539 		}
  1595 
  1540 
  1596 		status = message.add_parameter_data(
  1541 		status = message.add_parameter_data(
  1597 			eapol_tlv_message_type_function_complete_check_pmksa_cache);
  1542 			eap_tlv_message_type_function_complete_check_pmksa_cache);
  1598 		if (status != eap_status_ok)
  1543 		if (status != eap_status_ok)
  1599 		{
  1544 		{
  1600 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1545 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1601 			return EAP_STATUS_RETURN(m_am_tools, status);
  1546 			return EAP_STATUS_RETURN(m_am_tools, status);
  1602 		}
  1547 		}
  1618 				eap_tlv_header_c::get_header_length()
  1563 				eap_tlv_header_c::get_header_length()
  1619 				+ message.get_payload_size(network_id);
  1564 				+ message.get_payload_size(network_id);
  1620 		}
  1565 		}
  1621 
  1566 
  1622 		status = message.add_structured_parameter_header(
  1567 		status = message.add_structured_parameter_header(
  1623 			eapol_tlv_message_type_array,
  1568 			eap_tlv_message_type_array,
  1624 			network_id_parameters_size);
  1569 			network_id_parameters_size);
  1625 		if (status != eap_status_ok)
  1570 		if (status != eap_status_ok)
  1626 		{
  1571 		{
  1627 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1572 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1628 			return EAP_STATUS_RETURN(m_am_tools, status);
  1573 			return EAP_STATUS_RETURN(m_am_tools, status);
  1653 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1598 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1654 			return EAP_STATUS_RETURN(m_am_tools, status);
  1599 			return EAP_STATUS_RETURN(m_am_tools, status);
  1655 		}
  1600 		}
  1656 	}
  1601 	}
  1657 
  1602 
       
  1603 #endif //#if 0
       
  1604 
  1658 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1605 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1659 
  1606 
  1660 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1607 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1661 	return EAP_STATUS_RETURN(m_am_tools, status);
  1608 	return EAP_STATUS_RETURN(m_am_tools, status);
  1662 }
  1609 }
  1670 
  1617 
  1671 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1618 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1672 
  1619 
  1673 	eap_status_e status(eap_status_ok);
  1620 	eap_status_e status(eap_status_ok);
  1674 
  1621 
  1675 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1622 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1623 
       
  1624 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1625 
       
  1626 	if (message_data.get_is_valid() == false)
       
  1627 	{
       
  1628 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1629 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1630 	}
       
  1631 
       
  1632 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1676 
  1633 
  1677 	eap_variable_data_c SSID(m_am_tools);
  1634 	eap_variable_data_c SSID(m_am_tools);
  1678 
  1635 
  1679 	if (SSID.get_is_valid() == false)
  1636 	if (SSID.get_is_valid() == false)
  1680 	{
  1637 	{
  1681 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1638 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1682 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1639 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1683 	}
  1640 	}
  1684 
  1641 
  1685 	{
  1642 	status = message_data.read_parameter_data(parameters, parameter_index, &SSID);
  1686 		const eap_tlv_header_c * const ssid_parameter
  1643 	if (status != eap_status_ok)
  1687 			= parameters->get_object(parameter_index);
  1644 	{
  1688 
  1645 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1689 		if (ssid_parameter == 0
  1646 		return EAP_STATUS_RETURN(m_am_tools, status);
  1690 			|| ssid_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1647 	}
  1691 		{
  1648 
  1692 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1649 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1693 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1694 		}
       
  1695 
       
  1696 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1697 
       
  1698 		if (message_data.get_is_valid() == false)
       
  1699 		{
       
  1700 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1701 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1702 		}
       
  1703 
       
  1704 		status = message_data.get_parameter_data(ssid_parameter, &SSID);
       
  1705 		if (status != eap_status_ok)
       
  1706 		{
       
  1707 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1708 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1709 		}
       
  1710 	}
       
  1711 
       
  1712 
  1650 
  1713 	++parameter_index;
  1651 	++parameter_index;
  1714 
  1652 
  1715 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1653 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1716 
  1654 
  1717 	{
  1655 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  1718 		const eap_tlv_header_c * const authentication_type_parameter
  1656 	if (status != eap_status_ok)
  1719 			= parameters->get_object(parameter_index);
  1657 	{
  1720 
  1658 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1721 		if (authentication_type_parameter == 0
  1659 		return EAP_STATUS_RETURN(m_am_tools, status);
  1722 			|| authentication_type_parameter->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1660 	}
  1723 		{
  1661 
  1724 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1662 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1725 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1726 		}
       
  1727 
       
  1728 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1729 
       
  1730 		if (message_data.get_is_valid() == false)
       
  1731 		{
       
  1732 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1733 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1734 		}
       
  1735 
       
  1736 		u32_t value(0ul);
       
  1737 
       
  1738 		status = message_data.get_parameter_data(authentication_type_parameter, &value);
       
  1739 		if (status != eap_status_ok)
       
  1740 		{
       
  1741 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1742 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1743 		}
       
  1744 
       
  1745 		selected_eapol_key_authentication_type = static_cast<eapol_key_authentication_type_e>(value);
       
  1746 	}
       
  1747 
       
  1748 
  1663 
  1749 	++parameter_index;
  1664 	++parameter_index;
  1750 
  1665 
  1751 	eap_variable_data_c wpa_preshared_key(m_am_tools);
  1666 	eap_variable_data_c wpa_preshared_key(m_am_tools);
  1752 
  1667 
  1753 	{
  1668 	status = message_data.read_parameter_data(parameters, parameter_index, &wpa_preshared_key);
  1754 		const eap_tlv_header_c * const wpa_preshared_key_parameter
  1669 	if (status != eap_status_ok)
  1755 			= parameters->get_object(parameter_index);
  1670 	{
  1756 
  1671 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1757 		if (wpa_preshared_key_parameter == 0
  1672 		return EAP_STATUS_RETURN(m_am_tools, status);
  1758 			|| wpa_preshared_key_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1673 	}
  1759 		{
  1674 
  1760 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1675 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1761 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1762 		}
       
  1763 
       
  1764 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1765 
       
  1766 		if (message_data.get_is_valid() == false)
       
  1767 		{
       
  1768 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1769 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1770 		}
       
  1771 
       
  1772 		status = message_data.get_parameter_data(wpa_preshared_key_parameter, &wpa_preshared_key);
       
  1773 		if (status != eap_status_ok)
       
  1774 		{
       
  1775 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1776 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1777 		}
       
  1778 	}
       
  1779 
       
  1780 
  1676 
  1781 	++parameter_index;
  1677 	++parameter_index;
  1782 
  1678 
  1783 	bool WPA_override_enabled(false);
  1679 	bool WPA_override_enabled(false);
  1784 
  1680 
  1785 	{
  1681 	status = message_data.read_parameter_data(parameters, parameter_index, &WPA_override_enabled);
  1786 		const eap_tlv_header_c * const WPA_override_enabled_parameter
  1682 	if (status != eap_status_ok)
  1787 			= parameters->get_object(parameter_index);
  1683 	{
  1788 
  1684 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1789 		if (WPA_override_enabled_parameter == 0
  1685 		return EAP_STATUS_RETURN(m_am_tools, status);
  1790 			|| WPA_override_enabled_parameter->get_type() != eapol_tlv_message_type_boolean)
  1686 	}
  1791 		{
  1687 
  1792 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1688 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1793 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1794 		}
       
  1795 
       
  1796 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1797 
       
  1798 		if (message_data.get_is_valid() == false)
       
  1799 		{
       
  1800 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1801 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1802 		}
       
  1803 
       
  1804 		u32_t value(0ul);
       
  1805 
       
  1806 		status = message_data.get_parameter_data(WPA_override_enabled_parameter, &value);
       
  1807 		if (status != eap_status_ok)
       
  1808 		{
       
  1809 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1810 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1811 		}
       
  1812 
       
  1813 		WPA_override_enabled = (value == 0) ? false: true;
       
  1814 	}
       
  1815 
       
  1816 
       
  1817 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
       
  1818 
  1689 
  1819 	++parameter_index;
  1690 	++parameter_index;
  1820 
  1691 
  1821 	eap_am_network_id_c receive_network_id(m_am_tools);
  1692 	eap_am_network_id_c receive_network_id(m_am_tools);
  1822 
  1693 
  1823 	{
  1694 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  1824 		const eap_tlv_header_c * const receive_network_id_parameter
  1695 	if (status != eap_status_ok)
  1825 			= parameters->get_object(parameter_index);
  1696 	{
  1826 
  1697 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1827 		if (receive_network_id_parameter == 0
  1698 		return EAP_STATUS_RETURN(m_am_tools, status);
  1828 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1699 	}
  1829 		{
       
  1830 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1831 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1832 		}
       
  1833 
       
  1834 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1835 
       
  1836 		if (message_data.get_is_valid() == false)
       
  1837 		{
       
  1838 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1839 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1840 		}
       
  1841 
       
  1842 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  1843 		if (status != eap_status_ok)
       
  1844 		{
       
  1845 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1846 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1847 		}
       
  1848 	}
       
  1849 
       
  1850 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
       
  1851 
  1700 
  1852 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1701 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1853 
  1702 
  1854 	status = m_wauth->start_authentication(
  1703 	status = m_wauth->start_authentication(
  1855 		&SSID,
  1704 		&SSID,
  1856 		selected_eapol_key_authentication_type,
  1705 		selected_eapol_key_authentication_type,
  1857 		&wpa_preshared_key,
  1706 		&wpa_preshared_key,
  1858 		WPA_override_enabled
  1707 		WPA_override_enabled,
  1859 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
  1708 		&receive_network_id
  1860 		, &receive_network_id
       
  1861 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
       
  1862 		);
  1709 		);
  1863 
  1710 
  1864 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1711 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1865 
  1712 
  1866 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1713 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1876 
  1723 
  1877 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1724 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1878 
  1725 
  1879 	eap_status_e status(eap_status_ok);
  1726 	eap_status_e status(eap_status_ok);
  1880 
  1727 
  1881 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1728 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1729 
       
  1730 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1731 
       
  1732 	if (message_data.get_is_valid() == false)
       
  1733 	{
       
  1734 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1735 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1736 	}
       
  1737 
       
  1738 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1882 
  1739 
  1883 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  1740 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  1884 
  1741 
  1885 	{
  1742 	status = message_data.read_parameter_data(parameters, parameter_index, &association_result);
  1886 		const eap_tlv_header_c * const association_result_parameter
  1743 	if (status != eap_status_ok)
  1887 			= parameters->get_object(parameter_index);
  1744 	{
  1888 
  1745 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1889 		if (association_result_parameter == 0
  1746 		return EAP_STATUS_RETURN(m_am_tools, status);
  1890 			|| association_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  1747 	}
  1891 		{
  1748 
  1892 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1749 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1893 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1894 		}
       
  1895 
       
  1896 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1897 
       
  1898 		if (message_data.get_is_valid() == false)
       
  1899 		{
       
  1900 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1901 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1902 		}
       
  1903 
       
  1904 		u32_t value(0ul);
       
  1905 
       
  1906 		status = message_data.get_parameter_data(association_result_parameter, &value);
       
  1907 		if (status != eap_status_ok)
       
  1908 		{
       
  1909 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1910 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1911 		}
       
  1912 
       
  1913 		association_result = static_cast<eapol_wlan_authentication_state_e>(value);
       
  1914 	}
       
  1915 
       
  1916 
  1750 
  1917 	++parameter_index;
  1751 	++parameter_index;
  1918 
  1752 
  1919 	eap_am_network_id_c receive_network_id(m_am_tools);
  1753 	eap_am_network_id_c receive_network_id(m_am_tools);
  1920 
  1754 
  1921 	{
  1755 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  1922 		const eap_tlv_header_c * const receive_network_id_parameter
  1756 	if (status != eap_status_ok)
  1923 			= parameters->get_object(parameter_index);
  1757 	{
  1924 
  1758 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1925 		if (receive_network_id_parameter == 0
  1759 		return EAP_STATUS_RETURN(m_am_tools, status);
  1926 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1760 	}
  1927 		{
  1761 
  1928 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1762 
  1929 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  1763 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1930 		}
       
  1931 
       
  1932 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1933 
       
  1934 		if (message_data.get_is_valid() == false)
       
  1935 		{
       
  1936 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1937 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1938 		}
       
  1939 
       
  1940 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  1941 		if (status != eap_status_ok)
       
  1942 		{
       
  1943 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1944 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1945 		}
       
  1946 	}
       
  1947 
       
  1948 
  1764 
  1949 	++parameter_index;
  1765 	++parameter_index;
  1950 
  1766 
  1951 	eap_variable_data_c received_WPA_IE(m_am_tools);
  1767 	eap_variable_data_c received_WPA_IE(m_am_tools);
  1952 
  1768 
  1953 	{
  1769 	status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_IE);
  1954 		const eap_tlv_header_c * const received_WPA_IE_parameter
  1770 	if (status != eap_status_ok)
  1955 			= parameters->get_object(parameter_index);
  1771 	{
  1956 
  1772 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1957 		if (received_WPA_IE_parameter == 0
  1773 		return EAP_STATUS_RETURN(m_am_tools, status);
  1958 			|| received_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1774 	}
  1959 		{
  1775 
  1960 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1776 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1961 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1962 		}
       
  1963 
       
  1964 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1965 
       
  1966 		if (message_data.get_is_valid() == false)
       
  1967 		{
       
  1968 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1969 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1970 		}
       
  1971 
       
  1972 		status = message_data.get_parameter_data(received_WPA_IE_parameter, &received_WPA_IE);
       
  1973 		if (status != eap_status_ok)
       
  1974 		{
       
  1975 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1976 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  1977 		}
       
  1978 	}
       
  1979 
       
  1980 
  1777 
  1981 	++parameter_index;
  1778 	++parameter_index;
  1982 
  1779 
  1983 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  1780 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  1984 
  1781 
  1985 	{
  1782 	status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_IE);
  1986 		const eap_tlv_header_c * const sent_WPA_IE_parameter
  1783 	if (status != eap_status_ok)
  1987 			= parameters->get_object(parameter_index);
  1784 	{
  1988 
  1785 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1989 		if (sent_WPA_IE_parameter == 0
  1786 		return EAP_STATUS_RETURN(m_am_tools, status);
  1990 			|| sent_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1787 	}
  1991 		{
  1788 
  1992 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1789 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1993 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1994 		}
       
  1995 
       
  1996 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1997 
       
  1998 		if (message_data.get_is_valid() == false)
       
  1999 		{
       
  2000 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2001 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2002 		}
       
  2003 
       
  2004 		status = message_data.get_parameter_data(sent_WPA_IE_parameter, &sent_WPA_IE);
       
  2005 		if (status != eap_status_ok)
       
  2006 		{
       
  2007 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2008 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2009 		}
       
  2010 	}
       
  2011 
       
  2012 
  1790 
  2013 	++parameter_index;
  1791 	++parameter_index;
  2014 
  1792 
  2015 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1793 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2016 
  1794 
  2017 	{
  1795 	status = message_data.read_parameter_data(parameters, parameter_index, &pairwise_key_cipher_suite);
  2018 		const eap_tlv_header_c * const pairwise_key_cipher_suite_parameter
  1796 	if (status != eap_status_ok)
  2019 			= parameters->get_object(parameter_index);
  1797 	{
  2020 
  1798 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2021 		if (pairwise_key_cipher_suite_parameter == 0
  1799 		return EAP_STATUS_RETURN(m_am_tools, status);
  2022 			|| pairwise_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
  1800 	}
  2023 		{
  1801 
  2024 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1802 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2025 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2026 		}
       
  2027 
       
  2028 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2029 
       
  2030 		if (message_data.get_is_valid() == false)
       
  2031 		{
       
  2032 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2033 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2034 		}
       
  2035 
       
  2036 		u32_t value(0ul);
       
  2037 
       
  2038 		status = message_data.get_parameter_data(pairwise_key_cipher_suite_parameter, &value);
       
  2039 		if (status != eap_status_ok)
       
  2040 		{
       
  2041 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2042 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2043 		}
       
  2044 
       
  2045 		pairwise_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  2046 	}
       
  2047 
  1803 
  2048 	++parameter_index;
  1804 	++parameter_index;
  2049 
  1805 
  2050 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1806 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2051 
  1807 
  2052 	{
  1808 	status = message_data.read_parameter_data(parameters, parameter_index, &group_key_cipher_suite);
  2053 		const eap_tlv_header_c * const group_key_cipher_suite_parameter
  1809 	if (status != eap_status_ok)
  2054 			= parameters->get_object(parameter_index);
  1810 	{
  2055 
  1811 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2056 		if (group_key_cipher_suite_parameter == 0
  1812 		return EAP_STATUS_RETURN(m_am_tools, status);
  2057 			|| group_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
       
  2058 		{
       
  2059 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2060 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2061 		}
       
  2062 
       
  2063 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2064 
       
  2065 		if (message_data.get_is_valid() == false)
       
  2066 		{
       
  2067 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2068 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2069 		}
       
  2070 
       
  2071 		u32_t value(0ul);
       
  2072 
       
  2073 		status = message_data.get_parameter_data(group_key_cipher_suite_parameter, &value);
       
  2074 		if (status != eap_status_ok)
       
  2075 		{
       
  2076 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2077 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2078 		}
       
  2079 
       
  2080 		group_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  2081 	}
  1813 	}
  2082 
  1814 
  2083 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1815 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2084 
  1816 
  2085 	status = m_wauth->complete_association(
  1817 	status = m_wauth->complete_association(
  2106 
  1838 
  2107 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1839 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2108 
  1840 
  2109 	eap_status_e status(eap_status_ok);
  1841 	eap_status_e status(eap_status_ok);
  2110 
  1842 
  2111 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1843 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1844 
       
  1845 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1846 
       
  1847 	if (message_data.get_is_valid() == false)
       
  1848 	{
       
  1849 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1850 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1851 	}
       
  1852 
       
  1853 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2112 
  1854 
  2113 	eap_am_network_id_c receive_network_id(m_am_tools);
  1855 	eap_am_network_id_c receive_network_id(m_am_tools);
  2114 
  1856 
  2115 	{
  1857 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2116 		const eap_tlv_header_c * const receive_network_id_parameter
  1858 	if (status != eap_status_ok)
  2117 			= parameters->get_object(parameter_index);
  1859 	{
  2118 
  1860 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2119 		if (receive_network_id_parameter == 0
  1861 		return EAP_STATUS_RETURN(m_am_tools, status);
  2120 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
       
  2121 		{
       
  2122 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2123 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2124 		}
       
  2125 
       
  2126 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2127 
       
  2128 		if (message_data.get_is_valid() == false)
       
  2129 		{
       
  2130 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2131 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2132 		}
       
  2133 
       
  2134 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  2135 		if (status != eap_status_ok)
       
  2136 		{
       
  2137 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2138 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2139 		}
       
  2140 	}
  1862 	}
  2141 
  1863 
  2142 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1864 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2143 
  1865 
  2144 	status = m_wauth->disassociation(
  1866 	status = m_wauth->disassociation(
  2160 
  1882 
  2161 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1883 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2162 
  1884 
  2163 	eap_status_e status(eap_status_ok);
  1885 	eap_status_e status(eap_status_ok);
  2164 
  1886 
  2165 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1887 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1888 
       
  1889 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1890 
       
  1891 	if (message_data.get_is_valid() == false)
       
  1892 	{
       
  1893 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1894 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1895 	}
       
  1896 
       
  1897 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2166 
  1898 
  2167 	eap_am_network_id_c receive_network_id(m_am_tools);
  1899 	eap_am_network_id_c receive_network_id(m_am_tools);
  2168 
  1900 
  2169 	{
  1901 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2170 		const eap_tlv_header_c * const receive_network_id_parameter
  1902 	if (status != eap_status_ok)
  2171 			= parameters->get_object(parameter_index);
  1903 	{
  2172 
  1904 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2173 		if (receive_network_id_parameter == 0
  1905 		return EAP_STATUS_RETURN(m_am_tools, status);
  2174 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
       
  2175 		{
       
  2176 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2177 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2178 		}
       
  2179 
       
  2180 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2181 
       
  2182 		if (message_data.get_is_valid() == false)
       
  2183 		{
       
  2184 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2185 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2186 		}
       
  2187 
       
  2188 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  2189 		if (status != eap_status_ok)
       
  2190 		{
       
  2191 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2192 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2193 		}
       
  2194 	}
  1906 	}
  2195 
  1907 
  2196 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1908 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2197 
  1909 
  2198 	status = m_wauth->start_preauthentication(
  1910 	status = m_wauth->start_preauthentication(
  2214 
  1926 
  2215 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1927 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2216 
  1928 
  2217 	eap_status_e status(eap_status_ok);
  1929 	eap_status_e status(eap_status_ok);
  2218 
  1930 
  2219 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1931 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1932 
       
  1933 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1934 
       
  1935 	if (message_data.get_is_valid() == false)
       
  1936 	{
       
  1937 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1938 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1939 	}
       
  1940 
       
  1941 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2220 
  1942 
  2221 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  1943 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2222 
  1944 
  2223 	{
  1945 	status = message_data.read_parameter_data(parameters, parameter_index, &old_receive_network_id);
  2224 		const eap_tlv_header_c * const old_receive_network_id_parameter
  1946 	if (status != eap_status_ok)
  2225 			= parameters->get_object(parameter_index);
  1947 	{
  2226 
  1948 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2227 		if (old_receive_network_id_parameter == 0
  1949 		return EAP_STATUS_RETURN(m_am_tools, status);
  2228 			|| old_receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1950 	}
  2229 		{
  1951 
  2230 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1952 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2231 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2232 		}
       
  2233 
       
  2234 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2235 
       
  2236 		if (message_data.get_is_valid() == false)
       
  2237 		{
       
  2238 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2239 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2240 		}
       
  2241 
       
  2242 		status = message_data.get_parameter_data(old_receive_network_id_parameter, &old_receive_network_id);
       
  2243 		if (status != eap_status_ok)
       
  2244 		{
       
  2245 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2246 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2247 		}
       
  2248 	}
       
  2249 
  1953 
  2250 	++parameter_index;
  1954 	++parameter_index;
  2251 
  1955 
  2252 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  1956 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2253 
  1957 
  2254 	{
  1958 	status = message_data.read_parameter_data(parameters, parameter_index, &new_receive_network_id);
  2255 		const eap_tlv_header_c * const new_receive_network_id_parameter
  1959 	if (status != eap_status_ok)
  2256 			= parameters->get_object(parameter_index);
  1960 	{
  2257 
  1961 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2258 		if (new_receive_network_id_parameter == 0
  1962 		return EAP_STATUS_RETURN(m_am_tools, status);
  2259 			|| new_receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1963 	}
  2260 		{
  1964 
  2261 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1965 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2262 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2263 		}
       
  2264 
       
  2265 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2266 
       
  2267 		if (message_data.get_is_valid() == false)
       
  2268 		{
       
  2269 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2270 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2271 		}
       
  2272 
       
  2273 		status = message_data.get_parameter_data(new_receive_network_id_parameter, &new_receive_network_id);
       
  2274 		if (status != eap_status_ok)
       
  2275 		{
       
  2276 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2277 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2278 		}
       
  2279 	}
       
  2280 
       
  2281 
  1966 
  2282 	++parameter_index;
  1967 	++parameter_index;
  2283 
  1968 
  2284 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1969 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  2285 
  1970 
  2286 	{
  1971 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  2287 		const eap_tlv_header_c * const authentication_type
  1972 	if (status != eap_status_ok)
  2288 			= parameters->get_object(parameter_index);
  1973 	{
  2289 
  1974 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2290 		if (authentication_type == 0
  1975 		return EAP_STATUS_RETURN(m_am_tools, status);
  2291 			|| authentication_type->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1976 	}
  2292 		{
       
  2293 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2294 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2295 		}
       
  2296 
       
  2297 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2298 
       
  2299 		if (message_data.get_is_valid() == false)
       
  2300 		{
       
  2301 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2302 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2303 		}
       
  2304 
       
  2305 		u32_t value(0ul);
       
  2306 
       
  2307 		status = message_data.get_parameter_data(authentication_type, &value);
       
  2308 		if (status != eap_status_ok)
       
  2309 		{
       
  2310 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2311 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2312 		}
       
  2313 
       
  2314 		selected_eapol_key_authentication_type = static_cast<eapol_key_authentication_type_e>(value);
       
  2315 	}
       
  2316 
       
  2317 
  1977 
  2318 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1978 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2319 
  1979 
  2320 	status = m_wauth->start_reassociation(
  1980 	status = m_wauth->start_reassociation(
  2321 		&old_receive_network_id,
  1981 		&old_receive_network_id,
  2337 
  1997 
  2338 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1998 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2339 
  1999 
  2340 	eap_status_e status(eap_status_ok);
  2000 	eap_status_e status(eap_status_ok);
  2341 
  2001 
  2342 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2002 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2003 
       
  2004 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2005 
       
  2006 	if (message_data.get_is_valid() == false)
       
  2007 	{
       
  2008 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2009 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2010 	}
       
  2011 
       
  2012 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2343 
  2013 
  2344 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  2014 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  2345 
  2015 
  2346 	{
  2016 	status = message_data.read_parameter_data(parameters, parameter_index, &association_result);
  2347 		const eap_tlv_header_c * const association_result_parameter
  2017 	if (status != eap_status_ok)
  2348 			= parameters->get_object(parameter_index);
  2018 	{
  2349 
  2019 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2350 		if (association_result_parameter == 0
  2020 		return EAP_STATUS_RETURN(m_am_tools, status);
  2351 			|| association_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  2021 	}
  2352 		{
  2022 
  2353 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2023 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2354 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2355 		}
       
  2356 
       
  2357 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2358 
       
  2359 		if (message_data.get_is_valid() == false)
       
  2360 		{
       
  2361 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2362 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2363 		}
       
  2364 
       
  2365 		u32_t value(0ul);
       
  2366 
       
  2367 		status = message_data.get_parameter_data(association_result_parameter, &value);
       
  2368 		if (status != eap_status_ok)
       
  2369 		{
       
  2370 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2371 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2372 		}
       
  2373 
       
  2374 		association_result = static_cast<eapol_wlan_authentication_state_e>(value);
       
  2375 	}
       
  2376 
       
  2377 
  2024 
  2378 	++parameter_index;
  2025 	++parameter_index;
  2379 
  2026 
  2380 	eap_am_network_id_c receive_network_id(m_am_tools);
  2027 	eap_am_network_id_c receive_network_id(m_am_tools);
  2381 
  2028 
  2382 	{
  2029 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2383 		const eap_tlv_header_c * const receive_network_id_parameter
  2030 	if (status != eap_status_ok)
  2384 			= parameters->get_object(parameter_index);
  2031 	{
  2385 
  2032 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2386 		if (receive_network_id_parameter == 0
  2033 		return EAP_STATUS_RETURN(m_am_tools, status);
  2387 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2034 	}
  2388 		{
  2035 
  2389 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2036 
  2390 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2037 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2391 		}
       
  2392 
       
  2393 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2394 
       
  2395 		if (message_data.get_is_valid() == false)
       
  2396 		{
       
  2397 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2398 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2399 		}
       
  2400 
       
  2401 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  2402 		if (status != eap_status_ok)
       
  2403 		{
       
  2404 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2405 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2406 		}
       
  2407 	}
       
  2408 
       
  2409 
  2038 
  2410 	++parameter_index;
  2039 	++parameter_index;
  2411 
  2040 
  2412 	eap_variable_data_c received_WPA_IE(m_am_tools);
  2041 	eap_variable_data_c received_WPA_IE(m_am_tools);
  2413 
  2042 
  2414 	{
  2043 	status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_IE);
  2415 		const eap_tlv_header_c * const received_WPA_IE_parameter
  2044 	if (status != eap_status_ok)
  2416 			= parameters->get_object(parameter_index);
  2045 	{
  2417 
  2046 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2418 		if (received_WPA_IE_parameter == 0
  2047 		return EAP_STATUS_RETURN(m_am_tools, status);
  2419 			|| received_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2048 	}
  2420 		{
  2049 
  2421 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2050 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2422 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2423 		}
       
  2424 
       
  2425 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2426 
       
  2427 		if (message_data.get_is_valid() == false)
       
  2428 		{
       
  2429 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2430 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2431 		}
       
  2432 
       
  2433 		status = message_data.get_parameter_data(received_WPA_IE_parameter, &received_WPA_IE);
       
  2434 		if (status != eap_status_ok)
       
  2435 		{
       
  2436 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2437 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2438 		}
       
  2439 	}
       
  2440 
       
  2441 
  2051 
  2442 	++parameter_index;
  2052 	++parameter_index;
  2443 
  2053 
  2444 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  2054 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  2445 
  2055 
  2446 	{
  2056 	status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_IE);
  2447 		const eap_tlv_header_c * const sent_WPA_IE_parameter
  2057 	if (status != eap_status_ok)
  2448 			= parameters->get_object(parameter_index);
  2058 	{
  2449 
  2059 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2450 		if (sent_WPA_IE_parameter == 0
  2060 		return EAP_STATUS_RETURN(m_am_tools, status);
  2451 			|| sent_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2061 	}
  2452 		{
  2062 
  2453 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2063 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2454 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2455 		}
       
  2456 
       
  2457 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2458 
       
  2459 		if (message_data.get_is_valid() == false)
       
  2460 		{
       
  2461 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2462 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2463 		}
       
  2464 
       
  2465 		status = message_data.get_parameter_data(sent_WPA_IE_parameter, &sent_WPA_IE);
       
  2466 		if (status != eap_status_ok)
       
  2467 		{
       
  2468 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2469 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2470 		}
       
  2471 	}
       
  2472 
       
  2473 
  2064 
  2474 	++parameter_index;
  2065 	++parameter_index;
  2475 
  2066 
  2476 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2067 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2477 
  2068 
  2478 	{
  2069 	status = message_data.read_parameter_data(parameters, parameter_index, &pairwise_key_cipher_suite);
  2479 		const eap_tlv_header_c * const pairwise_key_cipher_suite_parameter
  2070 	if (status != eap_status_ok)
  2480 			= parameters->get_object(parameter_index);
  2071 	{
  2481 
  2072 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2482 		if (pairwise_key_cipher_suite_parameter == 0
  2073 		return EAP_STATUS_RETURN(m_am_tools, status);
  2483 			|| pairwise_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
  2074 	}
  2484 		{
  2075 
  2485 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2076 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2486 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2487 		}
       
  2488 
       
  2489 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2490 
       
  2491 		if (message_data.get_is_valid() == false)
       
  2492 		{
       
  2493 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2494 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2495 		}
       
  2496 
       
  2497 		u32_t value(0ul);
       
  2498 
       
  2499 		status = message_data.get_parameter_data(pairwise_key_cipher_suite_parameter, &value);
       
  2500 		if (status != eap_status_ok)
       
  2501 		{
       
  2502 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2503 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2504 		}
       
  2505 
       
  2506 		pairwise_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  2507 	}
       
  2508 
  2077 
  2509 	++parameter_index;
  2078 	++parameter_index;
  2510 
  2079 
  2511 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2080 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2512 
  2081 
  2513 	{
  2082 	status = message_data.read_parameter_data(parameters, parameter_index, &group_key_cipher_suite);
  2514 		const eap_tlv_header_c * const group_key_cipher_suite_parameter
  2083 	if (status != eap_status_ok)
  2515 			= parameters->get_object(parameter_index);
  2084 	{
  2516 
  2085 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2517 		if (group_key_cipher_suite_parameter == 0
  2086 		return EAP_STATUS_RETURN(m_am_tools, status);
  2518 			|| group_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
       
  2519 		{
       
  2520 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2521 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2522 		}
       
  2523 
       
  2524 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2525 
       
  2526 		if (message_data.get_is_valid() == false)
       
  2527 		{
       
  2528 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2529 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2530 		}
       
  2531 
       
  2532 		u32_t value(0ul);
       
  2533 
       
  2534 		status = message_data.get_parameter_data(group_key_cipher_suite_parameter, &value);
       
  2535 		if (status != eap_status_ok)
       
  2536 		{
       
  2537 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2538 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2539 		}
       
  2540 
       
  2541 		group_key_cipher_suite = static_cast<eapol_RSNA_key_header_c::eapol_RSNA_cipher_e>(value);
       
  2542 	}
  2087 	}
  2543 
  2088 
  2544 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2089 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2545 
  2090 
  2546 	status = m_wauth->complete_reassociation(
  2091 	status = m_wauth->complete_reassociation(
  2567 
  2112 
  2568 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2113 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2569 
  2114 
  2570 	eap_status_e status(eap_status_ok);
  2115 	eap_status_e status(eap_status_ok);
  2571 
  2116 
  2572 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2117 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2118 
       
  2119 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2120 
       
  2121 	if (message_data.get_is_valid() == false)
       
  2122 	{
       
  2123 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2124 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2125 	}
       
  2126 
       
  2127 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2573 
  2128 
  2574 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2129 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2575 
  2130 
  2576 	{
  2131 	status = message_data.read_parameter_data(parameters, parameter_index, &old_receive_network_id);
  2577 		const eap_tlv_header_c * const receive_network_id_parameter
  2132 	if (status != eap_status_ok)
  2578 			= parameters->get_object(parameter_index);
  2133 	{
  2579 
  2134 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2580 		if (receive_network_id_parameter == 0
  2135 		return EAP_STATUS_RETURN(m_am_tools, status);
  2581 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
       
  2582 		{
       
  2583 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2584 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2585 		}
       
  2586 
       
  2587 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2588 
       
  2589 		if (message_data.get_is_valid() == false)
       
  2590 		{
       
  2591 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2592 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2593 		}
       
  2594 
       
  2595 		status = message_data.get_parameter_data(receive_network_id_parameter, &old_receive_network_id);
       
  2596 		if (status != eap_status_ok)
       
  2597 		{
       
  2598 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2599 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2600 		}
       
  2601 	}
  2136 	}
  2602 
  2137 
  2603 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2138 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2604 
  2139 
  2605 	++parameter_index;
  2140 	++parameter_index;
  2606 
  2141 
  2607 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2142 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2608 
  2143 
  2609 	{
  2144 	status = message_data.read_parameter_data(parameters, parameter_index, &new_receive_network_id);
  2610 		const eap_tlv_header_c * const receive_network_id_parameter
  2145 	if (status != eap_status_ok)
  2611 			= parameters->get_object(parameter_index);
  2146 	{
  2612 
  2147 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2613 		if (receive_network_id_parameter == 0
  2148 		return EAP_STATUS_RETURN(m_am_tools, status);
  2614 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2149 	}
  2615 		{
  2150 
  2616 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2151 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2617 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2618 		}
       
  2619 
       
  2620 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2621 
       
  2622 		if (message_data.get_is_valid() == false)
       
  2623 		{
       
  2624 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2625 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2626 		}
       
  2627 
       
  2628 		status = message_data.get_parameter_data(receive_network_id_parameter, &new_receive_network_id);
       
  2629 		if (status != eap_status_ok)
       
  2630 		{
       
  2631 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2632 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2633 		}
       
  2634 	}
       
  2635 
       
  2636 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
  2637 
       
  2638 
  2152 
  2639 	++parameter_index;
  2153 	++parameter_index;
  2640 
  2154 
  2641 	eap_variable_data_c send_reassociation_request_ie(m_am_tools);
  2155 	eap_variable_data_c send_reassociation_request_ie(m_am_tools);
  2642 
  2156 
  2643 	{
  2157 	status = message_data.read_parameter_data(parameters, parameter_index, &send_reassociation_request_ie);
  2644 		const eap_tlv_header_c * const send_reassociation_request_ie_parameter
  2158 	if (status != eap_status_ok)
  2645 			= parameters->get_object(parameter_index);
  2159 	{
  2646 
  2160 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2647 		if (send_reassociation_request_ie_parameter == 0
  2161 		return EAP_STATUS_RETURN(m_am_tools, status);
  2648 			|| send_reassociation_request_ie_parameter->get_type() != eapol_tlv_message_type_variable_data)
       
  2649 		{
       
  2650 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2651 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2652 		}
       
  2653 
       
  2654 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2655 
       
  2656 		if (message_data.get_is_valid() == false)
       
  2657 		{
       
  2658 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2659 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2660 		}
       
  2661 
       
  2662 		status = message_data.get_parameter_data(send_reassociation_request_ie_parameter, &send_reassociation_request_ie);
       
  2663 		if (status != eap_status_ok)
       
  2664 		{
       
  2665 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2666 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2667 		}
       
  2668 	}
  2162 	}
  2669 
  2163 
  2670 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2164 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2671 
  2165 
  2672 	++parameter_index;
  2166 	++parameter_index;
  2673 
  2167 
  2674 	eap_variable_data_c received_WPA_ie(m_am_tools);
  2168 	eap_variable_data_c received_WPA_ie(m_am_tools);
  2675 
  2169 
  2676 	if (parameters->get_object_count() > parameter_index)
  2170 	if (parameters->get_object_count() > parameter_index)
  2677 	{
  2171 	{
  2678 		const eap_tlv_header_c * const send_reassociation_request_ie_parameter
  2172 		status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_ie);
  2679 			= parameters->get_object(parameter_index);
  2173 		if (status != eap_status_ok)
  2680 
  2174 		{
  2681 		if (send_reassociation_request_ie_parameter != 0
  2175 			// This is optional parameter.
  2682 			&& send_reassociation_request_ie_parameter->get_type() == eapol_tlv_message_type_variable_data)
  2176 			(void) EAP_STATUS_RETURN(m_am_tools, status);
  2683 		{
       
  2684 			eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2685 
       
  2686 			if (message_data.get_is_valid() == false)
       
  2687 			{
       
  2688 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2689 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2690 			}
       
  2691 
       
  2692 			status = message_data.get_parameter_data(send_reassociation_request_ie_parameter, &received_WPA_ie);
       
  2693 			if (status != eap_status_ok)
       
  2694 			{
       
  2695 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2696 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  2697 			}
       
  2698 		}
  2177 		}
  2699 	}
  2178 	}
  2700 
  2179 
  2701 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2180 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2702 
  2181 
  2704 
  2183 
  2705 	eap_variable_data_c sent_WPA_ie(m_am_tools);
  2184 	eap_variable_data_c sent_WPA_ie(m_am_tools);
  2706 
  2185 
  2707 	if (parameters->get_object_count() > parameter_index)
  2186 	if (parameters->get_object_count() > parameter_index)
  2708 	{
  2187 	{
  2709 		const eap_tlv_header_c * const send_reassociation_request_ie_parameter
  2188 		status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_ie);
  2710 			= parameters->get_object(parameter_index);
  2189 		if (status != eap_status_ok)
  2711 
  2190 		{
  2712 		if (send_reassociation_request_ie_parameter != 0
  2191 			// This is optional parameter.
  2713 			&& send_reassociation_request_ie_parameter->get_type() == eapol_tlv_message_type_variable_data)
  2192 			(void) EAP_STATUS_RETURN(m_am_tools, status);
  2714 		{
       
  2715 			eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2716 
       
  2717 			if (message_data.get_is_valid() == false)
       
  2718 			{
       
  2719 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2720 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2721 			}
       
  2722 
       
  2723 			status = message_data.get_parameter_data(send_reassociation_request_ie_parameter, &sent_WPA_ie);
       
  2724 			if (status != eap_status_ok)
       
  2725 			{
       
  2726 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2727 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  2728 			}
       
  2729 		}
  2193 		}
  2730 	}
  2194 	}
  2731 
  2195 
  2732 
  2196 
  2733 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2197 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2750 		{
  2214 		{
  2751 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2215 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2752 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2216 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2753 		}
  2217 		}
  2754 
  2218 
  2755 		status = message.add_parameter_data(eapol_tlv_message_type_function_complete_start_WPXM_reassociation);
  2219 		status = message.add_parameter_data(eap_tlv_message_type_function_complete_start_WPXM_reassociation);
  2756 		if (status != eap_status_ok)
  2220 		if (status != eap_status_ok)
  2757 		{
  2221 		{
  2758 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2222 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2759 			return EAP_STATUS_RETURN(m_am_tools, status);
  2223 			return EAP_STATUS_RETURN(m_am_tools, status);
  2760 		}
  2224 		}
  2796 
  2260 
  2797 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2261 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2798 
  2262 
  2799 	eap_status_e status(eap_status_ok);
  2263 	eap_status_e status(eap_status_ok);
  2800 
  2264 
  2801 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2265 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2266 
       
  2267 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2268 
       
  2269 	if (message_data.get_is_valid() == false)
       
  2270 	{
       
  2271 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2272 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2273 	}
       
  2274 
       
  2275 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2802 
  2276 
  2803 	eapol_wlan_authentication_state_e reassociation_result(eapol_wlan_authentication_state_none);
  2277 	eapol_wlan_authentication_state_e reassociation_result(eapol_wlan_authentication_state_none);
  2804 
  2278 
  2805 	{
  2279 	status = message_data.read_parameter_data(parameters, parameter_index, &reassociation_result);
  2806 		const eap_tlv_header_c * const reassociation_result_parameter
  2280 	if (status != eap_status_ok)
  2807 			= parameters->get_object(parameter_index);
  2281 	{
  2808 
  2282 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2809 		if (reassociation_result_parameter == 0
  2283 		return EAP_STATUS_RETURN(m_am_tools, status);
  2810 			|| reassociation_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  2284 	}
  2811 		{
  2285 
  2812 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2286 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2813 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2814 		}
       
  2815 
       
  2816 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2817 
       
  2818 		if (message_data.get_is_valid() == false)
       
  2819 		{
       
  2820 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2821 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2822 		}
       
  2823 
       
  2824 		u32_t value(0ul);
       
  2825 
       
  2826 		status = message_data.get_parameter_data(reassociation_result_parameter, &value);
       
  2827 		if (status != eap_status_ok)
       
  2828 		{
       
  2829 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2830 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2831 		}
       
  2832 
       
  2833 		reassociation_result = static_cast<eapol_wlan_authentication_state_e>(value);
       
  2834 	}
       
  2835 
       
  2836 
  2287 
  2837 	++parameter_index;
  2288 	++parameter_index;
  2838 
  2289 
  2839 	eap_am_network_id_c receive_network_id(m_am_tools);
  2290 	eap_am_network_id_c receive_network_id(m_am_tools);
  2840 
  2291 
  2841 	{
  2292 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2842 		const eap_tlv_header_c * const receive_network_id_parameter
  2293 	if (status != eap_status_ok)
  2843 			= parameters->get_object(parameter_index);
  2294 	{
  2844 
  2295 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2845 		if (receive_network_id_parameter == 0
  2296 		return EAP_STATUS_RETURN(m_am_tools, status);
  2846 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2297 	}
  2847 		{
  2298 
  2848 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2299 
  2849 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2300 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2850 		}
       
  2851 
       
  2852 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2853 
       
  2854 		if (message_data.get_is_valid() == false)
       
  2855 		{
       
  2856 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2857 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2858 		}
       
  2859 
       
  2860 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  2861 		if (status != eap_status_ok)
       
  2862 		{
       
  2863 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2864 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2865 		}
       
  2866 	}
       
  2867 
       
  2868 
  2301 
  2869 	++parameter_index;
  2302 	++parameter_index;
  2870 
  2303 
  2871 	eap_variable_data_c received_reassociation_ie(m_am_tools);
  2304 	eap_variable_data_c received_reassociation_ie(m_am_tools);
  2872 
  2305 
  2873 	{
  2306 	status = message_data.read_parameter_data(parameters, parameter_index, &received_reassociation_ie);
  2874 		const eap_tlv_header_c * const received_reassociation_ie_parameter
  2307 	if (status != eap_status_ok)
  2875 			= parameters->get_object(parameter_index);
  2308 	{
  2876 
  2309 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2877 		if (received_reassociation_ie_parameter == 0
  2310 		return EAP_STATUS_RETURN(m_am_tools, status);
  2878 			|| received_reassociation_ie_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2311 	}
  2879 		{
       
  2880 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2881 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2882 		}
       
  2883 
       
  2884 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2885 
       
  2886 		if (message_data.get_is_valid() == false)
       
  2887 		{
       
  2888 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2889 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2890 		}
       
  2891 
       
  2892 		status = message_data.get_parameter_data(received_reassociation_ie_parameter, &received_reassociation_ie);
       
  2893 		if (status != eap_status_ok)
       
  2894 		{
       
  2895 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2896 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2897 		}
       
  2898 	}
       
  2899 
       
  2900 
  2312 
  2901 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2313 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2902 
  2314 
  2903 	status = m_wauth->complete_WPXM_reassociation(
  2315 	status = m_wauth->complete_WPXM_reassociation(
  2904 		reassociation_result,
  2316 		reassociation_result,
  2920 
  2332 
  2921 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2333 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2922 
  2334 
  2923 	eap_status_e status(eap_status_ok);
  2335 	eap_status_e status(eap_status_ok);
  2924 
  2336 
  2925 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2337 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2338 
       
  2339 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2340 
       
  2341 	if (message_data.get_is_valid() == false)
       
  2342 	{
       
  2343 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2344 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2345 	}
       
  2346 
       
  2347 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2926 
  2348 
  2927 	eap_am_network_id_c receive_network_id(m_am_tools);
  2349 	eap_am_network_id_c receive_network_id(m_am_tools);
  2928 
  2350 
  2929 	{
  2351 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2930 		const eap_tlv_header_c * const receive_network_id_parameter
  2352 	if (status != eap_status_ok)
  2931 			= parameters->get_object(parameter_index);
  2353 	{
  2932 
  2354 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2933 		if (receive_network_id_parameter == 0
  2355 		return EAP_STATUS_RETURN(m_am_tools, status);
  2934 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2356 	}
  2935 		{
  2357 
  2936 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2358 
  2937 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2359 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2938 		}
       
  2939 
       
  2940 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2941 
       
  2942 		if (message_data.get_is_valid() == false)
       
  2943 		{
       
  2944 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2945 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2946 		}
       
  2947 
       
  2948 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  2949 		if (status != eap_status_ok)
       
  2950 		{
       
  2951 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2952 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2953 		}
       
  2954 	}
       
  2955 
       
  2956 
  2360 
  2957 	++parameter_index;
  2361 	++parameter_index;
  2958 
  2362 
  2959 	eap_variable_data_c packet_data_payload(m_am_tools);
  2363 	eap_variable_data_c packet_data_payload(m_am_tools);
  2960 
  2364 
  2961 	{
  2365 	status = message_data.read_parameter_data(parameters, parameter_index, &packet_data_payload);
  2962 		const eap_tlv_header_c * const packet_data_parameter
  2366 	if (status != eap_status_ok)
  2963 			= parameters->get_object(parameter_index);
  2367 	{
  2964 
  2368 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2965 		if (packet_data_parameter == 0
  2369 		return EAP_STATUS_RETURN(m_am_tools, status);
  2966 			|| packet_data_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2370 	}
  2967 		{
       
  2968 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2969 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  2970 		}
       
  2971 
       
  2972 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2973 
       
  2974 		if (message_data.get_is_valid() == false)
       
  2975 		{
       
  2976 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2977 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2978 		}
       
  2979 
       
  2980 		status = message_data.get_parameter_data(packet_data_parameter, &packet_data_payload);
       
  2981 		if (status != eap_status_ok)
       
  2982 		{
       
  2983 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2984 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2985 		}
       
  2986 	}
       
  2987 
       
  2988 
  2371 
  2989 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2372 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2990 
  2373 
  2991 	eapol_ethernet_header_wr_c eth(
  2374 	eapol_ethernet_header_wr_c eth(
  2992 		m_am_tools,
  2375 		m_am_tools,
  3019 
  2402 
  3020 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2403 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3021 
  2404 
  3022 	eap_status_e status(eap_status_ok);
  2405 	eap_status_e status(eap_status_ok);
  3023 
  2406 
  3024 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2407 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2408 
       
  2409 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2410 
       
  2411 	if (message_data.get_is_valid() == false)
       
  2412 	{
       
  2413 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2414 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2415 	}
       
  2416 
       
  2417 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3025 
  2418 
  3026 	eap_am_network_id_c receive_network_id(m_am_tools);
  2419 	eap_am_network_id_c receive_network_id(m_am_tools);
  3027 
  2420 
  3028 	{
  2421 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  3029 		const eap_tlv_header_c * const receive_network_id_parameter
  2422 	if (status != eap_status_ok)
  3030 			= parameters->get_object(parameter_index);
  2423 	{
  3031 
  2424 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3032 		if (receive_network_id_parameter == 0
  2425 		return EAP_STATUS_RETURN(m_am_tools, status);
  3033 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2426 	}
  3034 		{
  2427 
  3035 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2428 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3036 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3037 		}
       
  3038 
       
  3039 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3040 
       
  3041 		if (message_data.get_is_valid() == false)
       
  3042 		{
       
  3043 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3044 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3045 		}
       
  3046 
       
  3047 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  3048 		if (status != eap_status_ok)
       
  3049 		{
       
  3050 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3051 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3052 		}
       
  3053 	}
       
  3054 
  2429 
  3055 	++parameter_index;
  2430 	++parameter_index;
  3056 
  2431 
  3057 	bool fatal_failure_when_true(false);
  2432 	bool fatal_failure_when_true(false);
  3058 
  2433 
  3059 	{
  2434 	status = message_data.read_parameter_data(parameters, parameter_index, &fatal_failure_when_true);
  3060 		const eap_tlv_header_c * const fatal_failure_when_true_parameter
  2435 	if (status != eap_status_ok)
  3061 			= parameters->get_object(parameter_index);
  2436 	{
  3062 
  2437 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3063 		if (fatal_failure_when_true_parameter == 0
  2438 		return EAP_STATUS_RETURN(m_am_tools, status);
  3064 			|| fatal_failure_when_true_parameter->get_type() != eapol_tlv_message_type_boolean)
  2439 	}
  3065 		{
  2440 
  3066 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2441 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3067 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3068 		}
       
  3069 
       
  3070 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3071 
       
  3072 		if (message_data.get_is_valid() == false)
       
  3073 		{
       
  3074 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3075 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3076 		}
       
  3077 
       
  3078 		u32_t value(0ul);
       
  3079 
       
  3080 		status = message_data.get_parameter_data(fatal_failure_when_true_parameter, &value);
       
  3081 		if (status != eap_status_ok)
       
  3082 		{
       
  3083 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3084 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3085 		}
       
  3086 
       
  3087 		fatal_failure_when_true = (value == 0) ? false: true;
       
  3088 	}
       
  3089 
       
  3090 
  2442 
  3091 	++parameter_index;
  2443 	++parameter_index;
  3092 
  2444 
  3093 	eapol_RSNA_key_header_c::eapol_tkip_mic_failure_type_e tkip_mic_failure_type(eapol_RSNA_key_header_c::eapol_tkip_mic_failure_type_group_key);
  2445 	eapol_RSNA_key_header_c::eapol_tkip_mic_failure_type_e tkip_mic_failure_type(eapol_RSNA_key_header_c::eapol_tkip_mic_failure_type_group_key);
  3094 
  2446 
  3095 	{
  2447 	status = message_data.read_parameter_data(parameters, parameter_index, &tkip_mic_failure_type);
  3096 		const eap_tlv_header_c * const tkip_mic_failure_type_parameter
  2448 	if (status != eap_status_ok)
  3097 			= parameters->get_object(parameter_index);
  2449 	{
  3098 
  2450 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3099 		if (tkip_mic_failure_type_parameter == 0
  2451 		return EAP_STATUS_RETURN(m_am_tools, status);
  3100 			|| tkip_mic_failure_type_parameter->get_type() != eapol_tlv_message_type_eapol_tkip_mic_failure_type)
       
  3101 		{
       
  3102 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3103 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3104 		}
       
  3105 
       
  3106 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3107 
       
  3108 		if (message_data.get_is_valid() == false)
       
  3109 		{
       
  3110 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3111 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3112 		}
       
  3113 
       
  3114 		u32_t value(0ul);
       
  3115 
       
  3116 		status = message_data.get_parameter_data(tkip_mic_failure_type_parameter, &value);
       
  3117 		if (status != eap_status_ok)
       
  3118 		{
       
  3119 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3120 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3121 		}
       
  3122 
       
  3123 		tkip_mic_failure_type = static_cast<eapol_RSNA_key_header_c::eapol_tkip_mic_failure_type_e>(value);
       
  3124 	}
  2452 	}
  3125 
  2453 
  3126 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2454 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3127 
  2455 
  3128 	status = m_wauth->tkip_mic_failure(
  2456 	status = m_wauth->tkip_mic_failure(
  3146 
  2474 
  3147 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2475 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3148 
  2476 
  3149 	eap_status_e status(eap_status_ok);
  2477 	eap_status_e status(eap_status_ok);
  3150 
  2478 
  3151 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2479 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2480 
       
  2481 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2482 
       
  2483 	if (message_data.get_is_valid() == false)
       
  2484 	{
       
  2485 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2486 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2487 	}
       
  2488 
       
  2489 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3152 
  2490 
  3153 	eap_am_network_id_c receive_network_id(m_am_tools);
  2491 	eap_am_network_id_c receive_network_id(m_am_tools);
  3154 
  2492 
  3155 	{
  2493 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  3156 		const eap_tlv_header_c * const receive_network_id_parameter
  2494 	if (status != eap_status_ok)
  3157 			= parameters->get_object(parameter_index);
  2495 	{
  3158 
  2496 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3159 		if (receive_network_id_parameter == 0
  2497 		return EAP_STATUS_RETURN(m_am_tools, status);
  3160 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
       
  3161 		{
       
  3162 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3163 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3164 		}
       
  3165 
       
  3166 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3167 
       
  3168 		if (message_data.get_is_valid() == false)
       
  3169 		{
       
  3170 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3171 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3172 		}
       
  3173 
       
  3174 		status = message_data.get_parameter_data(receive_network_id_parameter, &receive_network_id);
       
  3175 		if (status != eap_status_ok)
       
  3176 		{
       
  3177 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3178 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3179 		}
       
  3180 	}
  2498 	}
  3181 
  2499 
  3182 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2500 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3183 
  2501 
  3184 	status = m_wauth->eap_acknowledge(
  2502 	status = m_wauth->eap_acknowledge(
  3200 
  2518 
  3201 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2519 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3202 
  2520 
  3203 	eap_status_e status(eap_status_ok);
  2521 	eap_status_e status(eap_status_ok);
  3204 
  2522 
  3205 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2523 	u32_t parameter_index(eap_message_payload_index_first_parameter);
  3206 
  2524 
  3207 	{
  2525 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
  3208 		const eap_tlv_header_c * const header_offset_value_parameter
  2526 
  3209 			= parameters->get_object(parameter_index);
  2527 	if (message_data.get_is_valid() == false)
  3210 
  2528 	{
  3211 		if (header_offset_value_parameter == 0
  2529 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3212 			|| header_offset_value_parameter->get_type() != eapol_tlv_message_type_u32_t)
  2530 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  3213 		{
  2531 	}
  3214 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2532 
  3215 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2533 	status = message_data.read_parameter_data(parameters, parameter_index, &m_header_offset);
  3216 		}
  2534 	if (status != eap_status_ok)
  3217 
  2535 	{
  3218 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
  2536 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3219 
  2537 		return EAP_STATUS_RETURN(m_am_tools, status);
  3220 		if (message_data.get_is_valid() == false)
  2538 	}
  3221 		{
  2539 
  3222 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2540 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3223 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2541 
  3224 		}
  2542 	++parameter_index;
  3225 
  2543 
  3226 		status = message_data.get_parameter_data(header_offset_value_parameter, &m_header_offset);
  2544 	status = message_data.read_parameter_data(parameters, parameter_index, &m_MTU);
  3227 		if (status != eap_status_ok)
  2545 	if (status != eap_status_ok)
  3228 		{
  2546 	{
  3229 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2547 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3230 			return EAP_STATUS_RETURN(m_am_tools, status);
  2548 		return EAP_STATUS_RETURN(m_am_tools, status);
  3231 		}
  2549 	}
  3232 	}
  2550 
  3233 
  2551 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3234 
  2552 
  3235 	++parameter_index;
  2553 	++parameter_index;
  3236 
  2554 
  3237 	{
  2555 	status = message_data.read_parameter_data(parameters, parameter_index, &m_trailer_length);
  3238 		const eap_tlv_header_c * const MTU_value_parameter
  2556 	if (status != eap_status_ok)
  3239 			= parameters->get_object(parameter_index);
  2557 	{
  3240 
  2558 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3241 		if (MTU_value_parameter == 0
  2559 		return EAP_STATUS_RETURN(m_am_tools, status);
  3242 			|| MTU_value_parameter->get_type() != eapol_tlv_message_type_u32_t)
       
  3243 		{
       
  3244 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3245 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3246 		}
       
  3247 
       
  3248 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3249 
       
  3250 		if (message_data.get_is_valid() == false)
       
  3251 		{
       
  3252 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3253 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3254 		}
       
  3255 
       
  3256 		status = message_data.get_parameter_data(MTU_value_parameter, &m_MTU);
       
  3257 		if (status != eap_status_ok)
       
  3258 		{
       
  3259 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3260 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3261 		}
       
  3262 	}
       
  3263 
       
  3264 
       
  3265 	++parameter_index;
       
  3266 
       
  3267 	{
       
  3268 		const eap_tlv_header_c * const trailer_length_parameter
       
  3269 			= parameters->get_object(parameter_index);
       
  3270 
       
  3271 		if (trailer_length_parameter == 0
       
  3272 			|| trailer_length_parameter->get_type() != eapol_tlv_message_type_u32_t)
       
  3273 		{
       
  3274 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3275 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  3276 		}
       
  3277 
       
  3278 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  3279 
       
  3280 		if (message_data.get_is_valid() == false)
       
  3281 		{
       
  3282 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3283 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  3284 		}
       
  3285 
       
  3286 		status = message_data.get_parameter_data(trailer_length_parameter, &m_trailer_length);
       
  3287 		if (status != eap_status_ok)
       
  3288 		{
       
  3289 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3290 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3291 		}
       
  3292 	}
  2560 	}
  3293 
  2561 
  3294 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2562 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3295 
  2563 
  3296 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2564 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3306 
  2574 
  3307 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2575 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3308 
  2576 
  3309 	eap_status_e status(eap_status_ok);
  2577 	eap_status_e status(eap_status_ok);
  3310 
  2578 
  3311 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2579 	u32_t parameter_index(eap_message_payload_index_first_parameter);
  3312 
  2580 
  3313 	{
  2581 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
  3314 		const eap_tlv_header_c * const reference_parameter
  2582 
  3315 			= parameters->get_object(parameter_index);
  2583 	if (message_data.get_is_valid() == false)
  3316 
  2584 	{
  3317 		if (reference_parameter == 0
  2585 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3318 			|| reference_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2586 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  3319 		{
  2587 	}
  3320 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2588 
  3321 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2589 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3322 		}
  2590 
  3323 
  2591 	status = message_data.read_parameter_data(parameters, parameter_index, &m_wlan_database_reference);
  3324 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
  2592 	if (status != eap_status_ok)
  3325 
  2593 	{
  3326 		if (message_data.get_is_valid() == false)
  2594 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3327 		{
  2595 		return EAP_STATUS_RETURN(m_am_tools, status);
  3328 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2596 	}
  3329 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2597 
  3330 		}
  2598 	status = m_wauth->set_eap_database_reference_values(&m_wlan_database_reference);
  3331 
  2599 	if (status != eap_status_ok)
  3332 		status = message_data.get_parameter_data(reference_parameter, &m_wlan_database_reference);
  2600 	{
  3333 		if (status != eap_status_ok)
  2601 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3334 		{
  2602 		return EAP_STATUS_RETURN(m_am_tools, status);
  3335 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3336 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  3337 		}
       
  3338 	}
  2603 	}
  3339 
  2604 
  3340 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2605 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3341 
  2606 
  3342 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2607 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);