eapol/eapol_framework/eapol_common/type/gsmsim/core/eap_type_gsmsim.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: 27.1.4 %
    19 * %version: 37 %
    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
   342 //-----------------------------------------------
   342 //-----------------------------------------------
   343 
   343 
   344 #if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK)
   344 #if !defined(NO_EAP_TYPE_GSMSIM_MESSAGE_STATE_CHECK)
   345 
   345 
   346 //
   346 //
   347 void eap_type_gsmsim_c::initialize_state(
   347 EAP_FUNC_EXPORT void eap_type_gsmsim_c::initialize_state(
   348 				const eap_type_gsmsim_state_variable_e state,
   348 				const eap_type_gsmsim_state_variable_e state,
   349 				const bool must_be_initiator,
   349 				const bool must_be_initiator,
   350 				const bool must_be_responder,
   350 				const bool must_be_responder,
   351 				const gsmsim_subtype_e type0,
   351 				const gsmsim_subtype_e type0,
   352 				const gsmsim_subtype_e type1,
   352 				const gsmsim_subtype_e type1,
   624 
   624 
   625 /**
   625 /**
   626  * This function saves the current m_state to m_saved_previous_state.
   626  * This function saves the current m_state to m_saved_previous_state.
   627  * The saved state is restored in error case.
   627  * The saved state is restored in error case.
   628  */
   628  */
   629 void eap_type_gsmsim_c::save_current_state()
   629 EAP_FUNC_EXPORT void eap_type_gsmsim_c::save_current_state()
   630 {
   630 {
   631 	m_saved_previous_state = m_state;
   631 	m_saved_previous_state = m_state;
   632 }
   632 }
   633 
   633 
   634 //--------------------------------------------------
   634 //--------------------------------------------------
   635 
   635 
   636 /**
   636 /**
   637  * This function restores the saved state.
   637  * This function restores the saved state.
   638  */
   638  */
   639 void eap_type_gsmsim_c::restore_saved_previous_state()
   639 EAP_FUNC_EXPORT void eap_type_gsmsim_c::restore_saved_previous_state()
   640 {
   640 {
   641 	set_state(m_saved_previous_state);
   641 	set_state(m_saved_previous_state);
   642 }
   642 }
   643 
   643 
   644 //--------------------------------------------------
   644 //--------------------------------------------------
  2717 			current_payload,
  2717 			current_payload,
  2718 			payload->get_payload_AT_string(),
  2718 			payload->get_payload_AT_string(),
  2719 			payload->get_payload_length(),
  2719 			payload->get_payload_length(),
  2720 			payload->get_reserved()));
  2720 			payload->get_reserved()));
  2721 
  2721 
  2722 		status = p_gsmsim_payloads->get_COUNTER_TOO_SMALL()->set_buffer(
  2722 		status = p_gsmsim_payloads->get_counter_too_small()->set_buffer(
  2723 			payload, 0, 0u, false, false);
  2723 			payload, 0, 0u, false, false);
  2724 
  2724 
  2725 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2725 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2726 		return EAP_STATUS_RETURN(m_am_tools, status);
  2726 		return EAP_STATUS_RETURN(m_am_tools, status);
  2727 	}
  2727 	}
  3662 	return EAP_STATUS_RETURN(m_am_tools, status);
  3662 	return EAP_STATUS_RETURN(m_am_tools, status);
  3663 }
  3663 }
  3664 
  3664 
  3665 
  3665 
  3666 //--------------------------------------------------
  3666 //--------------------------------------------------
  3667 
       
  3668 #if defined(USE_EAP_TRACE)
       
  3669 
  3667 
  3670 // 
  3668 // 
  3671 EAP_FUNC_EXPORT void eap_type_gsmsim_c::packet_trace(
  3669 EAP_FUNC_EXPORT void eap_type_gsmsim_c::packet_trace(
  3672 	eap_const_string prefix,
  3670 	eap_const_string prefix,
  3673 	const eap_am_network_id_c * const /* receive_network_id */,
  3671 	const eap_am_network_id_c * const /* receive_network_id */,
  3775 	}
  3773 	}
  3776 
  3774 
  3777 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3775 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  3778 }
  3776 }
  3779 
  3777 
  3780 #endif //#if defined(USE_EAP_TRACE)
       
  3781 
  3778 
  3782 //--------------------------------------------------
  3779 //--------------------------------------------------
  3783 
  3780 
  3784 // 
  3781 // 
  3785 EAP_FUNC_EXPORT eap_variable_data_c * eap_type_gsmsim_c::get_nai_realm()
  3782 EAP_FUNC_EXPORT eap_variable_data_c * eap_type_gsmsim_c::get_nai_realm()
  4654 	EAP_TRACE_DATA_DEBUG(
  4651 	EAP_TRACE_DATA_DEBUG(
  4655 		m_am_tools, 
  4652 		m_am_tools, 
  4656 		TRACE_FLAGS_DEFAULT, 
  4653 		TRACE_FLAGS_DEFAULT, 
  4657 		(EAPL("received: GSMSIM packet"),
  4654 		(EAPL("received: GSMSIM packet"),
  4658 		 received_gsmsim->get_header_buffer(
  4655 		 received_gsmsim->get_header_buffer(
  4659 			 received_gsmsim->get_header_length()+received_gsmsim->get_data_length()),
  4656 			 received_gsmsim->get_header_buffer_length()),
  4660 		 received_gsmsim->get_header_length()+received_gsmsim->get_data_length()));
  4657 		 received_gsmsim->get_header_buffer_length()));
  4661 
  4658 
  4662 	if (received_gsmsim->get_type() == eap_type_identity)
  4659 	if (received_gsmsim->get_type() == eap_type_identity)
  4663 	{
  4660 	{
  4664 		if (is_client_when_true == true)
  4661 		if (is_client_when_true == true)
  4665 		{
  4662 		{
  6477 		}
  6474 		}
  6478 	}
  6475 	}
  6479 
  6476 
  6480 	//----------------------------------------------------------
  6477 	//----------------------------------------------------------
  6481 
  6478 
  6482 #if defined(USE_EAP_EXPANDED_TYPES)
       
  6483 	{
  6479 	{
  6484 		eap_variable_data_c use_eap_expanded_type(m_am_tools);
  6480 		eap_variable_data_c use_eap_expanded_type(m_am_tools);
  6485 
  6481 
  6486 		eap_status_e status = read_configure(
  6482 		eap_status_e status = read_configure(
  6487 			cf_str_EAP_GSMSIM_use_eap_expanded_type.get_field(),
  6483 			cf_str_EAP_GSMSIM_use_eap_expanded_type.get_field(),
  6511 					m_use_eap_expanded_type = false;
  6507 					m_use_eap_expanded_type = false;
  6512 				}
  6508 				}
  6513 			}
  6509 			}
  6514 		}
  6510 		}
  6515 	}
  6511 	}
  6516 #endif //#if defined(USE_EAP_EXPANDED_TYPES)
       
  6517 
  6512 
  6518 	//----------------------------------------------------------
  6513 	//----------------------------------------------------------
  6519 
  6514 
  6520 	{
  6515 	{
  6521 		(void) read_configure(
  6516 		(void) read_configure(
  6792 	return EAP_STATUS_RETURN(m_am_tools, status);
  6787 	return EAP_STATUS_RETURN(m_am_tools, status);
  6793 }
  6788 }
  6794 
  6789 
  6795 //--------------------------------------------------
  6790 //--------------------------------------------------
  6796 
  6791 
  6797 //
       
  6798 EAP_FUNC_EXPORT eap_status_e eap_type_gsmsim_c::cancel_all_timers()
       
  6799 {
       
  6800 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  6801 
       
  6802 	EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true);
       
  6803 
       
  6804 	const eap_status_e status = get_type_partner()->cancel_all_timers();
       
  6805 
       
  6806 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  6807 	return EAP_STATUS_RETURN(m_am_tools, status);
       
  6808 }
       
  6809 
       
  6810 //--------------------------------------------------
       
  6811 
       
  6812 void eap_type_gsmsim_c::set_start_response_includes_identity(gsmsim_payload_AT_type_e type)
  6792 void eap_type_gsmsim_c::set_start_response_includes_identity(gsmsim_payload_AT_type_e type)
  6813 {
  6793 {
  6814 	EAP_TRACE_DEBUG(
  6794 	EAP_TRACE_DEBUG(
  6815 		m_am_tools,
  6795 		m_am_tools,
  6816 		TRACE_FLAGS_DEFAULT,
  6796 		TRACE_FLAGS_DEFAULT,