eapol/eapol_framework/eapol_common/common/eap_master_session_key.cpp
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // This is enumeration of EAPOL source code.
       
    20 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    21 	#undef EAP_FILE_NUMBER_ENUM
       
    22 	#define EAP_FILE_NUMBER_ENUM 28 
       
    23 	#undef EAP_FILE_NUMBER_DATE 
       
    24 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    25 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    26 
       
    27 
       
    28 
       
    29 #include "eap_master_session_key.h"
       
    30 
       
    31 //--------------------------------------------------
       
    32 
       
    33 EAP_FUNC_EXPORT eap_master_session_key_c::~eap_master_session_key_c()
       
    34 {
       
    35 }
       
    36 
       
    37 EAP_FUNC_EXPORT eap_master_session_key_c::eap_master_session_key_c(
       
    38 	abs_eap_am_tools_c * const tools,
       
    39 	const eap_type_value_e eap_type)
       
    40 	: eap_variable_data_c(tools)
       
    41 	  , m_am_tools(tools)
       
    42 	  , m_leap_password(tools)
       
    43 	  , m_eap_type(eap_type)
       
    44 {
       
    45 }
       
    46 
       
    47 EAP_FUNC_EXPORT eap_type_value_e eap_master_session_key_c::get_eap_type() const
       
    48 {
       
    49 	return m_eap_type;
       
    50 }
       
    51 
       
    52 EAP_FUNC_EXPORT void eap_master_session_key_c::set_eap_type(eap_type_value_e type)
       
    53 {
       
    54 	m_eap_type = type;
       
    55 }
       
    56 
       
    57 EAP_FUNC_EXPORT eap_status_e eap_master_session_key_c::copy_leap_password(const eap_variable_data_c * const key)
       
    58 {
       
    59 	return m_leap_password.set_copy_of_buffer(key);
       
    60 }
       
    61 
       
    62 EAP_FUNC_EXPORT const eap_variable_data_c * eap_master_session_key_c::get_leap_password() const
       
    63 {
       
    64 	return &m_leap_password;
       
    65 }
       
    66 
       
    67 EAP_FUNC_EXPORT eap_status_e eap_master_session_key_c::set_copy(const eap_master_session_key_c * const msk)
       
    68 {
       
    69 	eap_status_e status = eap_variable_data_c::set_copy_of_buffer(msk);
       
    70 	if (status != eap_status_ok)
       
    71 	{
       
    72 		return EAP_STATUS_RETURN(m_am_tools, status);
       
    73 	}
       
    74 
       
    75 	if (msk->get_leap_password()->get_is_valid_data() == true)
       
    76 	{
       
    77 		status = m_leap_password.set_copy_of_buffer(msk->get_leap_password());
       
    78 		if (status != eap_status_ok)
       
    79 		{
       
    80 			return EAP_STATUS_RETURN(m_am_tools, status);
       
    81 		}
       
    82 	}
       
    83 
       
    84 	m_eap_type = msk->get_eap_type();
       
    85 
       
    86 	return EAP_STATUS_RETURN(m_am_tools, status);
       
    87 }
       
    88 
       
    89 //--------------------------------------------------
       
    90 
       
    91 
       
    92 
       
    93 // End.