eapol/eapol_framework/eapol_symbian/am/type/protected_setup/symbian/plugin/src/EapProtectedSetup.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 176 
       
    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 // INCLUDE FILES
       
    29 
       
    30 #include "EapProtectedSetup.h"
       
    31 #include "eap_base_type.h"
       
    32 #include "simple_config_types.h"
       
    33 #include "eap_type_simple_config.h"
       
    34 #include "simple_config_record.h"
       
    35 #include "abs_eap_configuration_if.h"
       
    36 
       
    37 #include <EapTypeInfo.h>
       
    38 #include "eap_am_type_protected_setup_symbian.h"
       
    39 #include "EapProtectedSetupGlobal.h"
       
    40 #include "eap_am_trace_symbian.h"
       
    41 
       
    42 //#include "EapAkaDbUtils.h"
       
    43 
       
    44 #include "eap_am_tools_symbian.h"
       
    45 
       
    46 // LOCAL CONSTANTS
       
    47 
       
    48 // The version number of this interface.
       
    49 const TUint KInterfaceVersion = 1;
       
    50 
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =======================
       
    53 
       
    54 
       
    55 CEapProtectedSetup::CEapProtectedSetup(const TIndexType aIndexType,	
       
    56 				 const TInt aIndex)
       
    57 : iIndexType(aIndexType)
       
    58 , iIndex(aIndex)
       
    59 , iTunnelingType(eap_type_none)
       
    60 {
       
    61 	EAP_TRACE_DEBUG_SYMBIAN(
       
    62 		(_L("CEapProtectedSetup::CEapProtectedSetup index type=%d, index=%d, tunneling type=%d"),
       
    63 		iIndexType, iIndex, iTunnelingType.get_vendor_type()));
       
    64 
       
    65 }
       
    66 
       
    67 // ----------------------------------------------------------
       
    68 
       
    69 CEapProtectedSetup* CEapProtectedSetup::NewL(SIapInfo *aIapInfo)
       
    70 {
       
    71 	EAP_TRACE_DEBUG_SYMBIAN(
       
    72 		(_L("CEapProtectedSetup::NewL index type=%d, index=%d"),
       
    73 		aIapInfo->indexType, aIapInfo->index));
       
    74 
       
    75 	return new (ELeave) CEapProtectedSetup(aIapInfo->indexType, aIapInfo->index);
       
    76 }
       
    77 
       
    78 // ----------------------------------------------------------
       
    79 
       
    80 CEapProtectedSetup::~CEapProtectedSetup()
       
    81 {
       
    82 }
       
    83 
       
    84 // ----------------------------------------------------------
       
    85 
       
    86 eap_base_type_c* CEapProtectedSetup::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, 
       
    87 											abs_eap_base_type_c* const aPartner,
       
    88 											const bool is_client_when_true,
       
    89 											const eap_am_network_id_c * const receive_network_id,
       
    90 											abs_eap_configuration_if_c * const configuration_if)
       
    91 {
       
    92 	EAP_TRACE_DEBUG_SYMBIAN(
       
    93 		(_L("CEapProtectedSetup::GetStackInterfaceL - Start")));
       
    94 
       
    95 	// Create AM
       
    96 	eap_am_type_protected_setup_symbian_c* amEapType = eap_am_type_protected_setup_symbian_c::NewL(
       
    97 		aTools, 
       
    98 		aPartner, 
       
    99 		iIndexType,
       
   100 		iIndex,
       
   101 		iTunnelingType,
       
   102 		eap_expanded_type_simple_config.get_type(), 
       
   103 		is_client_when_true, 
       
   104 		receive_network_id,
       
   105 		configuration_if);
       
   106 
       
   107 	if (amEapType == 0 || amEapType->get_is_valid() == false)
       
   108 	{
       
   109 	
       
   110 		EAP_TRACE_DEBUG_SYMBIAN(
       
   111 			(_L("ERROR: GetStackInterfaceL : eap_am_type_protected_setup_symbian_c(): failed.")));
       
   112 	
       
   113 		delete amEapType;
       
   114 		User::Leave(KErrNoMemory);
       
   115 	}	
       
   116 	
       
   117 	simple_config_record_c* simple_config_record = new simple_config_record_c(
       
   118 		aTools,
       
   119 		amEapType,
       
   120 		false /*  NO Free */,
       
   121 		is_client_when_true,
       
   122 		receive_network_id);
       
   123 	
       
   124 	if (simple_config_record == 0
       
   125 		|| simple_config_record->get_is_valid() == false)
       
   126 	{
       
   127 	
       
   128 		EAP_TRACE_DEBUG_SYMBIAN(
       
   129 			(_L("ERROR: GetStackInterfaceL : simple_config_record_c(): failed.")));
       
   130 
       
   131 		EAP_TRACE_END(tools, TRACE_FLAGS_DEFAULT);
       
   132 
       
   133 		delete simple_config_record;
       
   134 		User::Leave(KErrNoMemory);
       
   135 	}	
       
   136 	
       
   137 	eap_base_type_c* type = 0;
       
   138 
       
   139 	type = new eap_type_simple_config_c(
       
   140 		aTools,
       
   141 		aPartner,
       
   142 		amEapType,
       
   143 		true, /* Free AM */		
       
   144 		simple_config_record,
       
   145 		true, /*Free record*/
       
   146 		is_client_when_true,		
       
   147 		eap_expanded_type_simple_config.get_type(), // This gets the EAP type (Protected Setup)	.
       
   148 		receive_network_id);
       
   149 	
       
   150 	if (type == 0)
       
   151 	{
       
   152 		EAP_TRACE_DEBUG_SYMBIAN(
       
   153 			(_L("ERROR: GetStackInterfaceL : eap_type_simple_config_c(): failed.")));
       
   154 	
       
   155 		// Out of memory
       
   156 		amEapType->shutdown();
       
   157 		delete amEapType;
       
   158 		
       
   159 		simple_config_record->shutdown();
       
   160 		delete simple_config_record;
       
   161 		
       
   162 		User::Leave(KErrNoMemory);
       
   163 	}
       
   164 	else if (type->get_is_valid() == false) 
       
   165 	{
       
   166 		EAP_TRACE_DEBUG_SYMBIAN(
       
   167 			(_L("ERROR: GetStackInterfaceL : type->get_is_valid(): not valid.")));
       
   168 		
       
   169 		type->shutdown();
       
   170 		// amEapType is freed by eap_type_simple_config_c
       
   171 		delete type;
       
   172 		
       
   173 		User::Leave(KErrGeneral);
       
   174 	}
       
   175 	
       
   176 	EAP_TRACE_DEBUG_SYMBIAN(
       
   177 		(_L("CEapProtectedSetup::GetStackInterfaceL - End")));
       
   178 	
       
   179 	return type;
       
   180 }
       
   181 
       
   182 // ----------------------------------------------------------
       
   183 TInt CEapProtectedSetup::InvokeUiL()
       
   184 {
       
   185 	EAP_TRACE_DEBUG_SYMBIAN(
       
   186 		(_L("ERROR: CEapProtectedSetup::InvokeUiL - THIS IS NOT SUPPORTED")));
       
   187 
       
   188 	TInt buttonId(0);
       
   189  
       
   190 	// This is a dummy function.
       
   191 	
       
   192 	return buttonId;
       
   193 }
       
   194 
       
   195 // ----------------------------------------------------------
       
   196 CEapTypeInfo* CEapProtectedSetup::GetInfoLC()
       
   197 {
       
   198 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
       
   199 		(TDesC&)KReleaseDate, 
       
   200 		(TDesC&)KEapTypeVersion,
       
   201 		(TDesC&)KManufacturer);
       
   202 
       
   203 	CleanupStack::PushL(info);
       
   204 	return info;
       
   205 }
       
   206 
       
   207 // ----------------------------------------------------------
       
   208 void CEapProtectedSetup::DeleteConfigurationL()
       
   209 {
       
   210 	EAP_TRACE_DEBUG_SYMBIAN(
       
   211 		(_L("ERROR: CEapProtectedSetup::DeleteConfigurationL - THIS IS NOT SUPPORTED")));
       
   212 }
       
   213 
       
   214 // ----------------------------------------------------------
       
   215 
       
   216 TUint CEapProtectedSetup::GetInterfaceVersion()
       
   217 {
       
   218 	return KInterfaceVersion;
       
   219 }
       
   220 
       
   221 // ----------------------------------------------------------
       
   222 
       
   223 void CEapProtectedSetup::SetTunnelingType(const TInt aTunnelingType)
       
   224 {
       
   225 	EAP_TRACE_DEBUG_SYMBIAN(
       
   226 		(_L("CEapProtectedSetup::SetTunnelingType - tunneling type=%d"),
       
   227 		aTunnelingType));
       
   228 
       
   229 	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
       
   230 	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
       
   231 }
       
   232 
       
   233 
       
   234 // ----------------------------------------------------------
       
   235 void CEapProtectedSetup::SetIndexL(
       
   236 		const TIndexType /*aIndexType*/, 
       
   237 		const TInt /*aIndex*/ )
       
   238 {
       
   239 	EAP_TRACE_DEBUG_SYMBIAN(
       
   240 		(_L("ERROR: CEapProtectedSetup::SetIndexL - THIS IS NOT SUPPORTED")));
       
   241 }
       
   242 
       
   243 // ----------------------------------------------------------
       
   244 
       
   245 void CEapProtectedSetup::SetConfigurationL(const EAPSettings& /*aSettings*/)
       
   246 {
       
   247 	EAP_TRACE_DEBUG_SYMBIAN(
       
   248 		(_L("ERROR: CEapProtectedSetup::SetConfigurationL - THIS IS NOT SUPPORTED")));
       
   249 }
       
   250 
       
   251 // ----------------------------------------------------------
       
   252 
       
   253 void CEapProtectedSetup::GetConfigurationL(EAPSettings& /*aSettings*/)
       
   254 {
       
   255 	EAP_TRACE_DEBUG_SYMBIAN(
       
   256 		(_L("ERROR: CEapProtectedSetup::GetConfigurationL - THIS IS NOT SUPPORTED")));
       
   257 }
       
   258 
       
   259 // ----------------------------------------------------------
       
   260 
       
   261 void CEapProtectedSetup::CopySettingsL(
       
   262 	const TIndexType /*aDestinationIndexType*/,
       
   263 	const TInt /*aDestinationIndex*/)
       
   264 {
       
   265 	EAP_TRACE_DEBUG_SYMBIAN(
       
   266 		(_L("ERROR: CEapProtectedSetup::CopySettingsL - THIS IS NOT SUPPORTED")));
       
   267 }
       
   268 
       
   269 // End of file