eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeap.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: 67 %
    19 * %version: 35.1.3 %
    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
    33 #include "EapTlsPeap.h"
    33 #include "EapTlsPeap.h"
    34 #include "eap_base_type.h"
    34 #include "eap_base_type.h"
    35 #include "EapTlsPeapGlobal.h"
    35 #include "EapTlsPeapGlobal.h"
    36 #include <EapTypeInfo.h>
    36 #include <EapTypeInfo.h>
    37 
    37 
       
    38 #include <EapTlsPeapUiConnection.h>
       
    39 #include <EapTlsUi.h>
       
    40 #include <EapPeapUi.h>
       
    41 #if defined(USE_TTLS_EAP_TYPE)
       
    42 	#include <EapTtlsUi.h>
       
    43 #endif
       
    44 
    38 #if defined(USE_FAST_EAP_TYPE)
    45 #if defined(USE_FAST_EAP_TYPE)
       
    46 #include <eapfastui.h>
    39 #include "tls_application_eap_fast.h"
    47 #include "tls_application_eap_fast.h"
    40 #endif 
    48 #endif 
    41 
    49 
    42 #include "eap_am_type_tls_peap_symbian.h"
    50 #include "eap_am_type_tls_peap_symbian.h"
    43 #include "eap_type_tls_peap.h"
    51 #include "eap_type_tls_peap.h"
    44 #include "tls_record.h"
    52 #include "tls_record.h"
    45 #include "dummy_eap_core.h"
       
    46 #include "eap_core.h"
    53 #include "eap_core.h"
    47 #include "tls_application_eap_core.h"
    54 #include "tls_application_eap_core.h"
    48 #include "eap_am_tools_symbian.h"
    55 #include "eap_am_tools_symbian.h"
    49 #include "EapTraceSymbian.h"
    56 #include "eap_am_trace_symbian.h"
    50 #include "EapConversion.h"
       
    51 #include "EapExpandedType.h"
       
    52 
    57 
    53 #ifdef USE_PAC_STORE
    58 #ifdef USE_PAC_STORE
    54 #include "pac_store_db_symbian.h"
    59 #include "pac_store_db_symbian.h"
    55 #endif
    60 #endif
    56 
    61 
    57 #include "eapol_key_types.h"
    62 #include <papui.h>
    58 
    63 
    59 // LOCAL CONSTANTS
    64 // LOCAL CONSTANTS
    60 
    65 
    61 // The version number of this interface. At the moment this version number is
    66 // The version number of this interface. At the moment this version number is
    62 // common for all three plug-in interfaces.
    67 // common for all three plug-in interfaces.
    63 const TUint KInterfaceVersion = 1;
    68 const TUint KInterfaceVersion = 1;
    64 
    69 
    65 #if defined(USE_FAST_EAP_TYPE)
       
    66 	const u8_t EAP_RAS_SOURCE[] = "ras_src";
       
    67 	const u8_t EAP_RAS_DESTINATION[] = "ras_des";
       
    68 #endif //#if defined(USE_FAST_EAP_TYPE)
       
    69 
    70 
    70 // ================= MEMBER FUNCTIONS =======================
    71 // ================= MEMBER FUNCTIONS =======================
    71 
    72 
    72 
    73 
    73 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType,	
    74 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType,	
    75 				 const eap_type_value_e aEapType)
    76 				 const eap_type_value_e aEapType)
    76 : iIndexType(aIndexType)
    77 : iIndexType(aIndexType)
    77 , iIndex(aIndex)
    78 , iIndex(aIndex)
    78 , iEapType(aEapType)
    79 , iEapType(aEapType)
    79 , iTunnelingType(eap_type_none)
    80 , iTunnelingType(eap_type_none)
    80 #if defined(USE_FAST_EAP_TYPE)
    81 {
    81 , iApplication(NULL)
    82 
    82 #endif
    83 #ifdef USE_EAP_EXPANDED_TYPES
    83 , m_am_tools(abs_eap_am_tools_c::new_abs_eap_am_tools_c())
    84 
    84 {
    85 	ASSERT(iEapType.get_vendor_id() == eap_type_vendor_id_ietf);
    85 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CEapTlsPeap()\n")));
    86 	ASSERT(iTunnelingType.get_vendor_id() == eap_type_vendor_id_ietf);
    86 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CEapTlsPeap()\n"));
    87 
    87 
    88 #endif //#ifdef USE_EAP_EXPANDED_TYPES
    88 	if (m_am_tools == 0)
       
    89 	{
       
    90 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    91 		return;
       
    92 	}
       
    93 
       
    94 #if defined(USE_FAST_EAP_TYPE)
       
    95 	if(iEapType == eap_type_fast)
       
    96 	{
       
    97 		eap_variable_data_c source(m_am_tools);
       
    98 
       
    99 		eap_status_e status = source.set_copy_of_buffer(
       
   100 			EAP_RAS_SOURCE,
       
   101 			sizeof(EAP_RAS_SOURCE));
       
   102 		if (status != eap_status_ok)
       
   103 		{
       
   104 			EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::CEapTlsPeap(): status = %s\n"),
       
   105 				eap_status_string_c::get_status_string(status)));
       
   106 			return;
       
   107 		}
       
   108 
       
   109 		eap_variable_data_c destination(m_am_tools);
       
   110 
       
   111 		status = destination.set_copy_of_buffer(
       
   112 			EAP_RAS_DESTINATION,
       
   113 			sizeof(EAP_RAS_DESTINATION));
       
   114 		if (status != eap_status_ok)
       
   115 		{
       
   116 			EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::CEapTlsPeap(): status = %s\n"),
       
   117 				eap_status_string_c::get_status_string(status)));
       
   118 			return;
       
   119 		}
       
   120 
       
   121 		eap_am_network_id_c dummy_id(m_am_tools, &source, &destination, eapol_ethernet_type_pae);
       
   122 	
       
   123 		if (dummy_id.get_is_valid() == false)
       
   124 		{
       
   125 			EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() dummy_id not valid\n")));
       
   126 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   127 			return;
       
   128 		}
       
   129 	
       
   130 		if (dummy_id.get_is_valid_data() == false)
       
   131 		{
       
   132 			EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() dummy_id data not valid\n")));
       
   133 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   134 			return;
       
   135 		}
       
   136 	
       
   137 		
       
   138 		TRAPD(err, iApplication = GetTlsInterfaceL(
       
   139 			m_am_tools, 
       
   140 			true,
       
   141 			&dummy_id));
       
   142 		if (err)
       
   143 		{
       
   144 			EAP_TRACE_DEBUG_SYMBIAN((_L("ERROR: CEapTlsPeap::NewPeapL() iApplication couldn't be created\n")));
       
   145 				
       
   146 		}
       
   147 	}
       
   148 #endif //#if defined(USE_FAST_EAP_TYPE)
       
   149 
       
   150 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   151 
    89 
   152 }
    90 }
   153 
    91 
   154 // ----------------------------------------------------------
    92 // ----------------------------------------------------------
   155 
    93 
   156 CEapTlsPeap* CEapTlsPeap::NewTlsL(SIapInfo *aIapInfo)
    94 CEapTlsPeap* CEapTlsPeap::NewTlsL(SIapInfo *aIapInfo)
   157 {
    95 {
   158 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTlsL()\n")));
       
   159 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTlsL()\n"));
       
   160 
       
   161 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls);
    96 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls);
   162 }
    97 }
   163 
    98 
   164 // ----------------------------------------------------------
    99 // ----------------------------------------------------------
   165 
   100 
   166 CEapTlsPeap* CEapTlsPeap::NewPeapL(SIapInfo *aIapInfo)
   101 CEapTlsPeap* CEapTlsPeap::NewPeapL(SIapInfo *aIapInfo)
   167 {
   102 {
   168 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewPeapL()\n")));
       
   169 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewPeapL()\n"));
       
   170 
       
   171 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap);
   103 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap);
   172 }
   104 }
   173 
   105 
   174 // ----------------------------------------------------------
   106 // ----------------------------------------------------------
   175 
   107 
   176 #if defined(USE_TTLS_EAP_TYPE)
   108 #if defined(USE_TTLS_EAP_TYPE)
   177 
   109 
   178 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SIapInfo *aIapInfo)
   110 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SIapInfo *aIapInfo)
   179 {
   111 {
   180 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsL()\n")));
       
   181 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsL()\n"));
       
   182 
       
   183 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls);
   112 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls);
   184 }
   113 }
   185 
   114 
   186 #endif // #if defined(USE_TTLS_EAP_TYPE)
   115 #endif // #if defined(USE_TTLS_EAP_TYPE)
   187 
   116 
   193 // ---------------------------------------------------------
   122 // ---------------------------------------------------------
   194 // 
   123 // 
   195 
   124 
   196 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SIapInfo* aIapInfo )
   125 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SIapInfo* aIapInfo )
   197     {
   126     {
   198 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsPapL()\n")));
       
   199 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsPapL()\n"));
       
   200 
       
   201 	return new (ELeave) CEapTlsPeap(
   127 	return new (ELeave) CEapTlsPeap(
   202 		aIapInfo->indexType, aIapInfo->index, eap_expanded_type_ttls_plain_pap.get_type() );    
   128 		aIapInfo->indexType, aIapInfo->index, eap_type_ttls_plain_pap );    
   203     }
   129     }
   204 
   130 
   205 
   131 
   206 // ----------------------------------------------------------
   132 // ----------------------------------------------------------
   207 
   133 
   208 #if defined(USE_FAST_EAP_TYPE)
   134 #if defined(USE_FAST_EAP_TYPE)
   209 
   135 
   210 CEapTlsPeap* CEapTlsPeap::NewFastL(SIapInfo *aIapInfo)
   136 CEapTlsPeap* CEapTlsPeap::NewFastL(SIapInfo *aIapInfo)
   211 {
   137 {
   212 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewFastL()\n")));
       
   213 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewFastL()\n"));
       
   214 
       
   215 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast);
   138 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast);
   216 }
   139 }
   217 
   140 
   218 #endif // #if defined(USE_FAST_EAP_TYPE)
   141 #endif // #if defined(USE_FAST_EAP_TYPE)
   219 
   142 
   220 // ----------------------------------------------------------
   143 // ----------------------------------------------------------
   221 
   144 
   222 CEapTlsPeap::~CEapTlsPeap()
   145 CEapTlsPeap::~CEapTlsPeap()
   223 {
   146 {
   224 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap()\n")));
       
   225 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::~CEapTlsPeap()\n"));
       
   226 
       
   227 	iEapArray.ResetAndDestroy();
   147 	iEapArray.ResetAndDestroy();
   228 	
   148 }
   229 	if (iType != NULL)
   149 
   230 		{
       
   231 		iType->shutdown();
       
   232 		// type deletes all
       
   233 		delete iType;
       
   234 		iType = NULL;
       
   235 		}
       
   236 		
       
   237 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap() iType deleted\n")));
       
   238 
       
   239 #if defined(USE_FAST_EAP_TYPE)
       
   240 	if (iApplication != NULL)
       
   241 		{
       
   242 //		iApplication->shutdown();
       
   243 //		delete iApplication;
       
   244 		iApplication = NULL;
       
   245 		}
       
   246 #endif //#if defined(USE_FAST_EAP_TYPE)
       
   247 		
       
   248 	abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools);
       
   249 }
       
   250 
       
   251 #if defined(USE_FAST_EAP_TYPE)
       
   252 // ----------------------------------------------------------
       
   253 tls_application_eap_fast_c* CEapTlsPeap::GetTlsInterfaceL(abs_eap_am_tools_c* const aTools, 
       
   254 											   const bool is_client_when_true,
       
   255 											   const eap_am_network_id_c * const receive_network_id)
       
   256 {
       
   257 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetTlsInterfaceL()\n")));
       
   258 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetTlsInterfaceL()\n"));
       
   259 
       
   260 	EAP_TRACE_DEBUG_SYMBIAN(
       
   261 		(_L("CEapTlsPeap::GetTlsInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
       
   262 		iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type()));
       
   263 
       
   264 	// Create adaptation layer
       
   265 	eap_am_type_tls_peap_symbian_c* amEapType;
       
   266 	tls_record_c* record;
       
   267 
       
   268 	eap_core_c* const eap_core = reinterpret_cast<eap_core_c *> (new dummy_eap_core_c(
       
   269 		aTools,
       
   270 		0,
       
   271 		is_client_when_true,
       
   272 		receive_network_id,
       
   273 		true));
       
   274 	if (eap_core == 0)
       
   275 	{
       
   276 		// Out of memory
       
   277 		User::Leave(KErrNoMemory);
       
   278 	} 
       
   279 	else if (eap_core->get_is_valid() == false)
       
   280 	{
       
   281 		// Out of memory
       
   282 		eap_core->shutdown();
       
   283 		delete eap_core;
       
   284 		User::Leave(KErrGeneral);
       
   285 	}
       
   286 	
       
   287 	EAP_TRACE_DEBUG_SYMBIAN(
       
   288 		(_L("CEapTlsPeap::GetTlsInterfaceL - created eap_core_c \n")));
       
   289 
       
   290 	amEapType = eap_am_type_tls_peap_symbian_c::NewL(
       
   291 		aTools,
       
   292 		eap_core,
       
   293 		iIndexType,
       
   294 		iIndex,
       
   295 		iTunnelingType,
       
   296 		iEapType,
       
   297 		is_client_when_true,
       
   298 		receive_network_id);
       
   299 	if (amEapType->get_is_valid() == false)
       
   300 	{
       
   301 		amEapType->shutdown();
       
   302 		delete amEapType;
       
   303 		User::Leave(KErrGeneral);
       
   304 	}
       
   305 	
       
   306 	amEapType->configure();
       
   307 	
       
   308 	EAP_TRACE_DEBUG_SYMBIAN(
       
   309 		(_L("CEapTlsPeap::GetTlsInterfaceL - created eap_am_type_tls_peap_symbian_c \n")));
       
   310 
       
   311 	tls_application_eap_fast_c* application = 0;
       
   312 		
       
   313 	if(iEapType == eap_type_fast)
       
   314 	{
       
   315 		application = new tls_application_eap_fast_c(
       
   316 			aTools,
       
   317 			eap_core,
       
   318 			true,
       
   319 			is_client_when_true,
       
   320 			iEapType,
       
   321 			receive_network_id,
       
   322 			amEapType);
       
   323 		
       
   324 		if (application)
       
   325 			{
       
   326 			application->configure();
       
   327 		
       
   328 			EAP_TRACE_DEBUG_SYMBIAN(
       
   329 				(_L("CEapTlsPeap::GetTlsInterfaceL - created tls_application_eap_fast_c \n")));			
       
   330 			application->start_initialize_PAC_store();
       
   331 			}
       
   332 	}
       
   333 
       
   334 
       
   335 	EAP_TRACE_DEBUG_SYMBIAN(
       
   336 		(_L("CEapTlsPeap::GetTlsInterfaceL - Creating tls_record_c \n")));
       
   337 
       
   338 	record = new tls_record_c(
       
   339 		aTools,
       
   340 		amEapType,
       
   341 		false,
       
   342 		application,
       
   343 		true,
       
   344 		is_client_when_true,
       
   345 		iEapType,
       
   346 		receive_network_id);		
       
   347 	if (record == 0)
       
   348 	{
       
   349 		// Out of memory
       
   350 		// application takes care of eap_core_c deletion
       
   351 		application->shutdown();
       
   352 		delete application;
       
   353 		amEapType->shutdown();
       
   354 		delete amEapType;
       
   355 		User::Leave(KErrGeneral);		
       
   356 	}
       
   357 	else if (record->get_is_valid() == false)
       
   358 	{
       
   359 		// Out of memory
       
   360 		// record takes care of application deletion
       
   361 		record->shutdown();
       
   362 		delete record;
       
   363 		amEapType->shutdown();
       
   364 		delete amEapType;
       
   365 		User::Leave(KErrGeneral);					
       
   366 	}	
       
   367 
       
   368 	EAP_TRACE_DEBUG_SYMBIAN(
       
   369 		(_L("CEapTlsPeap::GetTlsInterfaceL - Creating the OS independent portion - eap_type_tls_peap_c \n")));
       
   370 	
       
   371 	// Create the OS independent portion
       
   372 	
       
   373 	iType = new eap_type_tls_peap_c(
       
   374 		aTools, 
       
   375 		eap_core, 
       
   376 		amEapType, 
       
   377 		true, 
       
   378 		record, 
       
   379 		true, 
       
   380 		is_client_when_true, 
       
   381 		iEapType, 
       
   382 		receive_network_id);	
       
   383 	if (iType == 0)
       
   384 	{
       
   385 		// Out of memory
       
   386 		// record takes care of application deletion
       
   387 		record->shutdown();
       
   388 		delete record;
       
   389 		amEapType->shutdown();
       
   390 		delete amEapType;
       
   391 		User::Leave(KErrNoMemory);							
       
   392 	}
       
   393 	else if(iType->get_is_valid() == false)
       
   394 	{
       
   395 		iType->shutdown();
       
   396 		// type deletes all
       
   397 		delete iType;
       
   398 		iType = NULL;
       
   399 		User::Leave(KErrGeneral);		
       
   400 	}
       
   401 	
       
   402 	return application;
       
   403 }
       
   404 #endif
       
   405 // ----------------------------------------------------------
   150 // ----------------------------------------------------------
   406 
   151 
   407 #ifdef USE_EAP_SIMPLE_CONFIG
   152 #ifdef USE_EAP_SIMPLE_CONFIG
   408 
   153 
   409 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, 
   154 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, 
   419 											const bool is_client_when_true,
   164 											const bool is_client_when_true,
   420 											const eap_am_network_id_c * const receive_network_id)
   165 											const eap_am_network_id_c * const receive_network_id)
   421 	
   166 	
   422 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
   167 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
   423 {
   168 {
   424 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetStackInterfaceL()\n")));
   169 #ifdef USE_EAP_EXPANDED_TYPES
   425 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetStackInterfaceL()\n"));
   170 	
   426 
       
   427 	EAP_TRACE_DEBUG_SYMBIAN(
   171 	EAP_TRACE_DEBUG_SYMBIAN(
   428 		(_L("CEapTlsPeap::GetStackInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
   172 		(_L("CEapTlsPeap::GetStackInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
   429 		iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type()));
   173 		iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type()));
       
   174 	
       
   175 #else
       
   176 	
       
   177 	EAP_TRACE_DEBUG_SYMBIAN(
       
   178 		(_L("CEapTlsPeap::GetStackInterfaceL -Start- iIndexType=%d, iIndex=%d, iTunnelingType=%d, iEapType=%d \n"),
       
   179 		iIndexType, iIndex, iTunnelingType, iEapType));
       
   180 	
       
   181 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   430 
   182 
   431 	// Create adaptation layer
   183 	// Create adaptation layer
   432 	eap_am_type_tls_peap_symbian_c* amEapType;
   184 	eap_am_type_tls_peap_symbian_c* amEapType;
   433 	eap_base_type_c* type;
   185 	eap_base_type_c* type;
   434 	tls_record_c* record;
   186 	tls_record_c* record;
   631 	
   383 	
   632 	return type;
   384 	return type;
   633 }
   385 }
   634 
   386 
   635 // ----------------------------------------------------------
   387 // ----------------------------------------------------------
   636 
   388 TInt CEapTlsPeap::InvokeUiL()
   637 CEapTypeInfo* CEapTlsPeap::GetInfoL()
   389 {
   638 {
   390 	TInt buttonId(0);
   639 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetInfoL()\n")));
   391 
   640 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetInfoL()\n"));
   392 #ifdef USE_EAP_EXPANDED_TYPES
   641 
   393 
       
   394 	EAP_TRACE_DEBUG_SYMBIAN(
       
   395 		(_L("CEapTlsPeap::InvokeUiL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
       
   396 		iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type()));
       
   397 
       
   398 	CEapTlsPeapUiConnection uiConn(iIndexType, iIndex, 
       
   399 									iTunnelingType.get_vendor_type(), iEapType.get_vendor_type());
       
   400 	
       
   401 #else
       
   402 
       
   403 	EAP_TRACE_DEBUG_SYMBIAN(
       
   404 		(_L("CEapTlsPeap::InvokeUiL -Start- iIndexType=%d, iIndex=%d, iTunnelingType=%d, iEapType=%d \n"),
       
   405 		iIndexType, iIndex, iTunnelingType, iEapType));
       
   406 
       
   407     CEapTlsPeapUiConnection uiConn(iIndexType, iIndex, iTunnelingType, iEapType);
       
   408 
       
   409 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   410 
       
   411 	EAP_TRACE_DEBUG_SYMBIAN(
       
   412 			(_L("CEapTlsPeap::InvokeUiL Created UI connection \n")));
       
   413 
       
   414 #ifdef USE_EAP_EXPANDED_TYPES
       
   415 
       
   416 	switch (iEapType.get_vendor_type())
       
   417 	
       
   418 #else
       
   419 
       
   420 	switch (iEapType)
       
   421 
       
   422 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   423 	{
       
   424 	case eap_type_tls:
       
   425 		{
       
   426 			CEapTlsUi* tls_ui = CEapTlsUi::NewL(&uiConn);	
       
   427 			CleanupStack::PushL(tls_ui);
       
   428 			buttonId = tls_ui->InvokeUiL();
       
   429 			CleanupStack::PopAndDestroy(tls_ui);	
       
   430 		}
       
   431 		break;
       
   432 
       
   433 	case eap_type_peap:
       
   434 		{
       
   435 			CEapPeapUi* peap_ui = CEapPeapUi::NewL(&uiConn, iIndexType, iIndex);
       
   436 			CleanupStack::PushL(peap_ui);
       
   437 			buttonId = peap_ui->InvokeUiL();
       
   438 			CleanupStack::PopAndDestroy(peap_ui);
       
   439 		}
       
   440 		break;
       
   441 
       
   442 #if defined (USE_TTLS_EAP_TYPE)
       
   443 	case eap_type_ttls:
       
   444 		{
       
   445 			CEapTtlsUi* ttls_ui = CEapTtlsUi::NewL(&uiConn, iIndexType, iIndex);
       
   446 			CleanupStack::PushL(ttls_ui);
       
   447 			buttonId = ttls_ui->InvokeUiL();
       
   448 			CleanupStack::PopAndDestroy(ttls_ui);
       
   449 		}
       
   450 		break;
       
   451 #endif
       
   452 
       
   453 #if defined (USE_FAST_EAP_TYPE)
       
   454 	case eap_type_fast:
       
   455 		{
       
   456 			CEapFastUi* fast_ui = CEapFastUi::NewL(&uiConn, iIndexType, iIndex);
       
   457 			CleanupStack::PushL(fast_ui);
       
   458 			buttonId = fast_ui->InvokeUiL();
       
   459 			CleanupStack::PopAndDestroy(fast_ui);
       
   460 		}
       
   461 		break;
       
   462 #endif
       
   463 		
       
   464 	case eap_type_ttls_plain_pap:
       
   465 	    {
       
   466 	        CPapUi* papUi = CPapUi::NewL( &uiConn );
       
   467 	        CleanupStack::PushL( papUi );
       
   468 	        buttonId = papUi->InvokeUiL();
       
   469 	        CleanupStack::PopAndDestroy( papUi );
       
   470 	    }
       
   471 	    break;
       
   472 
       
   473 	default:
       
   474 		// Should never happen
       
   475 		User::Leave(KErrArgument);
       
   476 	}
       
   477 	
       
   478 	EAP_TRACE_DEBUG_SYMBIAN(
       
   479 			(_L("CEapTlsPeap::InvokeUiL -End-\n")));
       
   480 	
       
   481 	return buttonId;
       
   482 }
       
   483 // ----------------------------------------------------------
       
   484 CEapTypeInfo* CEapTlsPeap::GetInfoLC()
       
   485 {
   642 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo((TDesC&)KReleaseDate, (TDesC&)KEapTypeVersion,
   486 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo((TDesC&)KReleaseDate, (TDesC&)KEapTypeVersion,
   643 												   (TDesC&)KManufacturer);
   487 												   (TDesC&)KManufacturer);
   644 
   488 	CleanupStack::PushL(info);
   645 	return info;
   489 	return info;
   646 }
   490 }
   647 
   491 
   648 // ----------------------------------------------------------
   492 // ----------------------------------------------------------
   649 
   493 
   650 void CEapTlsPeap::DeleteConfigurationL()
   494 void CEapTlsPeap::DeleteConfigurationL()
   651 {
   495 {
   652 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL()\n")));
   496 #ifdef USE_EAP_EXPANDED_TYPES
   653 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::DeleteConfigurationL()\n"));
   497 	
   654 
       
   655 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   498 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   656 	TUint aEapVendorType = iEapType.get_vendor_type();
   499 	TUint aEapVendorType = iEapType.get_vendor_type();
       
   500 	
       
   501 #else
       
   502 	
       
   503 	TUint aTunnelingVendorType = static_cast<TUint>(iTunnelingType);
       
   504 	TUint aEapVendorType = static_cast<TUint>(iEapType);
       
   505 	
       
   506 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   657 
   507 
   658 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   508 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   659 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   509 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   660 
   510 
   661     EapTlsPeapUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType, iEapType);
   511     EapTlsPeapUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType, iEapType);
   667 
   517 
   668 #ifdef USE_FAST_EAP_TYPE
   518 #ifdef USE_FAST_EAP_TYPE
   669 		|| iEapType == eap_type_fast
   519 		|| iEapType == eap_type_fast
   670 #endif		
   520 #endif		
   671 
   521 
   672 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
   522 		|| iEapType == eap_type_ttls_plain_pap
   673 
   523 
   674 
   524 
   675 	) 
   525 	) 
   676 	{
   526 	{
   677 		iEapArray.ResetAndDestroy();
   527 		iEapArray.ResetAndDestroy();
   678 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   528 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   679 			
   529 			
   680 		for (TInt i = 0; i < iEapArray.Count(); i++)
   530 		for (TInt i = 0; i < iEapArray.Count(); i++)
   681 		{
   531 		{
   682 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
   532 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
   683 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
   533 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
   684 				
   534 				
   685 #ifdef USE_FAST_EAP_TYPE
   535 #ifdef USE_FAST_EAP_TYPE
   686 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   536 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
   687 #endif						
   537 #endif						
   688 
   538 
   689 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   539 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
   690 					
   540 					
   691 
   541 
   692 			)
   542 			)
   693 			{
   543 			{
   694 				// Deleting the encapsulated EAP type configurations possible inside PEAP, TTLS and FAST.
   544 				// Deleting the encapsulated EAP type configurations possible inside PEAP, TTLS and FAST.
   695 
   545 
   696 				EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Deleting encapsulated types for EAP type=%d"),
   546 				EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Deleting encapsulated types for EAP type=%d"),
   697 						aEapVendorType));
   547 						aEapVendorType));
   698 			
   548 			
   699 				CEapTypePlugin* eapType;
   549 				CEapType* eapType;
   700 			
   550 			
   701 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
   551 #ifdef USE_EAP_EXPANDED_TYPES		
       
   552 			
       
   553 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
   702 			
   554 			
   703 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::DeleteConfigurationL: Expanded cue:",
   555 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::DeleteConfigurationL: Expanded cue:",
   704 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
   556 				expandedCue.Ptr(), expandedCue.Size()));
   705 			
   557 			
   706 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
   558 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
   707 				
   559 				
   708 				if(eapType == NULL)
   560 				if(eapType == NULL)
   709 				{
   561 				{
   710 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Ecom Error - No specified Expanded EAP plugin")) );
   562 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Ecom Error - No specified Expanded EAP plugin")) );
   711 					User::Leave(KErrNotFound);
   563 					User::Leave(KErrNotFound);
   712 				}
   564 				}
   713 				
   565 				
   714 //				eapType->SetTunnelingType(iEapType.get_vendor_type());						
   566 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
   715 			    TEapExpandedType aExpandedType;
       
   716 			    
       
   717                 TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
       
   718 			            &iEapType,
       
   719 			            &aExpandedType);
       
   720 
       
   721 			    eapType->SetTunnelingType(aExpandedType);
       
   722 
   567 
   723 #ifdef USE_FAST_EAP_TYPE
   568 #ifdef USE_FAST_EAP_TYPE
   724 				
   569 				
   725 				// This IAP is deleted. Update the PAC store cleanup table if this IAP is 
   570 				// This IAP is deleted. Update the PAC store cleanup table if this IAP is 
   726 				// for EAP-FAST.
   571 				// for EAP-FAST.
   747 #endif // #ifdef USE_PAC_STORE
   592 #endif // #ifdef USE_PAC_STORE
   748 					
   593 					
   749 				}
   594 				}
   750 				
   595 				
   751 #endif // #ifdef USE_FAST_EAP_TYPE
   596 #endif // #ifdef USE_FAST_EAP_TYPE
   752 	
   597 #endif // USE_EAP_EXPANDED_TYPES		
       
   598 	
       
   599 
       
   600 #ifndef USE_EAP_EXPANDED_TYPES		
       
   601 //#else // For normal EAP types.
       
   602 			
       
   603 				TBuf8<3> cue = iEapArray[i]->DataType();
       
   604 
       
   605 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::DeleteConfigurationL: cue:",
       
   606 						cue.Ptr(), cue.Size()));
       
   607 
       
   608 				eapType = CEapType::NewL(cue, iIndexType, iIndex);	
       
   609 
       
   610 				if(eapType == NULL)
       
   611 					{
       
   612 						EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Ecom Error - No specified EAP plugin")) );
       
   613 						User::Leave(KErrNotFound);
       
   614 					}
       
   615 				
       
   616 				eapType->SetTunnelingType(iEapType);					
       
   617 
       
   618 #endif //#ifndef USE_EAP_EXPANDED_TYPES
       
   619 								
   753 				EAP_TRACE_DEBUG_SYMBIAN(
   620 				EAP_TRACE_DEBUG_SYMBIAN(
   754 						(_L("CEapTlsPeap::DeleteConfigurationL: PushL(...)")));	
   621 						(_L("CEapTlsPeap::DeleteConfigurationL: PushL(...)")));	
   755 				
   622 				
   756 				CleanupStack::PushL(eapType);
   623 				CleanupStack::PushL(eapType);
   757 				
   624 				
   770 
   637 
   771 // ----------------------------------------------------------
   638 // ----------------------------------------------------------
   772 
   639 
   773 TUint CEapTlsPeap::GetInterfaceVersion()
   640 TUint CEapTlsPeap::GetInterfaceVersion()
   774 {
   641 {
   775 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetInterfaceVersion()\n")));
       
   776 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetInterfaceVersion()\n"));
       
   777 
       
   778 	return KInterfaceVersion;
   642 	return KInterfaceVersion;
   779 }
   643 }
   780 
   644 
   781 // ----------------------------------------------------------
   645 // ----------------------------------------------------------
   782 
   646 
   783 void CEapTlsPeap::SetTunnelingType(const TEapExpandedType aTunnelingType)
   647 void CEapTlsPeap::SetTunnelingType(const TInt aTunnelingType)
   784     {
   648 {
   785 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetTunnelingType()\n")));
   649 #ifdef USE_EAP_EXPANDED_TYPES
   786 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetTunnelingType()\n"));
   650 
   787 
   651 	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
   788     EAP_TRACE_DATA_DEBUG_SYMBIAN(
   652 	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
   789         (EAPL("CEapTlsPeap::SetTunnelingType - tunneling type"),
   653 
   790         aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
   654 #else
   791     
   655 
   792     eap_type_value_e aInternalType;
   656 	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
   793     
   657 
   794     TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
   658 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   795             &aTunnelingType,
   659 }
   796             &aInternalType);
       
   797     
       
   798     iTunnelingType = aInternalType;
       
   799     }
       
   800 
   660 
   801 // ----------------------------------------------------------
   661 // ----------------------------------------------------------
   802 
       
   803 void CEapTlsPeap::SetIndexL(
   662 void CEapTlsPeap::SetIndexL(
   804 		const TIndexType aIndexType, 
   663 		const TIndexType aIndexType, 
   805 		const TInt aIndex)
   664 		const TInt aIndex)
   806 {
   665 {
   807 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL()\n")));
   666 #ifdef USE_EAP_EXPANDED_TYPES
   808 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetIndexL()\n"));
   667 	
   809 
       
   810 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   668 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   811 	TUint aEapVendorType = iEapType.get_vendor_type();
   669 	TUint aEapVendorType = iEapType.get_vendor_type();
       
   670 	
       
   671 #else
       
   672 	
       
   673 	TUint aTunnelingVendorType = static_cast<TUint>(iTunnelingType);
       
   674 	TUint aEapVendorType = static_cast<TUint>(iEapType);
       
   675 	
       
   676 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   812 
   677 
   813 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL:Start: Old: iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   678 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL:Start: Old: iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   814 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   679 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   815 	
   680 	
   816 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: New: IndexType=%d,Index=%d"),
   681 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: New: IndexType=%d,Index=%d"),
   831 	iIndexType = tmpIndexType;
   696 	iIndexType = tmpIndexType;
   832 	iIndex = tmpIndex;
   697 	iIndex = tmpIndex;
   833 	
   698 	
   834 	RDbNamedDatabase db;
   699 	RDbNamedDatabase db;
   835 
   700 
   836 	RFs session;
   701 	RDbs session;
   837 
   702 
       
   703     EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
   704 	
   838 	CleanupClosePushL(session);
   705 	CleanupClosePushL(session);
   839 	CleanupClosePushL(db);
   706 	CleanupClosePushL(db);
   840 	TInt error = session.Connect();
   707 	
   841 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL(): - session.Connect(), error=%d\n"), error));
       
   842 	User::LeaveIfError(error);
       
   843 
       
   844     EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
   845 
       
   846 	TPtrC settings;
   708 	TPtrC settings;
   847 	TPtrC usercerts;
   709 	TPtrC usercerts;
   848 	TPtrC cacerts;
   710 	TPtrC cacerts;
   849 	TPtrC ciphersuites;
   711 	TPtrC ciphersuites;
   850 
   712 
   851 #ifdef USE_FAST_EAP_TYPE
   713 #ifdef USE_FAST_EAP_TYPE
   852 	TPtrC fastSpecialSettings;
   714 	TPtrC fastSpecialSettings;
   853 #endif
   715 #endif
   854 	
   716 	
   855 	if (iEapType == eap_type_tls)
   717 #ifdef USE_EAP_EXPANDED_TYPES
       
   718 
       
   719 	switch (iEapType.get_vendor_type())
       
   720 	
       
   721 #else
       
   722 
       
   723 	switch (iEapType)
       
   724 
       
   725 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   856 	{
   726 	{
   857 		settings.Set(KTlsDatabaseTableName);
   727 	case eap_type_tls:
   858 		usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
   728 		{
   859 		cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
   729 			settings.Set(KTlsDatabaseTableName);
   860 		ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
   730 			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
   861 	}
   731 			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
   862 	else if (iEapType == eap_type_peap)
   732 			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
   863 	{
   733 		}
   864 		settings.Set(KPeapDatabaseTableName);
   734 		break;
   865 		usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
   735 
   866 		cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
   736 	case eap_type_peap:
   867 		ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
   737 		{
   868 	}
   738 			settings.Set(KPeapDatabaseTableName);
       
   739 			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
       
   740 			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
       
   741 			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
       
   742 		}
       
   743 		break;
       
   744 
   869 #if defined (USE_TTLS_EAP_TYPE)
   745 #if defined (USE_TTLS_EAP_TYPE)
   870 	else if (iEapType == eap_type_ttls)
   746 	case eap_type_ttls:
   871 	{
   747 		{
   872 		settings.Set(KTtlsDatabaseTableName);
   748 			settings.Set(KTtlsDatabaseTableName);
   873 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   749 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   874 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   750 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   875 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   751 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   876 	}
   752 		}
       
   753 		break;
   877 #endif
   754 #endif
       
   755 
   878 #ifdef USE_FAST_EAP_TYPE
   756 #ifdef USE_FAST_EAP_TYPE
   879 	else if (iEapType == eap_type_fast)
   757 	case eap_type_fast:
   880 	{
   758 		{
   881 		settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
   759 			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
   882 		fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
   760 			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
   883 		
   761 			
   884 		usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
   762 			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
   885 		cacerts.Set(KFastAllowedCACertsDatabaseTableName);
   763 			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
   886 		ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
   764 			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
   887 	}
   765 		}
       
   766 		break;
   888 #endif		
   767 #endif		
   889 	else if (iEapType == eap_expanded_type_ttls_plain_pap.get_type())
   768 
   890 	{
   769 	case eap_type_ttls_plain_pap:
   891 		settings.Set(KTtlsDatabaseTableName);
   770 		{
   892 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   771 			settings.Set(KTtlsDatabaseTableName);
   893 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   772 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   894 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   773 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   895 	}
   774 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   896 	else
   775 		}
   897 	{
   776 		break;
       
   777 		
       
   778 	default:
   898 		// Should never happen
   779 		// Should never happen
   899 		User::Leave(KErrArgument);
   780 		User::Leave(KErrArgument);
   900 	}	
   781 	}	
   901 	
   782 	
   902 	EAP_TRACE_DEBUG_SYMBIAN(
   783 	EAP_TRACE_DEBUG_SYMBIAN(
   978 	}// End: if(iEapType == eap_type_fast)
   859 	}// End: if(iEapType == eap_type_fast)
   979 	
   860 	
   980 #endif // End: #ifdef USE_FAST_EAP_TYPE
   861 #endif // End: #ifdef USE_FAST_EAP_TYPE
   981 		
   862 		
   982 	db.Close();
   863 	db.Close();
   983 	session.Close();
   864 	CleanupStack::PopAndDestroy(2); // db, session.
   984 
       
   985 	CleanupStack::PopAndDestroy(&db);
       
   986 	CleanupStack::PopAndDestroy(&session);
       
   987 	
   865 	
   988 	//////// Encapsulated types
   866 	//////// Encapsulated types
   989 
   867 
   990 	if (iEapType == eap_type_peap
   868 	if (iEapType == eap_type_peap
   991 		|| iEapType == eap_type_ttls
   869 		|| iEapType == eap_type_ttls
   992 
   870 
   993 #ifdef USE_FAST_EAP_TYPE
   871 #ifdef USE_FAST_EAP_TYPE
   994 		|| iEapType == eap_type_fast
   872 		|| iEapType == eap_type_fast
   995 #endif				
   873 #endif				
   996 
   874 
   997 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
   875 		|| iEapType == eap_type_ttls_plain_pap
   998 			
   876 			
   999 
   877 
  1000 	)
   878 	)
  1001 	{
   879 	{
  1002 		iEapArray.ResetAndDestroy();
   880 		iEapArray.ResetAndDestroy();
  1003 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   881 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1004 				
   882 				
  1005 		for (TInt i = 0; i < iEapArray.Count(); i++)
   883 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1006 		{
   884 		{
  1007 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
   885 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1008 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
   886 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
  1009 
   887 
  1010 #ifdef USE_FAST_EAP_TYPE
   888 #ifdef USE_FAST_EAP_TYPE
  1011 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   889 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1012 #endif										
   890 #endif										
  1013 
   891 
  1014 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   892 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1015 										
   893 										
  1016 
   894 
  1017 			)
   895 			)
  1018 			{
   896 			{
  1019 				// Setting the  index for encapsulated EAP type configurations possible 
   897 				// Setting the  index for encapsulated EAP type configurations possible 
  1020 				// inside PEAP, TTLS and FAST.
   898 				// inside PEAP, TTLS and FAST.
  1021 
   899 
  1022 				EAP_TRACE_DEBUG_SYMBIAN(
   900 				EAP_TRACE_DEBUG_SYMBIAN(
  1023 		    		(_L("EapTlsPeapUtils::SetIndexL - Setting the index to encapsulated EAP types\n")));	
   901 		    		(_L("EapTlsPeapUtils::SetIndexL - Setting the index to encapsulated EAP types\n")));	
  1024 				
   902 				
  1025 				CEapTypePlugin* eapType;
   903 				CEapType* eapType;
  1026 			
   904 			
  1027 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
   905 #ifdef USE_EAP_EXPANDED_TYPES		
       
   906 			
       
   907 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
  1028 			
   908 			
  1029 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::SetIndexL: Expanded cue:",
   909 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::SetIndexL: Expanded cue:",
  1030 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
   910 				expandedCue.Ptr(), expandedCue.Size()));
  1031 			
   911 			
  1032 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
   912 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
  1033 
   913 
  1034 				if(eapType == NULL)
   914 				if(eapType == NULL)
  1035 				{
   915 				{
  1036 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: Ecom Error - No specified Expanded EAP plugin")) );
   916 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: Ecom Error - No specified Expanded EAP plugin")) );
  1037 					User::Leave(KErrNotFound);
   917 					User::Leave(KErrNotFound);
  1038 				}				
   918 				}				
  1039 				
   919 				
  1040 			    TEapExpandedType aExpandedType;
   920 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1041 			    
   921 
  1042 			    eap_type_value_e value = iEapType;//.get_vendor_type();
   922 #else // For normal EAP types.
  1043 			    TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
   923 			
  1044 			            &value,
   924 				TBuf8<3> cue = iEapArray[i]->DataType();
  1045 			            &aExpandedType);
   925 			
  1046 
   926 				eapType = CEapType::NewL(cue, iIndexType, iIndex);	
  1047 			    eapType->SetTunnelingType(aExpandedType);						
   927 				
       
   928 				eapType->SetTunnelingType(iEapType);					
       
   929 
       
   930 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1048 
   931 
  1049 				CleanupStack::PushL(eapType);
   932 				CleanupStack::PushL(eapType);
  1050 				
   933 				
  1051 				eapType->SetIndexL(aIndexType, aIndex);
   934 				eapType->SetIndexL(aIndexType, aIndex);
  1052 				
   935 				
  1062 	
   945 	
  1063 	EAP_TRACE_DEBUG_SYMBIAN(
   946 	EAP_TRACE_DEBUG_SYMBIAN(
  1064 		(_L("EapTlsPeapUtils::SetIndexL - End\n")));		
   947 		(_L("EapTlsPeapUtils::SetIndexL - End\n")));		
  1065 }
   948 }
  1066 
   949 
  1067 // ----------------------------------------------------------
       
  1068 
       
  1069 void CEapTlsPeap::SetConfigurationL(const EAPSettings& aSettings)
   950 void CEapTlsPeap::SetConfigurationL(const EAPSettings& aSettings)
  1070 {
   951 {
  1071 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetConfigurationL()\n")));
       
  1072 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetConfigurationL()\n"));
       
  1073 
       
  1074 	RDbNamedDatabase db;
   952 	RDbNamedDatabase db;
  1075 
   953 
  1076 	RFs session;
   954 	RDbs session;	
  1077 
   955 	
       
   956 	// This also creates the IAP entry if it doesn't exist
       
   957 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
   958 	
  1078 	CleanupClosePushL(session);
   959 	CleanupClosePushL(session);
  1079 	CleanupClosePushL(db);
   960 	CleanupClosePushL(db);
  1080 	TInt error = session.Connect();
       
  1081 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
  1082 	User::LeaveIfError(error);
       
  1083 
       
  1084 	// This also creates the IAP entry if it doesn't exist
       
  1085 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
  1086 
   961 
  1087 	EapTlsPeapUtils::SetConfigurationL(
   962 	EapTlsPeapUtils::SetConfigurationL(
  1088 		db,
   963 		db,
  1089 		aSettings, 
   964 		aSettings, 
  1090 		iIndexType,
   965 		iIndexType,
  1091 		iIndex,
   966 		iIndex,
  1092 		iTunnelingType,
   967 		iTunnelingType,
  1093 		iEapType);		
   968 		iEapType);		
  1094 		
   969 		
  1095 	db.Close();
   970 	CleanupStack::PopAndDestroy(2); // db, session
  1096 	session.Close();
   971 }
  1097 
       
  1098 	CleanupStack::PopAndDestroy(&db);
       
  1099 	CleanupStack::PopAndDestroy(&session);
       
  1100 }
       
  1101 
       
  1102 // ----------------------------------------------------------
       
  1103 
   972 
  1104 void CEapTlsPeap::GetConfigurationL(EAPSettings& aSettings)
   973 void CEapTlsPeap::GetConfigurationL(EAPSettings& aSettings)
  1105 {
   974 {
  1106 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetConfigurationL()\n")));
       
  1107 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetConfigurationL()\n"));
       
  1108 
       
  1109 	RDbNamedDatabase db;
   975 	RDbNamedDatabase db;
  1110 
   976 
  1111 	RFs session;
   977 	RDbs session;
       
   978 	
       
   979 	// This also creates the IAP entry if it doesn't exist
       
   980 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
  1112 	
   981 	
  1113 	CleanupClosePushL(session);
   982 	CleanupClosePushL(session);
  1114 	CleanupClosePushL(db);
   983 	CleanupClosePushL(db);
  1115 	TInt error = session.Connect();
       
  1116 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
  1117 	User::LeaveIfError(error);
       
  1118 
       
  1119 	// This also creates the IAP entry if it doesn't exist
       
  1120 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
  1121 
   984 
  1122 	EapTlsPeapUtils::GetConfigurationL(
   985 	EapTlsPeapUtils::GetConfigurationL(
  1123 		db,
   986 		db,
  1124 		aSettings, 
   987 		aSettings, 
  1125 		iIndexType,
   988 		iIndexType,
  1126 		iIndex,
   989 		iIndex,
  1127 		iTunnelingType,
   990 		iTunnelingType,
  1128 		iEapType);
   991 		iEapType);
  1129 		
   992 		
  1130 	db.Close();
   993 	db.Close();
  1131 	session.Close();
   994 	CleanupStack::PopAndDestroy(2); // db, session
  1132 
   995 }
  1133 	CleanupStack::PopAndDestroy(&db);
       
  1134 	CleanupStack::PopAndDestroy(&session);
       
  1135 }
       
  1136 
       
  1137 // ----------------------------------------------------------
       
  1138 
   996 
  1139 void CEapTlsPeap::CopySettingsL(
   997 void CEapTlsPeap::CopySettingsL(
  1140 	const TIndexType aDestinationIndexType,
   998 	const TIndexType aDestinationIndexType,
  1141 	const TInt aDestinationIndex)
   999 	const TInt aDestinationIndex)
  1142 {
  1000 {
  1143 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL()\n")));
  1001 #ifdef USE_EAP_EXPANDED_TYPES
  1144 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CopySettingsL()\n"));
  1002 	
  1145 
       
  1146 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
  1003 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
  1147 	TUint aEapVendorType = iEapType.get_vendor_type();
  1004 	TUint aEapVendorType = iEapType.get_vendor_type();
       
  1005 	
       
  1006 #else
       
  1007 	
       
  1008 	TUint aTunnelingVendorType = static_cast<TUint>(iTunnelingType);
       
  1009 	TUint aEapVendorType = static_cast<TUint>(iEapType);
       
  1010 	
       
  1011 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1148 
  1012 
  1149 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
  1013 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
  1150 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
  1014 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
  1151 	
  1015 	
  1152 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: DestinationIndexType=%d,DestinationIndex=%d"),
  1016 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: DestinationIndexType=%d,DestinationIndex=%d"),
  1163 	iIndexType = tmpIndexType;
  1027 	iIndexType = tmpIndexType;
  1164 	iIndex = tmpIndex;
  1028 	iIndex = tmpIndex;
  1165 	
  1029 	
  1166 	RDbNamedDatabase db;
  1030 	RDbNamedDatabase db;
  1167 
  1031 
  1168 	RFs session;
  1032 	RDbs session;
       
  1033 	
       
  1034 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
  1169 	
  1035 	
  1170 	CleanupClosePushL(session);
  1036 	CleanupClosePushL(session);
  1171 	CleanupClosePushL(db);
  1037 	CleanupClosePushL(db);
  1172 	TInt error = session.Connect();
  1038 	
  1173 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL(): - session.Connect(), error=%d\n"), error));
       
  1174 	User::LeaveIfError(error);
       
  1175 
       
  1176 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
  1177 
       
  1178 	TPtrC settings;
  1039 	TPtrC settings;
  1179 	TPtrC usercerts;
  1040 	TPtrC usercerts;
  1180 	TPtrC cacerts;
  1041 	TPtrC cacerts;
  1181 	TPtrC ciphersuites;
  1042 	TPtrC ciphersuites;
  1182 
  1043 
  1183 #ifdef USE_FAST_EAP_TYPE
  1044 #ifdef USE_FAST_EAP_TYPE
  1184 	TPtrC fastSpecialSettings;
  1045 	TPtrC fastSpecialSettings;
  1185 #endif
  1046 #endif
  1186 	
  1047 	
  1187 	if (iEapType == eap_type_tls)
  1048 #ifdef USE_EAP_EXPANDED_TYPES
       
  1049 
       
  1050 	switch (iEapType.get_vendor_type())
       
  1051 	
       
  1052 #else
       
  1053 
       
  1054 	switch (iEapType)
       
  1055 
       
  1056 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1188 	{
  1057 	{
  1189 		settings.Set(KTlsDatabaseTableName);
  1058 	case eap_type_tls:
  1190 		usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
  1059 		{
  1191 		cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
  1060 			settings.Set(KTlsDatabaseTableName);
  1192 		ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
  1061 			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
  1193 	}
  1062 			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
  1194 	else if (iEapType == eap_type_peap)
  1063 			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
  1195 	{
  1064 		}
  1196 		settings.Set(KPeapDatabaseTableName);
  1065 		break;
  1197 		usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
  1066 
  1198 		cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
  1067 	case eap_type_peap:
  1199 		ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
  1068 		{
  1200 	}
  1069 			settings.Set(KPeapDatabaseTableName);
       
  1070 			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
       
  1071 			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
       
  1072 			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
       
  1073 		}
       
  1074 		break;
       
  1075 
  1201 #if defined (USE_TTLS_EAP_TYPE)
  1076 #if defined (USE_TTLS_EAP_TYPE)
  1202 	else if (iEapType == eap_type_ttls)
  1077 	case eap_type_ttls:
  1203 	{
  1078 		{
  1204 		settings.Set(KTtlsDatabaseTableName);
  1079 			settings.Set(KTtlsDatabaseTableName);
  1205 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1080 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1206 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1081 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1207 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1082 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1208 	}
  1083 		}
       
  1084 		break;
  1209 #endif
  1085 #endif
  1210 	else if (iEapType == eap_expanded_type_ttls_plain_pap.get_type())
  1086 
  1211 	{
  1087 	case eap_type_ttls_plain_pap:
  1212 		settings.Set(KTtlsDatabaseTableName);
  1088 		{
  1213 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1089 			settings.Set(KTtlsDatabaseTableName);
  1214 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1090 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1215 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1091 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1216 	}
  1092 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
       
  1093 		}
       
  1094 		break;
       
  1095 		
  1217 #ifdef USE_FAST_EAP_TYPE
  1096 #ifdef USE_FAST_EAP_TYPE
  1218 	else if (iEapType == eap_type_fast)
  1097 	case eap_type_fast:
  1219 	{
  1098 		{
  1220 		settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
  1099 			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
  1221 		fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
  1100 			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
  1222 		
  1101 			
  1223 		usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
  1102 			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
  1224 		cacerts.Set(KFastAllowedCACertsDatabaseTableName);
  1103 			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
  1225 		ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
  1104 			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
  1226 	}
  1105 		}
       
  1106 		break;
  1227 #endif		
  1107 #endif		
  1228 	else
  1108 
  1229 	{
  1109 	default:
  1230 		// Should never happen
  1110 		// Should never happen
  1231 		User::Leave(KErrArgument);
  1111 		User::Leave(KErrArgument);
  1232 	}	
  1112 	}	
  1233 
  1113 
  1234 	EAP_TRACE_DEBUG_SYMBIAN(
  1114 	EAP_TRACE_DEBUG_SYMBIAN(
  1310 	} // End: if(iEapType == eap_type_fast)
  1190 	} // End: if(iEapType == eap_type_fast)
  1311 	
  1191 	
  1312 #endif // End: #ifdef USE_FAST_EAP_TYPE	
  1192 #endif // End: #ifdef USE_FAST_EAP_TYPE	
  1313 	
  1193 	
  1314 	db.Close();
  1194 	db.Close();
  1315 	session.Close();
  1195 	CleanupStack::PopAndDestroy(2); // db, session
  1316 
       
  1317 	CleanupStack::PopAndDestroy(&db);
       
  1318 	CleanupStack::PopAndDestroy(&session);
       
  1319 	
  1196 	
  1320 	//////// Copy Encapsulated types
  1197 	//////// Copy Encapsulated types
  1321 	
  1198 	
  1322 	// Operator == takes care of expanded EAP type conversion automatically.
  1199 	// Operator == takes care of expanded EAP type conversion automatically.
  1323 	if (iEapType == eap_type_peap
  1200 	if (iEapType == eap_type_peap
  1325 
  1202 
  1326 #ifdef USE_FAST_EAP_TYPE
  1203 #ifdef USE_FAST_EAP_TYPE
  1327 		|| iEapType == eap_type_fast
  1204 		|| iEapType == eap_type_fast
  1328 #endif						
  1205 #endif						
  1329 
  1206 
  1330 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
  1207 		|| iEapType == eap_type_ttls_plain_pap
  1331 						
  1208 						
  1332 
  1209 
  1333 	)
  1210 	)
  1334 	{
  1211 	{
  1335 		EAP_TRACE_DEBUG_SYMBIAN(
  1212 		EAP_TRACE_DEBUG_SYMBIAN(
  1338 		iEapArray.ResetAndDestroy();
  1215 		iEapArray.ResetAndDestroy();
  1339 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1216 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1340 				
  1217 				
  1341 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1218 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1342 		{
  1219 		{
  1343 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1220 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1344 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
  1221 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
  1345 
  1222 
  1346 #ifdef USE_FAST_EAP_TYPE
  1223 #ifdef USE_FAST_EAP_TYPE
  1347 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
  1224 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1348 #endif										
  1225 #endif										
  1349 
  1226 
  1350 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
  1227 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1351 									
  1228 									
  1352 			)
  1229 			)
  1353 			{
  1230 			{
  1354 				// Copying the settings of encapsulated EAP type configurations possible inside PEAP and TTLS.
  1231 				// Copying the settings of encapsulated EAP type configurations possible inside PEAP and TTLS.
  1355 			
  1232 			
  1356 				CEapTypePlugin* eapType;
  1233 				CEapType* eapType;
  1357 			
  1234 			
  1358 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
  1235 #ifdef USE_EAP_EXPANDED_TYPES		
       
  1236 			
       
  1237 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
  1359 			
  1238 			
  1360 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::CopySettingsL: Expanded cue:",
  1239 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::CopySettingsL: Expanded cue:",
  1361 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
  1240 				expandedCue.Ptr(), expandedCue.Size()));
  1362 			
  1241 			
  1363 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
  1242 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
  1364 				
  1243 				
  1365 				if(eapType == NULL)
  1244 				if(eapType == NULL)
  1366 				{
  1245 				{
  1367 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: Ecom Error - No specified Expanded EAP plugin")) );
  1246 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: Ecom Error - No specified Expanded EAP plugin")) );
  1368 					User::Leave(KErrNotFound);
  1247 					User::Leave(KErrNotFound);
  1369 				}
  1248 				}
  1370 				
  1249 				
  1371                 TEapExpandedType aExpandedType;
  1250 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1372                 
  1251 
  1373                 TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
  1252 #else // For normal EAP types.
  1374                         &iEapType,
  1253 			
  1375                         &aExpandedType);
  1254 				TBuf8<3> cue = iEapArray[i]->DataType();
  1376 
  1255 			
  1377                 eapType->SetTunnelingType(aExpandedType);
  1256 				eapType = CEapType::NewL(cue, iIndexType, iIndex);	
  1378 
  1257 				
  1379                 //eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1258 				eapType->SetTunnelingType(iEapType);					
  1380 
  1259 
       
  1260 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
  1261 				
  1381 				CleanupStack::PushL(eapType);
  1262 				CleanupStack::PushL(eapType);
  1382 				
  1263 				
  1383 				eapType->CopySettingsL(aDestinationIndexType, aDestinationIndex);
  1264 				eapType->CopySettingsL(aDestinationIndexType, aDestinationIndex);
  1384 				
  1265 				
  1385 				EAP_TRACE_DEBUG_SYMBIAN(
  1266 				EAP_TRACE_DEBUG_SYMBIAN(
  1393 	EAP_TRACE_DEBUG_SYMBIAN(
  1274 	EAP_TRACE_DEBUG_SYMBIAN(
  1394 		(_L("EapTlsPeapUtils::CopySettingsL - End \n")));	
  1275 		(_L("EapTlsPeapUtils::CopySettingsL - End \n")));	
  1395 
  1276 
  1396 }
  1277 }
  1397 
  1278 
  1398 // ----------------------------------------------------------
       
  1399 
       
  1400 #ifdef USE_PAC_STORE
  1279 #ifdef USE_PAC_STORE
  1401 
  1280 
  1402 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType,
  1281 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType,
  1403 	const TInt aIndex, 
  1282 	const TInt aIndex, 
  1404 	const eap_type_value_e aTunnelingType)
  1283 	const eap_type_value_e aTunnelingType)
  1405 {
  1284 {
  1406 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::UpdatePacStoreCleanupTableL()\n")));
       
  1407 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::UpdatePacStoreCleanupTableL()\n"));
       
  1408 
       
  1409 	EAP_TRACE_DEBUG_SYMBIAN(
  1285 	EAP_TRACE_DEBUG_SYMBIAN(
  1410 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start")));
  1286 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start")));
  1411 	
  1287 	
  1412 	CPacStoreDatabase * pacStoreDb	= CPacStoreDatabase::NewL();
  1288 	CPacStoreDatabase * pacStoreDb	= CPacStoreDatabase::NewL();
  1413 	User::LeaveIfNull(pacStoreDb);
  1289 	User::LeaveIfNull(pacStoreDb);
  1432 	
  1308 	
  1433 	delete pacStoreDb;
  1309 	delete pacStoreDb;
  1434 			
  1310 			
  1435 	EAP_TRACE_DEBUG_SYMBIAN(
  1311 	EAP_TRACE_DEBUG_SYMBIAN(
  1436 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End")));	
  1312 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End")));	
  1437 
  1313 	User::Leave(KErrNone);
  1438 }
  1314 }
  1439 
  1315 
  1440 #endif // #ifdef USE_PAC_STORE
  1316 #endif // #ifdef USE_PAC_STORE
  1441 
  1317 
  1442 // ----------------------------------------------------------
       
  1443 // End of file
  1318 // End of file
  1444 
  1319