eapol/eapol_framework/eapol_common/type/aka/core/eap_type_aka_state.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:23:57 +0100
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201029 Kit: 201035

/*
* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  EAP and WLAN authentication protocols.
*
*/

/*
* %version: 10 %
*/

// This is enumeration of EAPOL source code.
#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
	#undef EAP_FILE_NUMBER_ENUM
	#define EAP_FILE_NUMBER_ENUM 71 
	#undef EAP_FILE_NUMBER_DATE 
	#define EAP_FILE_NUMBER_DATE 1127594498 
#endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)


#include "eap_am_memory.h"
#include "eap_tools.h"
#include "eap_am_export.h"
#include "eap_base_type.h"
#include "eap_variable_data.h"
#include "eap_type_aka_header.h"
#include "eap_type_aka_types.h"
#include "eap_type_aka_payloads.h"
//#include "abs_eap_type_aka_state.h"
#include "abs_eap_base_timer.h"
#include "eap_type_aka_state.h"
#include "eap_crypto_api.h"
#include "eap_state_notification.h"

//--------------------------------------------------


EAP_FUNC_EXPORT eap_type_aka_state_variable_parameters_c::~eap_type_aka_state_variable_parameters_c()
{
}

EAP_FUNC_EXPORT eap_type_aka_state_variable_parameters_c::eap_type_aka_state_variable_parameters_c()
	: m_must_be_initiator(false)
	, m_must_be_responder(false)
	, m_dummy_1_for_alignment(0)
	, m_dummy_2_for_alignment(0)
{
	u32_t ind = 0;
	for (ind = 0; ind < AKA_STATE_MAX_TYPES; ind++)
	{
		m_valid_types[ind] = aka_subtype_NONE;
	}
}


EAP_FUNC_EXPORT bool eap_type_aka_state_variable_parameters_c::check_valid_types(aka_subtype_e type) const
{
	for (u32_t ind = 0u; ind < AKA_STATE_MAX_TYPES; ind++)
	{
		if (type == m_valid_types[ind])
		{
			return true;
		}
	}
	return false;
}

EAP_FUNC_EXPORT bool eap_type_aka_state_variable_parameters_c::check_initiator(const bool is_initiator) const
{
	if (m_must_be_initiator == true && is_initiator == false
		|| m_must_be_responder == true && is_initiator == true)
	{
		return false;
	}
	return true;
}

EAP_FUNC_EXPORT void eap_type_aka_state_variable_parameters_c::init_state(
	const bool must_be_initiator,
	const bool must_be_responder,
	const aka_subtype_e type0,
	const aka_subtype_e type1,
	const aka_subtype_e type2,
	const aka_subtype_e type3,
	const aka_subtype_e type4)
{
	m_must_be_initiator = (must_be_initiator);
	m_must_be_responder = (must_be_responder);
	m_valid_types[0] = (type0);
	m_valid_types[1] = (type1);
	m_valid_types[2] = (type2);
	m_valid_types[3] = (type3);
	m_valid_types[4] = (type4);
}


//-----------------------------------------------




// End.