eapol/eapol_framework/eapol_common/common/eap_state_notification.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: %
    19 * %version: 20.1.2 %
    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
    31 
    31 
    32 #include "eap_state_notification.h"
    32 #include "eap_state_notification.h"
    33 #include "eap_am_tools.h"
    33 #include "eap_am_tools.h"
    34 #include "eap_tools.h"
    34 #include "eap_tools.h"
    35 #include "eapol_key_types.h"
    35 #include "eapol_key_types.h"
    36 #include "eap_am_network_id.h"
       
    37 
    36 
    38 
    37 
    39 EAP_FUNC_EXPORT eap_state_notification_c::~eap_state_notification_c()
    38 EAP_FUNC_EXPORT eap_state_notification_c::~eap_state_notification_c()
    40 {
    39 {
    41 	delete m_send_network_id;
       
    42 	m_send_network_id = 0;
       
    43 }
    40 }
    44 
    41 
    45 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    42 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    46 	abs_eap_am_tools_c * const tools,
    43 	abs_eap_am_tools_c * const tools,
    47 	const eap_am_network_id_c * const send_network_id,
    44 	const eap_am_network_id_c * const send_network_id,
    59 	, m_needs_confirmation_from_user(false)
    56 	, m_needs_confirmation_from_user(false)
    60 	, m_protocol(protocol)
    57 	, m_protocol(protocol)
    61 	, m_eap_type(eap_type_none)
    58 	, m_eap_type(eap_type_none)
    62 	, m_previous_state(previous_state)
    59 	, m_previous_state(previous_state)
    63 	, m_current_state(current_state)
    60 	, m_current_state(current_state)
    64 	, m_send_network_id(0)
    61 	, m_send_network_id(send_network_id)
    65 	, m_is_client(is_client)
    62 	, m_is_client(is_client)
    66 	, m_eap_identifier(eap_identifier)
    63 	, m_eap_identifier(eap_identifier)
    67 	, m_allow_send_eap_success(allow_send_eap_success)
    64 	, m_allow_send_eap_success(allow_send_eap_success)
    68 	, m_authentication_error(eap_status_ok)
    65 	, m_authentication_error(eap_status_ok)
    69 {
    66 {
    70 	if (send_network_id == 0
    67 }
    71 		|| send_network_id->get_is_valid() == false)
    68 
    72 	{
    69 #if defined(USE_EAP_EXPANDED_TYPES)
    73 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
    74 		return;
       
    75 	}
       
    76 
       
    77 	m_send_network_id = send_network_id->copy();
       
    78 
       
    79 	if (m_send_network_id == 0
       
    80 		|| m_send_network_id->get_is_valid() == false)
       
    81 	{
       
    82 		delete m_send_network_id;
       
    83 		m_send_network_id = 0;
       
    84 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
    85 		return;
       
    86 	}
       
    87 }
       
    88 
    70 
    89 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    71 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    90 	abs_eap_am_tools_c * const tools,
    72 	abs_eap_am_tools_c * const tools,
    91 	const eap_am_network_id_c * const send_network_id,
    73 	const eap_am_network_id_c * const send_network_id,
    92 	bool is_client,
    74 	bool is_client,
   103 	, m_needs_confirmation_from_user(false)
    85 	, m_needs_confirmation_from_user(false)
   104 	, m_protocol(0ul)
    86 	, m_protocol(0ul)
   105 	, m_eap_type(eap_type)
    87 	, m_eap_type(eap_type)
   106 	, m_previous_state(previous_state)
    88 	, m_previous_state(previous_state)
   107 	, m_current_state(current_state)
    89 	, m_current_state(current_state)
   108 	, m_send_network_id(0)
    90 	, m_send_network_id(send_network_id)
   109 	, m_is_client(is_client)
    91 	, m_is_client(is_client)
   110 	, m_eap_identifier(eap_identifier)
    92 	, m_eap_identifier(eap_identifier)
   111 	, m_allow_send_eap_success(allow_send_eap_success)
    93 	, m_allow_send_eap_success(allow_send_eap_success)
   112 	, m_authentication_error(eap_status_ok)
    94 	, m_authentication_error(eap_status_ok)
   113 {
    95 {
   114 	if (send_network_id == 0
    96 }
   115 		|| send_network_id->get_is_valid() == false)
    97 
   116 	{
    98 #endif //#if defined(USE_EAP_EXPANDED_TYPES)
   117 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   118 		return;
       
   119 	}
       
   120 
       
   121 	m_send_network_id = send_network_id->copy();
       
   122 
       
   123 	if (m_send_network_id == 0
       
   124 		|| m_send_network_id->get_is_valid() == false)
       
   125 	{
       
   126 		delete m_send_network_id;
       
   127 		m_send_network_id = 0;
       
   128 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   129 		return;
       
   130 	}
       
   131 }
       
   132 
    99 
   133 
   100 
   134 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
   101 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
   135 	abs_eap_am_tools_c * const tools,
   102 	abs_eap_am_tools_c * const tools,
   136 	const eap_am_network_id_c * const send_network_id,
   103 	const eap_am_network_id_c * const send_network_id,
   148 	, m_needs_confirmation_from_user(false)
   115 	, m_needs_confirmation_from_user(false)
   149 	, m_protocol(0ul)
   116 	, m_protocol(0ul)
   150 	, m_eap_type(eap_type)
   117 	, m_eap_type(eap_type)
   151 	, m_previous_state(previous_state)
   118 	, m_previous_state(previous_state)
   152 	, m_current_state(current_state)
   119 	, m_current_state(current_state)
   153 	, m_send_network_id(0)
   120 	, m_send_network_id(send_network_id)
   154 	, m_is_client(is_client)
   121 	, m_is_client(is_client)
   155 	, m_eap_identifier(eap_identifier)
   122 	, m_eap_identifier(eap_identifier)
   156 	, m_allow_send_eap_success(allow_send_eap_success)
   123 	, m_allow_send_eap_success(allow_send_eap_success)
   157 	, m_authentication_error(eap_status_ok)
   124 	, m_authentication_error(eap_status_ok)
   158 {
   125 {
   159 	if (send_network_id == 0
       
   160 		|| send_network_id->get_is_valid() == false)
       
   161 	{
       
   162 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   163 		return;
       
   164 	}
       
   165 
       
   166 	m_send_network_id = send_network_id->copy();
       
   167 
       
   168 	if (m_send_network_id == 0
       
   169 		|| m_send_network_id->get_is_valid() == false)
       
   170 	{
       
   171 		delete m_send_network_id;
       
   172 		m_send_network_id = 0;
       
   173 		(void)EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   174 		return;
       
   175 	}
       
   176 }
   126 }
   177 
   127 
   178 EAP_FUNC_EXPORT const eap_am_network_id_c * eap_state_notification_c::get_send_network_id() const
   128 EAP_FUNC_EXPORT const eap_am_network_id_c * eap_state_notification_c::get_send_network_id() const
   179 {
   129 {
   180 	return m_send_network_id;
   130 	return m_send_network_id;
   419 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_WPXM_reassociation)
   369 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_WPXM_reassociation)
   420 #endif //#if defined(EAP_USE_WPXM)
   370 #endif //#if defined(EAP_USE_WPXM)
   421 #if defined(USE_WAPI_CORE)
   371 #if defined(USE_WAPI_CORE)
   422 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_wai_handshake)
   372 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_wai_handshake)
   423 #endif //#if defined(USE_WAPI_CORE)
   373 #endif //#if defined(USE_WAPI_CORE)
   424 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_authenticated)
       
   425 		else
   374 		else
   426 		{
   375 		{
   427 			return EAPL("Unknown EAPOL protocol");
   376 			return EAPL("Unknown EAPOL protocol");
   428 		}
   377 		}
   429 	}
   378 	}