eapol/eapol_framework/eapol_common/common/eap_state_notification.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: 20.1.2 %
    19 * %version: %
    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"
    36 
    37 
    37 
    38 
    38 EAP_FUNC_EXPORT eap_state_notification_c::~eap_state_notification_c()
    39 EAP_FUNC_EXPORT eap_state_notification_c::~eap_state_notification_c()
    39 {
    40 {
       
    41 	delete m_send_network_id;
       
    42 	m_send_network_id = 0;
    40 }
    43 }
    41 
    44 
    42 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    45 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    43 	abs_eap_am_tools_c * const tools,
    46 	abs_eap_am_tools_c * const tools,
    44 	const eap_am_network_id_c * const send_network_id,
    47 	const eap_am_network_id_c * const send_network_id,
    56 	, m_needs_confirmation_from_user(false)
    59 	, m_needs_confirmation_from_user(false)
    57 	, m_protocol(protocol)
    60 	, m_protocol(protocol)
    58 	, m_eap_type(eap_type_none)
    61 	, m_eap_type(eap_type_none)
    59 	, m_previous_state(previous_state)
    62 	, m_previous_state(previous_state)
    60 	, m_current_state(current_state)
    63 	, m_current_state(current_state)
    61 	, m_send_network_id(send_network_id)
    64 	, m_send_network_id(0)
    62 	, m_is_client(is_client)
    65 	, m_is_client(is_client)
    63 	, m_eap_identifier(eap_identifier)
    66 	, m_eap_identifier(eap_identifier)
    64 	, m_allow_send_eap_success(allow_send_eap_success)
    67 	, m_allow_send_eap_success(allow_send_eap_success)
    65 	, m_authentication_error(eap_status_ok)
    68 	, m_authentication_error(eap_status_ok)
    66 {
    69 {
    67 }
    70 	if (send_network_id == 0
    68 
    71 		|| send_network_id->get_is_valid() == false)
    69 #if defined(USE_EAP_EXPANDED_TYPES)
    72 	{
       
    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 }
    70 
    88 
    71 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    89 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
    72 	abs_eap_am_tools_c * const tools,
    90 	abs_eap_am_tools_c * const tools,
    73 	const eap_am_network_id_c * const send_network_id,
    91 	const eap_am_network_id_c * const send_network_id,
    74 	bool is_client,
    92 	bool is_client,
    85 	, m_needs_confirmation_from_user(false)
   103 	, m_needs_confirmation_from_user(false)
    86 	, m_protocol(0ul)
   104 	, m_protocol(0ul)
    87 	, m_eap_type(eap_type)
   105 	, m_eap_type(eap_type)
    88 	, m_previous_state(previous_state)
   106 	, m_previous_state(previous_state)
    89 	, m_current_state(current_state)
   107 	, m_current_state(current_state)
    90 	, m_send_network_id(send_network_id)
   108 	, m_send_network_id(0)
    91 	, m_is_client(is_client)
   109 	, m_is_client(is_client)
    92 	, m_eap_identifier(eap_identifier)
   110 	, m_eap_identifier(eap_identifier)
    93 	, m_allow_send_eap_success(allow_send_eap_success)
   111 	, m_allow_send_eap_success(allow_send_eap_success)
    94 	, m_authentication_error(eap_status_ok)
   112 	, m_authentication_error(eap_status_ok)
    95 {
   113 {
    96 }
   114 	if (send_network_id == 0
    97 
   115 		|| send_network_id->get_is_valid() == false)
    98 #endif //#if defined(USE_EAP_EXPANDED_TYPES)
   116 	{
       
   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 }
    99 
   132 
   100 
   133 
   101 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
   134 EAP_FUNC_EXPORT eap_state_notification_c::eap_state_notification_c(
   102 	abs_eap_am_tools_c * const tools,
   135 	abs_eap_am_tools_c * const tools,
   103 	const eap_am_network_id_c * const send_network_id,
   136 	const eap_am_network_id_c * const send_network_id,
   115 	, m_needs_confirmation_from_user(false)
   148 	, m_needs_confirmation_from_user(false)
   116 	, m_protocol(0ul)
   149 	, m_protocol(0ul)
   117 	, m_eap_type(eap_type)
   150 	, m_eap_type(eap_type)
   118 	, m_previous_state(previous_state)
   151 	, m_previous_state(previous_state)
   119 	, m_current_state(current_state)
   152 	, m_current_state(current_state)
   120 	, m_send_network_id(send_network_id)
   153 	, m_send_network_id(0)
   121 	, m_is_client(is_client)
   154 	, m_is_client(is_client)
   122 	, m_eap_identifier(eap_identifier)
   155 	, m_eap_identifier(eap_identifier)
   123 	, m_allow_send_eap_success(allow_send_eap_success)
   156 	, m_allow_send_eap_success(allow_send_eap_success)
   124 	, m_authentication_error(eap_status_ok)
   157 	, m_authentication_error(eap_status_ok)
   125 {
   158 {
       
   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 	}
   126 }
   176 }
   127 
   177 
   128 EAP_FUNC_EXPORT const eap_am_network_id_c * eap_state_notification_c::get_send_network_id() const
   178 EAP_FUNC_EXPORT const eap_am_network_id_c * eap_state_notification_c::get_send_network_id() const
   129 {
   179 {
   130 	return m_send_network_id;
   180 	return m_send_network_id;
   369 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_WPXM_reassociation)
   419 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_WPXM_reassociation)
   370 #endif //#if defined(EAP_USE_WPXM)
   420 #endif //#if defined(EAP_USE_WPXM)
   371 #if defined(USE_WAPI_CORE)
   421 #if defined(USE_WAPI_CORE)
   372 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_wai_handshake)
   422 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_wai_handshake)
   373 #endif //#if defined(USE_WAPI_CORE)
   423 #endif //#if defined(USE_WAPI_CORE)
       
   424 		else EAP_IF_RETURN_STRING(protocol, eapol_key_handshake_type_authenticated)
   374 		else
   425 		else
   375 		{
   426 		{
   376 			return EAPL("Unknown EAPOL protocol");
   427 			return EAPL("Unknown EAPOL protocol");
   377 		}
   428 		}
   378 	}
   429 	}