eapol/eapol_framework/eapol_common/core/eapol_message_wlan_authentication.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
    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: 62 %
    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 }
  1027 //--------------------------------------------------
  1101 //--------------------------------------------------
  1028 
  1102 
  1029 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::send_message(eapol_handle_tlv_message_data_c * const message)
  1103 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::send_message(eapol_handle_tlv_message_data_c * const message)
  1030 {
  1104 {
  1031 	// Sends message data composed of Attribute-Value Pairs.
  1105 	// Sends message data composed of Attribute-Value Pairs.
       
  1106 
       
  1107 	EAP_TRACE_DEBUG(
       
  1108 		m_am_tools, 
       
  1109 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
  1110 		(EAPL("TIMER: eapol_message_wlan_authentication_c::send_message()\n")));
       
  1111 
       
  1112 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::send_message()");
  1032 
  1113 
  1033 	EAP_TRACE_DATA_DEBUG(
  1114 	EAP_TRACE_DATA_DEBUG(
  1034 		m_am_tools,
  1115 		m_am_tools,
  1035 		EAP_TRACE_FLAGS_MESSAGE_DATA,
  1116 		EAP_TRACE_FLAGS_NEVER,
  1036 		(EAPL("eapol_message_wlan_authentication_c::send_message()"),
  1117 		(EAPL("eapol_message_wlan_authentication_c::send_message()"),
  1037 		message->get_message_data(),
  1118 		message->get_message_data(),
  1038 		message->get_message_data_length()));
  1119 		message->get_message_data_length()));
  1039 
  1120 
  1040 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1121 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1054 
  1135 
  1055 			status = eap_status_allocation_error;
  1136 			status = eap_status_allocation_error;
  1056 
  1137 
  1057 			(void) send_error_message(
  1138 			(void) send_error_message(
  1058 				status,
  1139 				status,
  1059 				eapol_tlv_message_type_function_none);
  1140 				eap_tlv_message_type_function_none);
  1060 
  1141 
  1061 			return EAP_STATUS_RETURN(m_am_tools, status);
  1142 			return EAP_STATUS_RETURN(m_am_tools, status);
  1062 		}
  1143 		}
  1063 
  1144 
  1064 		status = copy_message->copy_message_data(
  1145 		status = copy_message->copy_message_data(
  1068 		{
  1149 		{
  1069 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1150 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1070 
  1151 
  1071 			(void) send_error_message(
  1152 			(void) send_error_message(
  1072 				status,
  1153 				status,
  1073 				eapol_tlv_message_type_function_none);
  1154 				eap_tlv_message_type_function_none);
  1074 
  1155 
  1075 			return EAP_STATUS_RETURN(m_am_tools, status);
  1156 			return EAP_STATUS_RETURN(m_am_tools, status);
  1076 		}
  1157 		}
  1077 
  1158 
  1078 		automatic_message.do_not_free_variable();
  1159 		automatic_message.do_not_free_variable();
  1123 
  1204 
  1124 EAP_FUNC_EXPORT wlan_eap_if_send_status_e eapol_message_wlan_authentication_c::process_data(const void * const data, const u32_t length)
  1205 EAP_FUNC_EXPORT wlan_eap_if_send_status_e eapol_message_wlan_authentication_c::process_data(const void * const data, const u32_t length)
  1125 {
  1206 {
  1126 	// Parses message data composed of Attribute-Value Pairs.
  1207 	// Parses message data composed of Attribute-Value Pairs.
  1127 
  1208 
       
  1209 	EAP_TRACE_DEBUG(
       
  1210 		m_am_tools, 
       
  1211 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
  1212 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data()\n")));
       
  1213 
       
  1214 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::process_data()");
       
  1215 
  1128 	eap_status_e status(eap_status_ok);
  1216 	eap_status_e status(eap_status_ok);
  1129 
  1217 
  1130 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1218 #if defined(USE_EAPOL_WLAN_AUTHENTICATION_MESSAGE_ASYNCRONOUS_TEST)
  1131 
  1219 
  1132 	if (m_use_asyncronous_test == true)
  1220 	if (m_use_asyncronous_test == true)
  1142 
  1230 
  1143 			status = eap_status_allocation_error;
  1231 			status = eap_status_allocation_error;
  1144 
  1232 
  1145 			(void) send_error_message(
  1233 			(void) send_error_message(
  1146 				status,
  1234 				status,
  1147 				eapol_tlv_message_type_function_none);
  1235 				eap_tlv_message_type_function_none);
  1148 
  1236 
  1149 			return wlan_eap_if_send_status_conversion_c::convert(
  1237 			return wlan_eap_if_send_status_conversion_c::convert(
  1150 				EAP_STATUS_RETURN(m_am_tools, status));
  1238 				EAP_STATUS_RETURN(m_am_tools, status));
  1151 		}
  1239 		}
  1152 
  1240 
  1155 		{
  1243 		{
  1156 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1244 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1157 
  1245 
  1158 			(void) send_error_message(
  1246 			(void) send_error_message(
  1159 				status,
  1247 				status,
  1160 				eapol_tlv_message_type_function_none);
  1248 				eap_tlv_message_type_function_none);
  1161 
  1249 
  1162 			return wlan_eap_if_send_status_conversion_c::convert(
  1250 			return wlan_eap_if_send_status_conversion_c::convert(
  1163 				EAP_STATUS_RETURN(m_am_tools, status));
  1251 				EAP_STATUS_RETURN(m_am_tools, status));
  1164 		}
  1252 		}
  1165 
  1253 
  1166 		automatic_message.do_not_free_variable();
  1254 		automatic_message.do_not_free_variable();
  1167 
  1255 
  1168 		EAP_TRACE_DEBUG(
  1256 		EAP_TRACE_DEBUG(
  1169 			m_am_tools, 
  1257 			m_am_tools, 
  1170 			TRACE_FLAGS_DEFAULT, 
  1258 			EAP_TRACE_FLAGS_MESSAGE_DATA, 
  1171 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1259 			(EAPL("TIMER: eapol_message_wlan_authentication_c::process_data(): sets EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID\n")));
  1172 	
  1260 	
  1173 		status = m_am_tools->am_set_timer(
  1261 		status = m_am_tools->am_set_timer(
  1174 			this,
  1262 			this,
  1175 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1263 			EAPOL_MESSAGE_TIMER_PROCESS_DATA_ID, 
  1195 
  1283 
  1196 			status = eap_status_allocation_error;
  1284 			status = eap_status_allocation_error;
  1197 
  1285 
  1198 			(void) send_error_message(
  1286 			(void) send_error_message(
  1199 				status,
  1287 				status,
  1200 				eapol_tlv_message_type_function_none);
  1288 				eap_tlv_message_type_function_none);
  1201 
  1289 
  1202 			return wlan_eap_if_send_status_conversion_c::convert(
  1290 			return wlan_eap_if_send_status_conversion_c::convert(
  1203 				EAP_STATUS_RETURN(m_am_tools, status));
  1291 				EAP_STATUS_RETURN(m_am_tools, status));
  1204 		}
  1292 		}
  1205 
  1293 
  1208 		{
  1296 		{
  1209 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1297 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1210 
  1298 
  1211 			(void) send_error_message(
  1299 			(void) send_error_message(
  1212 				status,
  1300 				status,
  1213 				eapol_tlv_message_type_function_none);
  1301 				eap_tlv_message_type_function_none);
  1214 
  1302 
  1215 			return wlan_eap_if_send_status_conversion_c::convert(
  1303 			return wlan_eap_if_send_status_conversion_c::convert(
  1216 				EAP_STATUS_RETURN(m_am_tools, status));
  1304 				EAP_STATUS_RETURN(m_am_tools, status));
  1217 		}
  1305 		}
  1218 
  1306 
  1227 
  1315 
  1228 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::process_message(eapol_handle_tlv_message_data_c * const message)
  1316 EAP_FUNC_EXPORT eap_status_e eapol_message_wlan_authentication_c::process_message(eapol_handle_tlv_message_data_c * const message)
  1229 {
  1317 {
  1230 	// Parses message data composed of Attribute-Value Pairs.
  1318 	// Parses message data composed of Attribute-Value Pairs.
  1231 
  1319 
       
  1320 	EAP_TRACE_DEBUG(
       
  1321 		m_am_tools, 
       
  1322 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
  1323 		(EAPL("TIMER: eapol_message_wlan_authentication_c::process_message()\n")));
       
  1324 
       
  1325 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eapol_message_wlan_authentication_c::process_message()");
       
  1326 
  1232 	EAP_TRACE_DATA_DEBUG(
  1327 	EAP_TRACE_DATA_DEBUG(
  1233 		m_am_tools,
  1328 		m_am_tools,
  1234 		EAP_TRACE_FLAGS_MESSAGE_DATA,
  1329 		EAP_TRACE_FLAGS_NEVER,
  1235 		(EAPL("eapol_message_wlan_authentication_c::process_message()"),
  1330 		(EAPL("eapol_message_wlan_authentication_c::process_message()"),
  1236 		message->get_message_data(),
  1331 		message->get_message_data(),
  1237 		message->get_message_data_length()));
  1332 		message->get_message_data_length()));
  1238 
  1333 
  1239 	eap_array_c<eap_tlv_header_c> parameters(m_am_tools);
  1334 	eap_array_c<eap_tlv_header_c> parameters(m_am_tools);
  1243 	{
  1338 	{
  1244 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1339 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1245 
  1340 
  1246 		(void) send_error_message(
  1341 		(void) send_error_message(
  1247 			status,
  1342 			status,
  1248 			eapol_tlv_message_type_function_none);
  1343 			eap_tlv_message_type_function_none);
  1249 
  1344 
  1250 		return EAP_STATUS_RETURN(m_am_tools, status);
  1345 		return EAP_STATUS_RETURN(m_am_tools, status);
  1251 	}
  1346 	}
  1252 
  1347 
  1253 	if (parameters.get_object_count() == 0)
  1348 	if (parameters.get_object_count() == 0)
  1256 
  1351 
  1257 		status = eap_status_illegal_parameter;
  1352 		status = eap_status_illegal_parameter;
  1258 
  1353 
  1259 		(void) send_error_message(
  1354 		(void) send_error_message(
  1260 			status,
  1355 			status,
  1261 			eapol_tlv_message_type_function_none);
  1356 			eap_tlv_message_type_function_none);
  1262 
  1357 
  1263 		return EAP_STATUS_RETURN(m_am_tools, status);
  1358 		return EAP_STATUS_RETURN(m_am_tools, status);
  1264 	}
  1359 	}
  1265 
  1360 
  1266 	const eap_tlv_header_c * const function_header = parameters.get_object(eapol_message_payload_index_function);
  1361 	const eap_tlv_header_c * const function_header = parameters.get_object(eap_message_payload_index_function);
  1267 	if (function_header == 0
  1362 	if (function_header == 0
  1268 		|| (function_header->get_type() != eapol_tlv_message_type_error
  1363 		|| (function_header->get_type() != eap_tlv_message_type_error
  1269 			&& function_header->get_type() != eapol_tlv_message_type_function))
  1364 			&& function_header->get_type() != eap_tlv_message_type_function))
  1270 	{
  1365 	{
  1271 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1366 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1272 
  1367 
  1273 		status = eap_status_illegal_parameter;
  1368 		status = eap_status_illegal_parameter;
  1274 
  1369 
  1275 		(void) send_error_message(
  1370 		(void) send_error_message(
  1276 			status,
  1371 			status,
  1277 			eapol_tlv_message_type_function_none);
  1372 			eap_tlv_message_type_function_none);
  1278 
  1373 
  1279 		return EAP_STATUS_RETURN(m_am_tools, status);
  1374 		return EAP_STATUS_RETURN(m_am_tools, status);
  1280 	}
  1375 	}
  1281 
  1376 
  1282 	if (function_header->get_type() == eapol_tlv_message_type_error)
  1377 	if (function_header->get_type() == eap_tlv_message_type_error)
  1283 	{
  1378 	{
  1284 		status = process_message_type_error(&parameters);
  1379 		status = process_message_type_error(&parameters);
  1285 	}
  1380 	}
  1286 	else // function_header->get_type() == eapol_tlv_message_type_function
  1381 	else // function_header->get_type() == eap_tlv_message_type_function
  1287 	{
  1382 	{
  1288 		eapol_tlv_message_type_function_e function(eapol_tlv_message_type_function_none);
  1383 		eap_tlv_message_type_function_e function(eap_tlv_message_type_function_none);
  1289 
  1384 
  1290 		status = message->get_parameter_data(function_header, &function);
  1385 		status = message->get_parameter_data(function_header, &function);
  1291 		if (status != eap_status_ok)
  1386 		if (status != eap_status_ok)
  1292 		{
  1387 		{
  1293 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1388 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1294 
  1389 
  1295 			(void) send_error_message(
  1390 			(void) send_error_message(
  1296 				status,
  1391 				status,
  1297 				eapol_tlv_message_type_function_none);
  1392 				eap_tlv_message_type_function_none);
  1298 
  1393 
  1299 			return EAP_STATUS_RETURN(m_am_tools, status);
  1394 			return EAP_STATUS_RETURN(m_am_tools, status);
  1300 		}
  1395 		}
  1301 
  1396 
  1302 		switch(function)
  1397 		switch(function)
  1303 		{
  1398 		{
  1304 		case eapol_tlv_message_type_function_check_pmksa_cache:
  1399 		case eap_tlv_message_type_function_check_pmksa_cache:
  1305 			status = check_pmksa_cache(&parameters);
  1400 			status = check_pmksa_cache(&parameters);
  1306 			break;
  1401 			break;
  1307 		case eapol_tlv_message_type_function_start_authentication:
  1402 		case eap_tlv_message_type_function_start_authentication:
  1308 			status = start_authentication(&parameters);
  1403 			status = start_authentication(&parameters);
  1309 			break;
  1404 			break;
  1310 		case eapol_tlv_message_type_function_complete_association:
  1405 		case eap_tlv_message_type_function_complete_association:
  1311 			status = complete_association(&parameters);
  1406 			status = complete_association(&parameters);
  1312 			break;
  1407 			break;
  1313 		case eapol_tlv_message_type_function_disassociation:
  1408 		case eap_tlv_message_type_function_disassociation:
  1314 			status = disassociation(&parameters);
  1409 			status = disassociation(&parameters);
  1315 			break;
  1410 			break;
  1316 		case eapol_tlv_message_type_function_start_preauthentication:
  1411 		case eap_tlv_message_type_function_start_preauthentication:
  1317 			status = start_preauthentication(&parameters);
  1412 			status = start_preauthentication(&parameters);
  1318 			break;
  1413 			break;
  1319 		case eapol_tlv_message_type_function_start_reassociation:
  1414 		case eap_tlv_message_type_function_start_reassociation:
  1320 			status = start_reassociation(&parameters);
  1415 			status = start_reassociation(&parameters);
  1321 			break;
  1416 			break;
  1322 		case eapol_tlv_message_type_function_complete_reassociation:
  1417 		case eap_tlv_message_type_function_complete_reassociation:
  1323 			status = complete_reassociation(&parameters);
  1418 			status = complete_reassociation(&parameters);
  1324 			break;
  1419 			break;
  1325 		case eapol_tlv_message_type_function_start_WPXM_reassociation:
  1420 		case eap_tlv_message_type_function_start_WPXM_reassociation:
  1326 			status = start_WPXM_reassociation(&parameters);
  1421 			status = start_WPXM_reassociation(&parameters);
  1327 			break;
  1422 			break;
  1328 		case eapol_tlv_message_type_function_complete_WPXM_reassociation:
  1423 		case eap_tlv_message_type_function_complete_WPXM_reassociation:
  1329 			status = complete_WPXM_reassociation(&parameters);
  1424 			status = complete_WPXM_reassociation(&parameters);
  1330 			break;
  1425 			break;
  1331 		case eapol_tlv_message_type_function_packet_process:
  1426 		case eap_tlv_message_type_function_packet_process:
  1332 			status = packet_process(&parameters);
  1427 			status = packet_process(&parameters);
  1333 			break;
  1428 			break;
  1334 		case eapol_tlv_message_type_function_tkip_mic_failure:
  1429 		case eap_tlv_message_type_function_tkip_mic_failure:
  1335 			status = tkip_mic_failure(&parameters);
  1430 			status = tkip_mic_failure(&parameters);
  1336 			break;
  1431 			break;
  1337 		case eapol_tlv_message_type_function_eap_acknowledge:
  1432 		case eap_tlv_message_type_function_eap_acknowledge:
  1338 			status = eap_acknowledge(&parameters);
  1433 			status = eap_acknowledge(&parameters);
  1339 			break;
  1434 			break;
  1340 		case eapol_tlv_message_type_function_update_header_offset:
  1435 		case eap_tlv_message_type_function_update_header_offset:
  1341 			status = update_header_offset(&parameters);
  1436 			status = update_header_offset(&parameters);
  1342 			break;
  1437 			break;
  1343 		case eapol_tlv_message_type_function_update_wlan_database_reference_values:
  1438 		case eap_tlv_message_type_function_update_wlan_database_reference_values:
  1344 			status = update_wlan_database_reference_values(&parameters);
  1439 			status = update_wlan_database_reference_values(&parameters);
  1345 			break;
  1440 			break;
  1346 		default:
  1441 		default:
  1347 			EAP_TRACE_ERROR(
  1442 			EAP_TRACE_ERROR(
  1348 				m_am_tools,
  1443 				m_am_tools,
  1378 
  1473 
  1379 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1474 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1380 
  1475 
  1381 	eap_status_e status(eap_status_ok);
  1476 	eap_status_e status(eap_status_ok);
  1382 
  1477 
  1383 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1478 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1479 
       
  1480 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1481 
       
  1482 	if (message_data.get_is_valid() == false)
       
  1483 	{
       
  1484 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1485 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1486 	}
       
  1487 
       
  1488 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1384 
  1489 
  1385 	eap_array_c<eap_am_network_id_c> bssid_sta_receive_network_ids(m_am_tools);
  1490 	eap_array_c<eap_am_network_id_c> bssid_sta_receive_network_ids(m_am_tools);
  1386 
  1491 
  1387 	{
  1492 	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
  1493 	if (status != eap_status_ok)
  1389 			= parameters->get_object(parameter_index);
  1494 	{
  1390 
  1495 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1391 		if (array_of_network_ids == 0
  1496 		return EAP_STATUS_RETURN(m_am_tools, status);
  1392 			|| array_of_network_ids->get_type() != eapol_tlv_message_type_array)
  1497 	}
  1393 		{
  1498 
  1394 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1499 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1500 
  1467 	++parameter_index;
  1501 	++parameter_index;
  1468 
  1502 
  1469 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1503 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1470 
  1504 
  1471 	{
  1505 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  1472 		const eap_tlv_header_c * const authentication_type
  1506 	if (status != eap_status_ok)
  1473 			= parameters->get_object(parameter_index);
  1507 	{
  1474 
  1508 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1475 		if (authentication_type == 0
  1509 		return EAP_STATUS_RETURN(m_am_tools, status);
  1476 			|| authentication_type->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1510 	}
  1477 		{
  1511 
  1478 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1512 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1513 
  1503 	++parameter_index;
  1514 	++parameter_index;
  1504 
  1515 
  1505 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1516 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1506 
  1517 
  1507 	{
  1518 	status = message_data.read_parameter_data(parameters, parameter_index, &pairwise_key_cipher_suite);
  1508 		const eap_tlv_header_c * const authentication_type
  1519 	if (status != eap_status_ok)
  1509 			= parameters->get_object(parameter_index);
  1520 	{
  1510 
  1521 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1511 		if (authentication_type == 0
  1522 		return EAP_STATUS_RETURN(m_am_tools, status);
  1512 			|| authentication_type->get_type() != eapol_tlv_message_type_RSNA_cipher)
  1523 	}
  1513 		{
  1524 
  1514 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1525 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1526 
  1539 	++parameter_index;
  1527 	++parameter_index;
  1540 
  1528 
  1541 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1529 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1542 
  1530 
  1543 	{
  1531 	status = message_data.read_parameter_data(parameters, parameter_index, &group_key_cipher_suite);
  1544 		const eap_tlv_header_c * const authentication_type
  1532 	if (status != eap_status_ok)
  1545 			= parameters->get_object(parameter_index);
  1533 	{
  1546 
  1534 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1547 		if (authentication_type == 0
  1535 		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 	}
  1536 	}
  1573 
  1537 
  1574 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1538 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1575 
  1539 
  1576 	status = m_wauth->check_pmksa_cache(
  1540 	status = m_wauth->check_pmksa_cache(
  1579 		pairwise_key_cipher_suite,
  1543 		pairwise_key_cipher_suite,
  1580 		group_key_cipher_suite);
  1544 		group_key_cipher_suite);
  1581 
  1545 
  1582 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1546 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1583 
  1547 
       
  1548 #if 0
       
  1549 
  1584 	if (status == eap_status_ok
  1550 	if (status == eap_status_ok
  1585 		|| status == eap_status_not_found)
  1551 		|| status == eap_status_not_found)
  1586 	{
  1552 	{
  1587 		// Creates message data composed of Attribute-Value Pairs.
  1553 		// Creates message data composed of Attribute-Value Pairs.
  1588 		eapol_handle_tlv_message_data_c message(m_am_tools);
  1554 		eapol_handle_tlv_message_data_c message(m_am_tools);
  1592 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1558 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1593 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1559 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1594 		}
  1560 		}
  1595 
  1561 
  1596 		status = message.add_parameter_data(
  1562 		status = message.add_parameter_data(
  1597 			eapol_tlv_message_type_function_complete_check_pmksa_cache);
  1563 			eap_tlv_message_type_function_complete_check_pmksa_cache);
  1598 		if (status != eap_status_ok)
  1564 		if (status != eap_status_ok)
  1599 		{
  1565 		{
  1600 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1566 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1601 			return EAP_STATUS_RETURN(m_am_tools, status);
  1567 			return EAP_STATUS_RETURN(m_am_tools, status);
  1602 		}
  1568 		}
  1618 				eap_tlv_header_c::get_header_length()
  1584 				eap_tlv_header_c::get_header_length()
  1619 				+ message.get_payload_size(network_id);
  1585 				+ message.get_payload_size(network_id);
  1620 		}
  1586 		}
  1621 
  1587 
  1622 		status = message.add_structured_parameter_header(
  1588 		status = message.add_structured_parameter_header(
  1623 			eapol_tlv_message_type_array,
  1589 			eap_tlv_message_type_array,
  1624 			network_id_parameters_size);
  1590 			network_id_parameters_size);
  1625 		if (status != eap_status_ok)
  1591 		if (status != eap_status_ok)
  1626 		{
  1592 		{
  1627 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1593 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1628 			return EAP_STATUS_RETURN(m_am_tools, status);
  1594 			return EAP_STATUS_RETURN(m_am_tools, status);
  1653 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1619 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1654 			return EAP_STATUS_RETURN(m_am_tools, status);
  1620 			return EAP_STATUS_RETURN(m_am_tools, status);
  1655 		}
  1621 		}
  1656 	}
  1622 	}
  1657 
  1623 
       
  1624 #endif //#if 0
       
  1625 
  1658 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1626 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1659 
  1627 
  1660 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1628 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1661 	return EAP_STATUS_RETURN(m_am_tools, status);
  1629 	return EAP_STATUS_RETURN(m_am_tools, status);
  1662 }
  1630 }
  1670 
  1638 
  1671 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1639 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1672 
  1640 
  1673 	eap_status_e status(eap_status_ok);
  1641 	eap_status_e status(eap_status_ok);
  1674 
  1642 
  1675 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1643 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1644 
       
  1645 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1646 
       
  1647 	if (message_data.get_is_valid() == false)
       
  1648 	{
       
  1649 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1650 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1651 	}
       
  1652 
       
  1653 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1676 
  1654 
  1677 	eap_variable_data_c SSID(m_am_tools);
  1655 	eap_variable_data_c SSID(m_am_tools);
  1678 
  1656 
  1679 	if (SSID.get_is_valid() == false)
  1657 	if (SSID.get_is_valid() == false)
  1680 	{
  1658 	{
  1681 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1659 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1682 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1660 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1683 	}
  1661 	}
  1684 
  1662 
  1685 	{
  1663 	status = message_data.read_parameter_data(parameters, parameter_index, &SSID);
  1686 		const eap_tlv_header_c * const ssid_parameter
  1664 	if (status != eap_status_ok)
  1687 			= parameters->get_object(parameter_index);
  1665 	{
  1688 
  1666 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1689 		if (ssid_parameter == 0
  1667 		return EAP_STATUS_RETURN(m_am_tools, status);
  1690 			|| ssid_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1668 	}
  1691 		{
  1669 
  1692 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1670 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1671 
  1713 	++parameter_index;
  1672 	++parameter_index;
  1714 
  1673 
  1715 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1674 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1716 
  1675 
  1717 	{
  1676 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  1718 		const eap_tlv_header_c * const authentication_type_parameter
  1677 	if (status != eap_status_ok)
  1719 			= parameters->get_object(parameter_index);
  1678 	{
  1720 
  1679 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1721 		if (authentication_type_parameter == 0
  1680 		return EAP_STATUS_RETURN(m_am_tools, status);
  1722 			|| authentication_type_parameter->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1681 	}
  1723 		{
  1682 
  1724 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1683 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1684 
  1749 	++parameter_index;
  1685 	++parameter_index;
  1750 
  1686 
  1751 	eap_variable_data_c wpa_preshared_key(m_am_tools);
  1687 	eap_variable_data_c wpa_preshared_key(m_am_tools);
  1752 
  1688 
  1753 	{
  1689 	status = message_data.read_parameter_data(parameters, parameter_index, &wpa_preshared_key);
  1754 		const eap_tlv_header_c * const wpa_preshared_key_parameter
  1690 	if (status != eap_status_ok)
  1755 			= parameters->get_object(parameter_index);
  1691 	{
  1756 
  1692 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1757 		if (wpa_preshared_key_parameter == 0
  1693 		return EAP_STATUS_RETURN(m_am_tools, status);
  1758 			|| wpa_preshared_key_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1694 	}
  1759 		{
  1695 
  1760 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1696 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1697 
  1781 	++parameter_index;
  1698 	++parameter_index;
  1782 
  1699 
  1783 	bool WPA_override_enabled(false);
  1700 	bool WPA_override_enabled(false);
  1784 
  1701 
  1785 	{
  1702 	status = message_data.read_parameter_data(parameters, parameter_index, &WPA_override_enabled);
  1786 		const eap_tlv_header_c * const WPA_override_enabled_parameter
  1703 	if (status != eap_status_ok)
  1787 			= parameters->get_object(parameter_index);
  1704 	{
  1788 
  1705 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1789 		if (WPA_override_enabled_parameter == 0
  1706 		return EAP_STATUS_RETURN(m_am_tools, status);
  1790 			|| WPA_override_enabled_parameter->get_type() != eapol_tlv_message_type_boolean)
  1707 	}
  1791 		{
  1708 
  1792 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1709 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1710 
  1819 	++parameter_index;
  1711 	++parameter_index;
  1820 
  1712 
  1821 	eap_am_network_id_c receive_network_id(m_am_tools);
  1713 	eap_am_network_id_c receive_network_id(m_am_tools);
  1822 
  1714 
  1823 	{
  1715 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  1824 		const eap_tlv_header_c * const receive_network_id_parameter
  1716 	if (status != eap_status_ok)
  1825 			= parameters->get_object(parameter_index);
  1717 	{
  1826 
  1718 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1827 		if (receive_network_id_parameter == 0
  1719 		return EAP_STATUS_RETURN(m_am_tools, status);
  1828 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1720 	}
  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 
  1721 
  1852 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1722 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1853 
  1723 
  1854 	status = m_wauth->start_authentication(
  1724 	status = m_wauth->start_authentication(
  1855 		&SSID,
  1725 		&SSID,
  1856 		selected_eapol_key_authentication_type,
  1726 		selected_eapol_key_authentication_type,
  1857 		&wpa_preshared_key,
  1727 		&wpa_preshared_key,
  1858 		WPA_override_enabled
  1728 		WPA_override_enabled,
  1859 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
  1729 		&receive_network_id
  1860 		, &receive_network_id
       
  1861 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE)
       
  1862 		);
  1730 		);
  1863 
  1731 
  1864 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1732 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1865 
  1733 
  1866 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1734 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1876 
  1744 
  1877 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1745 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1878 
  1746 
  1879 	eap_status_e status(eap_status_ok);
  1747 	eap_status_e status(eap_status_ok);
  1880 
  1748 
  1881 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1749 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1750 
       
  1751 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1752 
       
  1753 	if (message_data.get_is_valid() == false)
       
  1754 	{
       
  1755 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1756 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1757 	}
       
  1758 
       
  1759 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1882 
  1760 
  1883 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  1761 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  1884 
  1762 
  1885 	{
  1763 	status = message_data.read_parameter_data(parameters, parameter_index, &association_result);
  1886 		const eap_tlv_header_c * const association_result_parameter
  1764 	if (status != eap_status_ok)
  1887 			= parameters->get_object(parameter_index);
  1765 	{
  1888 
  1766 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1889 		if (association_result_parameter == 0
  1767 		return EAP_STATUS_RETURN(m_am_tools, status);
  1890 			|| association_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  1768 	}
  1891 		{
  1769 
  1892 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1770 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1771 
  1917 	++parameter_index;
  1772 	++parameter_index;
  1918 
  1773 
  1919 	eap_am_network_id_c receive_network_id(m_am_tools);
  1774 	eap_am_network_id_c receive_network_id(m_am_tools);
  1920 
  1775 
  1921 	{
  1776 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  1922 		const eap_tlv_header_c * const receive_network_id_parameter
  1777 	if (status != eap_status_ok)
  1923 			= parameters->get_object(parameter_index);
  1778 	{
  1924 
  1779 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1925 		if (receive_network_id_parameter == 0
  1780 		return EAP_STATUS_RETURN(m_am_tools, status);
  1926 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1781 	}
  1927 		{
  1782 
  1928 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1783 
  1929 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  1784 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1785 
  1949 	++parameter_index;
  1786 	++parameter_index;
  1950 
  1787 
  1951 	eap_variable_data_c received_WPA_IE(m_am_tools);
  1788 	eap_variable_data_c received_WPA_IE(m_am_tools);
  1952 
  1789 
  1953 	{
  1790 	status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_IE);
  1954 		const eap_tlv_header_c * const received_WPA_IE_parameter
  1791 	if (status != eap_status_ok)
  1955 			= parameters->get_object(parameter_index);
  1792 	{
  1956 
  1793 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1957 		if (received_WPA_IE_parameter == 0
  1794 		return EAP_STATUS_RETURN(m_am_tools, status);
  1958 			|| received_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1795 	}
  1959 		{
  1796 
  1960 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1797 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1798 
  1981 	++parameter_index;
  1799 	++parameter_index;
  1982 
  1800 
  1983 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  1801 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  1984 
  1802 
  1985 	{
  1803 	status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_IE);
  1986 		const eap_tlv_header_c * const sent_WPA_IE_parameter
  1804 	if (status != eap_status_ok)
  1987 			= parameters->get_object(parameter_index);
  1805 	{
  1988 
  1806 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1989 		if (sent_WPA_IE_parameter == 0
  1807 		return EAP_STATUS_RETURN(m_am_tools, status);
  1990 			|| sent_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  1808 	}
  1991 		{
  1809 
  1992 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1810 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1811 
  2013 	++parameter_index;
  1812 	++parameter_index;
  2014 
  1813 
  2015 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1814 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2016 
  1815 
  2017 	{
  1816 	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
  1817 	if (status != eap_status_ok)
  2019 			= parameters->get_object(parameter_index);
  1818 	{
  2020 
  1819 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2021 		if (pairwise_key_cipher_suite_parameter == 0
  1820 		return EAP_STATUS_RETURN(m_am_tools, status);
  2022 			|| pairwise_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
  1821 	}
  2023 		{
  1822 
  2024 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1823 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1824 
  2048 	++parameter_index;
  1825 	++parameter_index;
  2049 
  1826 
  2050 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  1827 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2051 
  1828 
  2052 	{
  1829 	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
  1830 	if (status != eap_status_ok)
  2054 			= parameters->get_object(parameter_index);
  1831 	{
  2055 
  1832 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2056 		if (group_key_cipher_suite_parameter == 0
  1833 		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 	}
  1834 	}
  2082 
  1835 
  2083 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1836 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2084 
  1837 
  2085 	status = m_wauth->complete_association(
  1838 	status = m_wauth->complete_association(
  2106 
  1859 
  2107 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1860 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2108 
  1861 
  2109 	eap_status_e status(eap_status_ok);
  1862 	eap_status_e status(eap_status_ok);
  2110 
  1863 
  2111 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1864 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1865 
       
  1866 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1867 
       
  1868 	if (message_data.get_is_valid() == false)
       
  1869 	{
       
  1870 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1871 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1872 	}
       
  1873 
       
  1874 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2112 
  1875 
  2113 	eap_am_network_id_c receive_network_id(m_am_tools);
  1876 	eap_am_network_id_c receive_network_id(m_am_tools);
  2114 
  1877 
  2115 	{
  1878 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2116 		const eap_tlv_header_c * const receive_network_id_parameter
  1879 	if (status != eap_status_ok)
  2117 			= parameters->get_object(parameter_index);
  1880 	{
  2118 
  1881 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2119 		if (receive_network_id_parameter == 0
  1882 		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 	}
  1883 	}
  2141 
  1884 
  2142 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1885 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2143 
  1886 
  2144 	status = m_wauth->disassociation(
  1887 	status = m_wauth->disassociation(
  2160 
  1903 
  2161 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1904 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2162 
  1905 
  2163 	eap_status_e status(eap_status_ok);
  1906 	eap_status_e status(eap_status_ok);
  2164 
  1907 
  2165 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1908 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1909 
       
  1910 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1911 
       
  1912 	if (message_data.get_is_valid() == false)
       
  1913 	{
       
  1914 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1915 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1916 	}
       
  1917 
       
  1918 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2166 
  1919 
  2167 	eap_am_network_id_c receive_network_id(m_am_tools);
  1920 	eap_am_network_id_c receive_network_id(m_am_tools);
  2168 
  1921 
  2169 	{
  1922 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2170 		const eap_tlv_header_c * const receive_network_id_parameter
  1923 	if (status != eap_status_ok)
  2171 			= parameters->get_object(parameter_index);
  1924 	{
  2172 
  1925 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2173 		if (receive_network_id_parameter == 0
  1926 		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 	}
  1927 	}
  2195 
  1928 
  2196 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1929 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2197 
  1930 
  2198 	status = m_wauth->start_preauthentication(
  1931 	status = m_wauth->start_preauthentication(
  2214 
  1947 
  2215 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1948 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2216 
  1949 
  2217 	eap_status_e status(eap_status_ok);
  1950 	eap_status_e status(eap_status_ok);
  2218 
  1951 
  2219 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  1952 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  1953 
       
  1954 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  1955 
       
  1956 	if (message_data.get_is_valid() == false)
       
  1957 	{
       
  1958 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1959 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1960 	}
       
  1961 
       
  1962 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2220 
  1963 
  2221 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  1964 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2222 
  1965 
  2223 	{
  1966 	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
  1967 	if (status != eap_status_ok)
  2225 			= parameters->get_object(parameter_index);
  1968 	{
  2226 
  1969 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2227 		if (old_receive_network_id_parameter == 0
  1970 		return EAP_STATUS_RETURN(m_am_tools, status);
  2228 			|| old_receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1971 	}
  2229 		{
  1972 
  2230 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1973 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1974 
  2250 	++parameter_index;
  1975 	++parameter_index;
  2251 
  1976 
  2252 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  1977 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2253 
  1978 
  2254 	{
  1979 	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
  1980 	if (status != eap_status_ok)
  2256 			= parameters->get_object(parameter_index);
  1981 	{
  2257 
  1982 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2258 		if (new_receive_network_id_parameter == 0
  1983 		return EAP_STATUS_RETURN(m_am_tools, status);
  2259 			|| new_receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  1984 	}
  2260 		{
  1985 
  2261 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1986 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  1987 
  2282 	++parameter_index;
  1988 	++parameter_index;
  2283 
  1989 
  2284 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  1990 	eapol_key_authentication_type_e selected_eapol_key_authentication_type(eapol_key_authentication_type_none);
  2285 
  1991 
  2286 	{
  1992 	status = message_data.read_parameter_data(parameters, parameter_index, &selected_eapol_key_authentication_type);
  2287 		const eap_tlv_header_c * const authentication_type
  1993 	if (status != eap_status_ok)
  2288 			= parameters->get_object(parameter_index);
  1994 	{
  2289 
  1995 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2290 		if (authentication_type == 0
  1996 		return EAP_STATUS_RETURN(m_am_tools, status);
  2291 			|| authentication_type->get_type() != eapol_tlv_message_type_eapol_key_authentication_type)
  1997 	}
  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 
  1998 
  2318 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1999 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2319 
  2000 
  2320 	status = m_wauth->start_reassociation(
  2001 	status = m_wauth->start_reassociation(
  2321 		&old_receive_network_id,
  2002 		&old_receive_network_id,
  2337 
  2018 
  2338 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2019 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2339 
  2020 
  2340 	eap_status_e status(eap_status_ok);
  2021 	eap_status_e status(eap_status_ok);
  2341 
  2022 
  2342 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2023 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2024 
       
  2025 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2026 
       
  2027 	if (message_data.get_is_valid() == false)
       
  2028 	{
       
  2029 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2030 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2031 	}
       
  2032 
       
  2033 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2343 
  2034 
  2344 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  2035 	eapol_wlan_authentication_state_e association_result(eapol_wlan_authentication_state_none);
  2345 
  2036 
  2346 	{
  2037 	status = message_data.read_parameter_data(parameters, parameter_index, &association_result);
  2347 		const eap_tlv_header_c * const association_result_parameter
  2038 	if (status != eap_status_ok)
  2348 			= parameters->get_object(parameter_index);
  2039 	{
  2349 
  2040 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2350 		if (association_result_parameter == 0
  2041 		return EAP_STATUS_RETURN(m_am_tools, status);
  2351 			|| association_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  2042 	}
  2352 		{
  2043 
  2353 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2044 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2045 
  2378 	++parameter_index;
  2046 	++parameter_index;
  2379 
  2047 
  2380 	eap_am_network_id_c receive_network_id(m_am_tools);
  2048 	eap_am_network_id_c receive_network_id(m_am_tools);
  2381 
  2049 
  2382 	{
  2050 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2383 		const eap_tlv_header_c * const receive_network_id_parameter
  2051 	if (status != eap_status_ok)
  2384 			= parameters->get_object(parameter_index);
  2052 	{
  2385 
  2053 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2386 		if (receive_network_id_parameter == 0
  2054 		return EAP_STATUS_RETURN(m_am_tools, status);
  2387 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2055 	}
  2388 		{
  2056 
  2389 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2057 
  2390 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2058 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2059 
  2410 	++parameter_index;
  2060 	++parameter_index;
  2411 
  2061 
  2412 	eap_variable_data_c received_WPA_IE(m_am_tools);
  2062 	eap_variable_data_c received_WPA_IE(m_am_tools);
  2413 
  2063 
  2414 	{
  2064 	status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_IE);
  2415 		const eap_tlv_header_c * const received_WPA_IE_parameter
  2065 	if (status != eap_status_ok)
  2416 			= parameters->get_object(parameter_index);
  2066 	{
  2417 
  2067 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2418 		if (received_WPA_IE_parameter == 0
  2068 		return EAP_STATUS_RETURN(m_am_tools, status);
  2419 			|| received_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2069 	}
  2420 		{
  2070 
  2421 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2071 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2072 
  2442 	++parameter_index;
  2073 	++parameter_index;
  2443 
  2074 
  2444 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  2075 	eap_variable_data_c sent_WPA_IE(m_am_tools);
  2445 
  2076 
  2446 	{
  2077 	status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_IE);
  2447 		const eap_tlv_header_c * const sent_WPA_IE_parameter
  2078 	if (status != eap_status_ok)
  2448 			= parameters->get_object(parameter_index);
  2079 	{
  2449 
  2080 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2450 		if (sent_WPA_IE_parameter == 0
  2081 		return EAP_STATUS_RETURN(m_am_tools, status);
  2451 			|| sent_WPA_IE_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2082 	}
  2452 		{
  2083 
  2453 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2084 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2085 
  2474 	++parameter_index;
  2086 	++parameter_index;
  2475 
  2087 
  2476 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2088 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e pairwise_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2477 
  2089 
  2478 	{
  2090 	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
  2091 	if (status != eap_status_ok)
  2480 			= parameters->get_object(parameter_index);
  2092 	{
  2481 
  2093 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2482 		if (pairwise_key_cipher_suite_parameter == 0
  2094 		return EAP_STATUS_RETURN(m_am_tools, status);
  2483 			|| pairwise_key_cipher_suite_parameter->get_type() != eapol_tlv_message_type_RSNA_cipher)
  2095 	}
  2484 		{
  2096 
  2485 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2097 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2098 
  2509 	++parameter_index;
  2099 	++parameter_index;
  2510 
  2100 
  2511 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2101 	eapol_RSNA_key_header_c::eapol_RSNA_cipher_e group_key_cipher_suite(eapol_RSNA_key_header_c::eapol_RSNA_cipher_none);
  2512 
  2102 
  2513 	{
  2103 	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
  2104 	if (status != eap_status_ok)
  2515 			= parameters->get_object(parameter_index);
  2105 	{
  2516 
  2106 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2517 		if (group_key_cipher_suite_parameter == 0
  2107 		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 	}
  2108 	}
  2543 
  2109 
  2544 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2110 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2545 
  2111 
  2546 	status = m_wauth->complete_reassociation(
  2112 	status = m_wauth->complete_reassociation(
  2567 
  2133 
  2568 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2134 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2569 
  2135 
  2570 	eap_status_e status(eap_status_ok);
  2136 	eap_status_e status(eap_status_ok);
  2571 
  2137 
  2572 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2138 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2139 
       
  2140 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2141 
       
  2142 	if (message_data.get_is_valid() == false)
       
  2143 	{
       
  2144 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2145 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2146 	}
       
  2147 
       
  2148 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2573 
  2149 
  2574 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2150 	eap_am_network_id_c old_receive_network_id(m_am_tools);
  2575 
  2151 
  2576 	{
  2152 	status = message_data.read_parameter_data(parameters, parameter_index, &old_receive_network_id);
  2577 		const eap_tlv_header_c * const receive_network_id_parameter
  2153 	if (status != eap_status_ok)
  2578 			= parameters->get_object(parameter_index);
  2154 	{
  2579 
  2155 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2580 		if (receive_network_id_parameter == 0
  2156 		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 	}
  2157 	}
  2602 
  2158 
  2603 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2159 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2604 
  2160 
  2605 	++parameter_index;
  2161 	++parameter_index;
  2606 
  2162 
  2607 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2163 	eap_am_network_id_c new_receive_network_id(m_am_tools);
  2608 
  2164 
  2609 	{
  2165 	status = message_data.read_parameter_data(parameters, parameter_index, &new_receive_network_id);
  2610 		const eap_tlv_header_c * const receive_network_id_parameter
  2166 	if (status != eap_status_ok)
  2611 			= parameters->get_object(parameter_index);
  2167 	{
  2612 
  2168 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2613 		if (receive_network_id_parameter == 0
  2169 		return EAP_STATUS_RETURN(m_am_tools, status);
  2614 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2170 	}
  2615 		{
  2171 
  2616 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2172 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2173 
  2639 	++parameter_index;
  2174 	++parameter_index;
  2640 
  2175 
  2641 	eap_variable_data_c send_reassociation_request_ie(m_am_tools);
  2176 	eap_variable_data_c send_reassociation_request_ie(m_am_tools);
  2642 
  2177 
  2643 	{
  2178 	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
  2179 	if (status != eap_status_ok)
  2645 			= parameters->get_object(parameter_index);
  2180 	{
  2646 
  2181 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2647 		if (send_reassociation_request_ie_parameter == 0
  2182 		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 	}
  2183 	}
  2669 
  2184 
  2670 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2185 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2671 
  2186 
  2672 	++parameter_index;
  2187 	++parameter_index;
  2673 
  2188 
  2674 	eap_variable_data_c received_WPA_ie(m_am_tools);
  2189 	eap_variable_data_c received_WPA_ie(m_am_tools);
  2675 
  2190 
  2676 	if (parameters->get_object_count() > parameter_index)
  2191 	if (parameters->get_object_count() > parameter_index)
  2677 	{
  2192 	{
  2678 		const eap_tlv_header_c * const send_reassociation_request_ie_parameter
  2193 		status = message_data.read_parameter_data(parameters, parameter_index, &received_WPA_ie);
  2679 			= parameters->get_object(parameter_index);
  2194 		if (status != eap_status_ok)
  2680 
  2195 		{
  2681 		if (send_reassociation_request_ie_parameter != 0
  2196 			// This is optional parameter.
  2682 			&& send_reassociation_request_ie_parameter->get_type() == eapol_tlv_message_type_variable_data)
  2197 			(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 		}
  2198 		}
  2699 	}
  2199 	}
  2700 
  2200 
  2701 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2201 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2702 
  2202 
  2704 
  2204 
  2705 	eap_variable_data_c sent_WPA_ie(m_am_tools);
  2205 	eap_variable_data_c sent_WPA_ie(m_am_tools);
  2706 
  2206 
  2707 	if (parameters->get_object_count() > parameter_index)
  2207 	if (parameters->get_object_count() > parameter_index)
  2708 	{
  2208 	{
  2709 		const eap_tlv_header_c * const send_reassociation_request_ie_parameter
  2209 		status = message_data.read_parameter_data(parameters, parameter_index, &sent_WPA_ie);
  2710 			= parameters->get_object(parameter_index);
  2210 		if (status != eap_status_ok)
  2711 
  2211 		{
  2712 		if (send_reassociation_request_ie_parameter != 0
  2212 			// This is optional parameter.
  2713 			&& send_reassociation_request_ie_parameter->get_type() == eapol_tlv_message_type_variable_data)
  2213 			(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 		}
  2214 		}
  2730 	}
  2215 	}
  2731 
  2216 
  2732 
  2217 
  2733 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2218 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2750 		{
  2235 		{
  2751 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2236 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2752 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2237 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2753 		}
  2238 		}
  2754 
  2239 
  2755 		status = message.add_parameter_data(eapol_tlv_message_type_function_complete_start_WPXM_reassociation);
  2240 		status = message.add_parameter_data(eap_tlv_message_type_function_complete_start_WPXM_reassociation);
  2756 		if (status != eap_status_ok)
  2241 		if (status != eap_status_ok)
  2757 		{
  2242 		{
  2758 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2243 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2759 			return EAP_STATUS_RETURN(m_am_tools, status);
  2244 			return EAP_STATUS_RETURN(m_am_tools, status);
  2760 		}
  2245 		}
  2796 
  2281 
  2797 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2282 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2798 
  2283 
  2799 	eap_status_e status(eap_status_ok);
  2284 	eap_status_e status(eap_status_ok);
  2800 
  2285 
  2801 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2286 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2287 
       
  2288 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2289 
       
  2290 	if (message_data.get_is_valid() == false)
       
  2291 	{
       
  2292 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2293 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2294 	}
       
  2295 
       
  2296 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2802 
  2297 
  2803 	eapol_wlan_authentication_state_e reassociation_result(eapol_wlan_authentication_state_none);
  2298 	eapol_wlan_authentication_state_e reassociation_result(eapol_wlan_authentication_state_none);
  2804 
  2299 
  2805 	{
  2300 	status = message_data.read_parameter_data(parameters, parameter_index, &reassociation_result);
  2806 		const eap_tlv_header_c * const reassociation_result_parameter
  2301 	if (status != eap_status_ok)
  2807 			= parameters->get_object(parameter_index);
  2302 	{
  2808 
  2303 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2809 		if (reassociation_result_parameter == 0
  2304 		return EAP_STATUS_RETURN(m_am_tools, status);
  2810 			|| reassociation_result_parameter->get_type() != eapol_tlv_message_type_eapol_wlan_authentication_state)
  2305 	}
  2811 		{
  2306 
  2812 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2307 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2308 
  2837 	++parameter_index;
  2309 	++parameter_index;
  2838 
  2310 
  2839 	eap_am_network_id_c receive_network_id(m_am_tools);
  2311 	eap_am_network_id_c receive_network_id(m_am_tools);
  2840 
  2312 
  2841 	{
  2313 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2842 		const eap_tlv_header_c * const receive_network_id_parameter
  2314 	if (status != eap_status_ok)
  2843 			= parameters->get_object(parameter_index);
  2315 	{
  2844 
  2316 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2845 		if (receive_network_id_parameter == 0
  2317 		return EAP_STATUS_RETURN(m_am_tools, status);
  2846 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2318 	}
  2847 		{
  2319 
  2848 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2320 
  2849 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2321 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2322 
  2869 	++parameter_index;
  2323 	++parameter_index;
  2870 
  2324 
  2871 	eap_variable_data_c received_reassociation_ie(m_am_tools);
  2325 	eap_variable_data_c received_reassociation_ie(m_am_tools);
  2872 
  2326 
  2873 	{
  2327 	status = message_data.read_parameter_data(parameters, parameter_index, &received_reassociation_ie);
  2874 		const eap_tlv_header_c * const received_reassociation_ie_parameter
  2328 	if (status != eap_status_ok)
  2875 			= parameters->get_object(parameter_index);
  2329 	{
  2876 
  2330 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2877 		if (received_reassociation_ie_parameter == 0
  2331 		return EAP_STATUS_RETURN(m_am_tools, status);
  2878 			|| received_reassociation_ie_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2332 	}
  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 
  2333 
  2901 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2334 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2902 
  2335 
  2903 	status = m_wauth->complete_WPXM_reassociation(
  2336 	status = m_wauth->complete_WPXM_reassociation(
  2904 		reassociation_result,
  2337 		reassociation_result,
  2920 
  2353 
  2921 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2354 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2922 
  2355 
  2923 	eap_status_e status(eap_status_ok);
  2356 	eap_status_e status(eap_status_ok);
  2924 
  2357 
  2925 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2358 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2359 
       
  2360 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2361 
       
  2362 	if (message_data.get_is_valid() == false)
       
  2363 	{
       
  2364 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2365 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2366 	}
       
  2367 
       
  2368 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2926 
  2369 
  2927 	eap_am_network_id_c receive_network_id(m_am_tools);
  2370 	eap_am_network_id_c receive_network_id(m_am_tools);
  2928 
  2371 
  2929 	{
  2372 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  2930 		const eap_tlv_header_c * const receive_network_id_parameter
  2373 	if (status != eap_status_ok)
  2931 			= parameters->get_object(parameter_index);
  2374 	{
  2932 
  2375 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2933 		if (receive_network_id_parameter == 0
  2376 		return EAP_STATUS_RETURN(m_am_tools, status);
  2934 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2377 	}
  2935 		{
  2378 
  2936 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2379 
  2937 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2380 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2381 
  2957 	++parameter_index;
  2382 	++parameter_index;
  2958 
  2383 
  2959 	eap_variable_data_c packet_data_payload(m_am_tools);
  2384 	eap_variable_data_c packet_data_payload(m_am_tools);
  2960 
  2385 
  2961 	{
  2386 	status = message_data.read_parameter_data(parameters, parameter_index, &packet_data_payload);
  2962 		const eap_tlv_header_c * const packet_data_parameter
  2387 	if (status != eap_status_ok)
  2963 			= parameters->get_object(parameter_index);
  2388 	{
  2964 
  2389 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2965 		if (packet_data_parameter == 0
  2390 		return EAP_STATUS_RETURN(m_am_tools, status);
  2966 			|| packet_data_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2391 	}
  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 
  2392 
  2989 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2393 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2990 
  2394 
  2991 	eapol_ethernet_header_wr_c eth(
  2395 	eapol_ethernet_header_wr_c eth(
  2992 		m_am_tools,
  2396 		m_am_tools,
  3019 
  2423 
  3020 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2424 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3021 
  2425 
  3022 	eap_status_e status(eap_status_ok);
  2426 	eap_status_e status(eap_status_ok);
  3023 
  2427 
  3024 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2428 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2429 
       
  2430 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2431 
       
  2432 	if (message_data.get_is_valid() == false)
       
  2433 	{
       
  2434 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2435 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2436 	}
       
  2437 
       
  2438 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3025 
  2439 
  3026 	eap_am_network_id_c receive_network_id(m_am_tools);
  2440 	eap_am_network_id_c receive_network_id(m_am_tools);
  3027 
  2441 
  3028 	{
  2442 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  3029 		const eap_tlv_header_c * const receive_network_id_parameter
  2443 	if (status != eap_status_ok)
  3030 			= parameters->get_object(parameter_index);
  2444 	{
  3031 
  2445 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3032 		if (receive_network_id_parameter == 0
  2446 		return EAP_STATUS_RETURN(m_am_tools, status);
  3033 			|| receive_network_id_parameter->get_type() != eapol_tlv_message_type_network_id)
  2447 	}
  3034 		{
  2448 
  3035 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2449 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2450 
  3055 	++parameter_index;
  2451 	++parameter_index;
  3056 
  2452 
  3057 	bool fatal_failure_when_true(false);
  2453 	bool fatal_failure_when_true(false);
  3058 
  2454 
  3059 	{
  2455 	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
  2456 	if (status != eap_status_ok)
  3061 			= parameters->get_object(parameter_index);
  2457 	{
  3062 
  2458 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3063 		if (fatal_failure_when_true_parameter == 0
  2459 		return EAP_STATUS_RETURN(m_am_tools, status);
  3064 			|| fatal_failure_when_true_parameter->get_type() != eapol_tlv_message_type_boolean)
  2460 	}
  3065 		{
  2461 
  3066 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2462 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  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 
  2463 
  3091 	++parameter_index;
  2464 	++parameter_index;
  3092 
  2465 
  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);
  2466 	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 
  2467 
  3095 	{
  2468 	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
  2469 	if (status != eap_status_ok)
  3097 			= parameters->get_object(parameter_index);
  2470 	{
  3098 
  2471 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3099 		if (tkip_mic_failure_type_parameter == 0
  2472 		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 	}
  2473 	}
  3125 
  2474 
  3126 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2475 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3127 
  2476 
  3128 	status = m_wauth->tkip_mic_failure(
  2477 	status = m_wauth->tkip_mic_failure(
  3146 
  2495 
  3147 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2496 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3148 
  2497 
  3149 	eap_status_e status(eap_status_ok);
  2498 	eap_status_e status(eap_status_ok);
  3150 
  2499 
  3151 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2500 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
  2501 
       
  2502 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
       
  2503 
       
  2504 	if (message_data.get_is_valid() == false)
       
  2505 	{
       
  2506 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2507 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2508 	}
       
  2509 
       
  2510 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3152 
  2511 
  3153 	eap_am_network_id_c receive_network_id(m_am_tools);
  2512 	eap_am_network_id_c receive_network_id(m_am_tools);
  3154 
  2513 
  3155 	{
  2514 	status = message_data.read_parameter_data(parameters, parameter_index, &receive_network_id);
  3156 		const eap_tlv_header_c * const receive_network_id_parameter
  2515 	if (status != eap_status_ok)
  3157 			= parameters->get_object(parameter_index);
  2516 	{
  3158 
  2517 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3159 		if (receive_network_id_parameter == 0
  2518 		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 	}
  2519 	}
  3181 
  2520 
  3182 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2521 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3183 
  2522 
  3184 	status = m_wauth->eap_acknowledge(
  2523 	status = m_wauth->eap_acknowledge(
  3200 
  2539 
  3201 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2540 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3202 
  2541 
  3203 	eap_status_e status(eap_status_ok);
  2542 	eap_status_e status(eap_status_ok);
  3204 
  2543 
  3205 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2544 	u32_t parameter_index(eap_message_payload_index_first_parameter);
  3206 
  2545 
  3207 	{
  2546 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
  3208 		const eap_tlv_header_c * const header_offset_value_parameter
  2547 
  3209 			= parameters->get_object(parameter_index);
  2548 	if (message_data.get_is_valid() == false)
  3210 
  2549 	{
  3211 		if (header_offset_value_parameter == 0
  2550 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3212 			|| header_offset_value_parameter->get_type() != eapol_tlv_message_type_u32_t)
  2551 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  3213 		{
  2552 	}
  3214 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2553 
  3215 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2554 	status = message_data.read_parameter_data(parameters, parameter_index, &m_header_offset);
  3216 		}
  2555 	if (status != eap_status_ok)
  3217 
  2556 	{
  3218 		eapol_handle_tlv_message_data_c message_data(m_am_tools);
  2557 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3219 
  2558 		return EAP_STATUS_RETURN(m_am_tools, status);
  3220 		if (message_data.get_is_valid() == false)
  2559 	}
  3221 		{
  2560 
  3222 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2561 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3223 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2562 
  3224 		}
  2563 	++parameter_index;
  3225 
  2564 
  3226 		status = message_data.get_parameter_data(header_offset_value_parameter, &m_header_offset);
  2565 	status = message_data.read_parameter_data(parameters, parameter_index, &m_MTU);
  3227 		if (status != eap_status_ok)
  2566 	if (status != eap_status_ok)
  3228 		{
  2567 	{
  3229 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2568 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3230 			return EAP_STATUS_RETURN(m_am_tools, status);
  2569 		return EAP_STATUS_RETURN(m_am_tools, status);
  3231 		}
  2570 	}
  3232 	}
  2571 
  3233 
  2572 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3234 
  2573 
  3235 	++parameter_index;
  2574 	++parameter_index;
  3236 
  2575 
  3237 	{
  2576 	status = message_data.read_parameter_data(parameters, parameter_index, &m_trailer_length);
  3238 		const eap_tlv_header_c * const MTU_value_parameter
  2577 	if (status != eap_status_ok)
  3239 			= parameters->get_object(parameter_index);
  2578 	{
  3240 
  2579 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3241 		if (MTU_value_parameter == 0
  2580 		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 	}
  2581 	}
  3293 
  2582 
  3294 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2583 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3295 
  2584 
  3296 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2585 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3306 
  2595 
  3307 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2596 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3308 
  2597 
  3309 	eap_status_e status(eap_status_ok);
  2598 	eap_status_e status(eap_status_ok);
  3310 
  2599 
  3311 	u32_t parameter_index(eapol_message_payload_index_first_parameter);
  2600 	u32_t parameter_index(eap_message_payload_index_first_parameter);
  3312 
  2601 
  3313 	{
  2602 	eapol_handle_tlv_message_data_c message_data(m_am_tools);
  3314 		const eap_tlv_header_c * const reference_parameter
  2603 
  3315 			= parameters->get_object(parameter_index);
  2604 	if (message_data.get_is_valid() == false)
  3316 
  2605 	{
  3317 		if (reference_parameter == 0
  2606 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3318 			|| reference_parameter->get_type() != eapol_tlv_message_type_variable_data)
  2607 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  3319 		{
  2608 	}
  3320 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2609 
  3321 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
  2610 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3322 		}
  2611 
  3323 
  2612 	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);
  2613 	if (status != eap_status_ok)
  3325 
  2614 	{
  3326 		if (message_data.get_is_valid() == false)
  2615 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3327 		{
  2616 		return EAP_STATUS_RETURN(m_am_tools, status);
  3328 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2617 	}
  3329 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  2618 
  3330 		}
  2619 	status = m_wauth->set_eap_database_reference_values(&m_wlan_database_reference);
  3331 
  2620 	if (status != eap_status_ok)
  3332 		status = message_data.get_parameter_data(reference_parameter, &m_wlan_database_reference);
  2621 	{
  3333 		if (status != eap_status_ok)
  2622 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3334 		{
  2623 		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 	}
  2624 	}
  3339 
  2625 
  3340 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2626 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3341 
  2627 
  3342 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2628 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);