eapol/eapol_framework/eapol_symbian/am/type/tls_peap/symbian/plugin/src/EapTlsPeap.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: 35.1.3 %
    19 * %version: 67 %
    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 
       
    45 #if defined(USE_FAST_EAP_TYPE)
    38 #if defined(USE_FAST_EAP_TYPE)
    46 #include <eapfastui.h>
       
    47 #include "tls_application_eap_fast.h"
    39 #include "tls_application_eap_fast.h"
    48 #endif 
    40 #endif 
    49 
    41 
    50 #include "eap_am_type_tls_peap_symbian.h"
    42 #include "eap_am_type_tls_peap_symbian.h"
    51 #include "eap_type_tls_peap.h"
    43 #include "eap_type_tls_peap.h"
    52 #include "tls_record.h"
    44 #include "tls_record.h"
       
    45 #include "dummy_eap_core.h"
    53 #include "eap_core.h"
    46 #include "eap_core.h"
    54 #include "tls_application_eap_core.h"
    47 #include "tls_application_eap_core.h"
    55 #include "eap_am_tools_symbian.h"
    48 #include "eap_am_tools_symbian.h"
    56 #include "eap_am_trace_symbian.h"
    49 #include "EapTraceSymbian.h"
       
    50 #include "EapConversion.h"
       
    51 #include "EapExpandedType.h"
    57 
    52 
    58 #ifdef USE_PAC_STORE
    53 #ifdef USE_PAC_STORE
    59 #include "pac_store_db_symbian.h"
    54 #include "pac_store_db_symbian.h"
    60 #endif
    55 #endif
    61 
    56 
    62 #include <papui.h>
    57 #include "eapol_key_types.h"
    63 
    58 
    64 // LOCAL CONSTANTS
    59 // LOCAL CONSTANTS
    65 
    60 
    66 // The version number of this interface. At the moment this version number is
    61 // The version number of this interface. At the moment this version number is
    67 // common for all three plug-in interfaces.
    62 // common for all three plug-in interfaces.
    68 const TUint KInterfaceVersion = 1;
    63 const TUint KInterfaceVersion = 1;
    69 
    64 
       
    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)
    70 
    69 
    71 // ================= MEMBER FUNCTIONS =======================
    70 // ================= MEMBER FUNCTIONS =======================
    72 
    71 
    73 
    72 
    74 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType,	
    73 CEapTlsPeap::CEapTlsPeap(const TIndexType aIndexType,	
    76 				 const eap_type_value_e aEapType)
    75 				 const eap_type_value_e aEapType)
    77 : iIndexType(aIndexType)
    76 : iIndexType(aIndexType)
    78 , iIndex(aIndex)
    77 , iIndex(aIndex)
    79 , iEapType(aEapType)
    78 , iEapType(aEapType)
    80 , iTunnelingType(eap_type_none)
    79 , iTunnelingType(eap_type_none)
    81 {
    80 #if defined(USE_FAST_EAP_TYPE)
    82 
    81 , iApplication(NULL)
    83 #ifdef USE_EAP_EXPANDED_TYPES
    82 #endif
    84 
    83 , m_am_tools(abs_eap_am_tools_c::new_abs_eap_am_tools_c())
    85 	ASSERT(iEapType.get_vendor_id() == eap_type_vendor_id_ietf);
    84 {
    86 	ASSERT(iTunnelingType.get_vendor_id() == eap_type_vendor_id_ietf);
    85 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CEapTlsPeap()\n")));
    87 
    86 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CEapTlsPeap()\n"));
    88 #endif //#ifdef USE_EAP_EXPANDED_TYPES
    87 
       
    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);
    89 
   151 
    90 }
   152 }
    91 
   153 
    92 // ----------------------------------------------------------
   154 // ----------------------------------------------------------
    93 
   155 
    94 CEapTlsPeap* CEapTlsPeap::NewTlsL(SIapInfo *aIapInfo)
   156 CEapTlsPeap* CEapTlsPeap::NewTlsL(SIapInfo *aIapInfo)
    95 {
   157 {
       
   158 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTlsL()\n")));
       
   159 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTlsL()\n"));
       
   160 
    96 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls);
   161 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_tls);
    97 }
   162 }
    98 
   163 
    99 // ----------------------------------------------------------
   164 // ----------------------------------------------------------
   100 
   165 
   101 CEapTlsPeap* CEapTlsPeap::NewPeapL(SIapInfo *aIapInfo)
   166 CEapTlsPeap* CEapTlsPeap::NewPeapL(SIapInfo *aIapInfo)
   102 {
   167 {
       
   168 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewPeapL()\n")));
       
   169 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewPeapL()\n"));
       
   170 
   103 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap);
   171 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_peap);
   104 }
   172 }
   105 
   173 
   106 // ----------------------------------------------------------
   174 // ----------------------------------------------------------
   107 
   175 
   108 #if defined(USE_TTLS_EAP_TYPE)
   176 #if defined(USE_TTLS_EAP_TYPE)
   109 
   177 
   110 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SIapInfo *aIapInfo)
   178 CEapTlsPeap* CEapTlsPeap::NewTtlsL(SIapInfo *aIapInfo)
   111 {
   179 {
       
   180 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsL()\n")));
       
   181 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsL()\n"));
       
   182 
   112 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls);
   183 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_ttls);
   113 }
   184 }
   114 
   185 
   115 #endif // #if defined(USE_TTLS_EAP_TYPE)
   186 #endif // #if defined(USE_TTLS_EAP_TYPE)
   116 
   187 
   122 // ---------------------------------------------------------
   193 // ---------------------------------------------------------
   123 // 
   194 // 
   124 
   195 
   125 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SIapInfo* aIapInfo )
   196 CEapTlsPeap* CEapTlsPeap::NewTtlsPapL( SIapInfo* aIapInfo )
   126     {
   197     {
       
   198 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewTtlsPapL()\n")));
       
   199 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewTtlsPapL()\n"));
       
   200 
   127 	return new (ELeave) CEapTlsPeap(
   201 	return new (ELeave) CEapTlsPeap(
   128 		aIapInfo->indexType, aIapInfo->index, eap_type_ttls_plain_pap );    
   202 		aIapInfo->indexType, aIapInfo->index, eap_expanded_type_ttls_plain_pap.get_type() );    
   129     }
   203     }
   130 
   204 
   131 
   205 
   132 // ----------------------------------------------------------
   206 // ----------------------------------------------------------
   133 
   207 
   134 #if defined(USE_FAST_EAP_TYPE)
   208 #if defined(USE_FAST_EAP_TYPE)
   135 
   209 
   136 CEapTlsPeap* CEapTlsPeap::NewFastL(SIapInfo *aIapInfo)
   210 CEapTlsPeap* CEapTlsPeap::NewFastL(SIapInfo *aIapInfo)
   137 {
   211 {
       
   212 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::NewFastL()\n")));
       
   213 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::NewFastL()\n"));
       
   214 
   138 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast);
   215 	return new (ELeave) CEapTlsPeap(aIapInfo->indexType, aIapInfo->index, eap_type_fast);
   139 }
   216 }
   140 
   217 
   141 #endif // #if defined(USE_FAST_EAP_TYPE)
   218 #endif // #if defined(USE_FAST_EAP_TYPE)
   142 
   219 
   143 // ----------------------------------------------------------
   220 // ----------------------------------------------------------
   144 
   221 
   145 CEapTlsPeap::~CEapTlsPeap()
   222 CEapTlsPeap::~CEapTlsPeap()
   146 {
   223 {
       
   224 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::~CEapTlsPeap()\n")));
       
   225 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::~CEapTlsPeap()\n"));
       
   226 
   147 	iEapArray.ResetAndDestroy();
   227 	iEapArray.ResetAndDestroy();
   148 }
   228 	
   149 
   229 	if (iType != NULL)
       
   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
   150 // ----------------------------------------------------------
   405 // ----------------------------------------------------------
   151 
   406 
   152 #ifdef USE_EAP_SIMPLE_CONFIG
   407 #ifdef USE_EAP_SIMPLE_CONFIG
   153 
   408 
   154 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, 
   409 eap_base_type_c* CEapTlsPeap::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, 
   164 											const bool is_client_when_true,
   419 											const bool is_client_when_true,
   165 											const eap_am_network_id_c * const receive_network_id)
   420 											const eap_am_network_id_c * const receive_network_id)
   166 	
   421 	
   167 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
   422 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
   168 {
   423 {
   169 #ifdef USE_EAP_EXPANDED_TYPES
   424 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetStackInterfaceL()\n")));
   170 	
   425 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetStackInterfaceL()\n"));
       
   426 
   171 	EAP_TRACE_DEBUG_SYMBIAN(
   427 	EAP_TRACE_DEBUG_SYMBIAN(
   172 		(_L("CEapTlsPeap::GetStackInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
   428 		(_L("CEapTlsPeap::GetStackInterfaceL -Start- iIndexType=%d, iIndex=%d, Tunneling vendor type=%d, Eap vendor type=%d \n"),
   173 		iIndexType,iIndex, iTunnelingType.get_vendor_type(), iEapType.get_vendor_type()));
   429 		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
       
   182 
   430 
   183 	// Create adaptation layer
   431 	// Create adaptation layer
   184 	eap_am_type_tls_peap_symbian_c* amEapType;
   432 	eap_am_type_tls_peap_symbian_c* amEapType;
   185 	eap_base_type_c* type;
   433 	eap_base_type_c* type;
   186 	tls_record_c* record;
   434 	tls_record_c* record;
   383 	
   631 	
   384 	return type;
   632 	return type;
   385 }
   633 }
   386 
   634 
   387 // ----------------------------------------------------------
   635 // ----------------------------------------------------------
   388 TInt CEapTlsPeap::InvokeUiL()
   636 
   389 {
   637 CEapTypeInfo* CEapTlsPeap::GetInfoL()
   390 	TInt buttonId(0);
   638 {
   391 
   639 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetInfoL()\n")));
   392 #ifdef USE_EAP_EXPANDED_TYPES
   640 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetInfoL()\n"));
   393 
   641 
   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 {
       
   486 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo((TDesC&)KReleaseDate, (TDesC&)KEapTypeVersion,
   642 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo((TDesC&)KReleaseDate, (TDesC&)KEapTypeVersion,
   487 												   (TDesC&)KManufacturer);
   643 												   (TDesC&)KManufacturer);
   488 	CleanupStack::PushL(info);
   644 
   489 	return info;
   645 	return info;
   490 }
   646 }
   491 
   647 
   492 // ----------------------------------------------------------
   648 // ----------------------------------------------------------
   493 
   649 
   494 void CEapTlsPeap::DeleteConfigurationL()
   650 void CEapTlsPeap::DeleteConfigurationL()
   495 {
   651 {
   496 #ifdef USE_EAP_EXPANDED_TYPES
   652 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL()\n")));
   497 	
   653 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::DeleteConfigurationL()\n"));
       
   654 
   498 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   655 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   499 	TUint aEapVendorType = iEapType.get_vendor_type();
   656 	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
       
   507 
   657 
   508 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   658 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   509 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   659 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   510 
   660 
   511     EapTlsPeapUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType, iEapType);
   661     EapTlsPeapUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType, iEapType);
   517 
   667 
   518 #ifdef USE_FAST_EAP_TYPE
   668 #ifdef USE_FAST_EAP_TYPE
   519 		|| iEapType == eap_type_fast
   669 		|| iEapType == eap_type_fast
   520 #endif		
   670 #endif		
   521 
   671 
   522 		|| iEapType == eap_type_ttls_plain_pap
   672 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
   523 
   673 
   524 
   674 
   525 	) 
   675 	) 
   526 	{
   676 	{
   527 		iEapArray.ResetAndDestroy();
   677 		iEapArray.ResetAndDestroy();
   528 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   678 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   529 			
   679 			
   530 		for (TInt i = 0; i < iEapArray.Count(); i++)
   680 		for (TInt i = 0; i < iEapArray.Count(); i++)
   531 		{
   681 		{
   532 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
   682 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
   533 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
   683 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
   534 				
   684 				
   535 #ifdef USE_FAST_EAP_TYPE
   685 #ifdef USE_FAST_EAP_TYPE
   536 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
   686 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   537 #endif						
   687 #endif						
   538 
   688 
   539 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
   689 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   540 					
   690 					
   541 
   691 
   542 			)
   692 			)
   543 			{
   693 			{
   544 				// Deleting the encapsulated EAP type configurations possible inside PEAP, TTLS and FAST.
   694 				// Deleting the encapsulated EAP type configurations possible inside PEAP, TTLS and FAST.
   545 
   695 
   546 				EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Deleting encapsulated types for EAP type=%d"),
   696 				EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Deleting encapsulated types for EAP type=%d"),
   547 						aEapVendorType));
   697 						aEapVendorType));
   548 			
   698 			
   549 				CEapType* eapType;
   699 				CEapTypePlugin* eapType;
   550 			
   700 			
   551 #ifdef USE_EAP_EXPANDED_TYPES		
   701 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
   552 			
       
   553 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
       
   554 			
   702 			
   555 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::DeleteConfigurationL: Expanded cue:",
   703 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::DeleteConfigurationL: Expanded cue:",
   556 				expandedCue.Ptr(), expandedCue.Size()));
   704 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
   557 			
   705 			
   558 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
   706 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
   559 				
   707 				
   560 				if(eapType == NULL)
   708 				if(eapType == NULL)
   561 				{
   709 				{
   562 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Ecom Error - No specified Expanded EAP plugin")) );
   710 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::DeleteConfigurationL: Ecom Error - No specified Expanded EAP plugin")) );
   563 					User::Leave(KErrNotFound);
   711 					User::Leave(KErrNotFound);
   564 				}
   712 				}
   565 				
   713 				
   566 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
   714 //				eapType->SetTunnelingType(iEapType.get_vendor_type());						
       
   715 			    TEapExpandedType aExpandedType;
       
   716 			    
       
   717                 TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
       
   718 			            &iEapType,
       
   719 			            &aExpandedType);
       
   720 
       
   721 			    eapType->SetTunnelingType(aExpandedType);
   567 
   722 
   568 #ifdef USE_FAST_EAP_TYPE
   723 #ifdef USE_FAST_EAP_TYPE
   569 				
   724 				
   570 				// This IAP is deleted. Update the PAC store cleanup table if this IAP is 
   725 				// This IAP is deleted. Update the PAC store cleanup table if this IAP is 
   571 				// for EAP-FAST.
   726 				// for EAP-FAST.
   592 #endif // #ifdef USE_PAC_STORE
   747 #endif // #ifdef USE_PAC_STORE
   593 					
   748 					
   594 				}
   749 				}
   595 				
   750 				
   596 #endif // #ifdef USE_FAST_EAP_TYPE
   751 #endif // #ifdef USE_FAST_EAP_TYPE
   597 #endif // USE_EAP_EXPANDED_TYPES		
   752 	
   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 								
       
   620 				EAP_TRACE_DEBUG_SYMBIAN(
   753 				EAP_TRACE_DEBUG_SYMBIAN(
   621 						(_L("CEapTlsPeap::DeleteConfigurationL: PushL(...)")));	
   754 						(_L("CEapTlsPeap::DeleteConfigurationL: PushL(...)")));	
   622 				
   755 				
   623 				CleanupStack::PushL(eapType);
   756 				CleanupStack::PushL(eapType);
   624 				
   757 				
   637 
   770 
   638 // ----------------------------------------------------------
   771 // ----------------------------------------------------------
   639 
   772 
   640 TUint CEapTlsPeap::GetInterfaceVersion()
   773 TUint CEapTlsPeap::GetInterfaceVersion()
   641 {
   774 {
       
   775 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetInterfaceVersion()\n")));
       
   776 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetInterfaceVersion()\n"));
       
   777 
   642 	return KInterfaceVersion;
   778 	return KInterfaceVersion;
   643 }
   779 }
   644 
   780 
   645 // ----------------------------------------------------------
   781 // ----------------------------------------------------------
   646 
   782 
   647 void CEapTlsPeap::SetTunnelingType(const TInt aTunnelingType)
   783 void CEapTlsPeap::SetTunnelingType(const TEapExpandedType aTunnelingType)
   648 {
   784     {
   649 #ifdef USE_EAP_EXPANDED_TYPES
   785 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetTunnelingType()\n")));
   650 
   786 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetTunnelingType()\n"));
   651 	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
   787 
   652 	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
   788     EAP_TRACE_DATA_DEBUG_SYMBIAN(
   653 
   789         (EAPL("CEapTlsPeap::SetTunnelingType - tunneling type"),
   654 #else
   790         aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
   655 
   791     
   656 	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
   792     eap_type_value_e aInternalType;
   657 
   793     
   658 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   794     TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
   659 }
   795             &aTunnelingType,
   660 
   796             &aInternalType);
   661 // ----------------------------------------------------------
   797     
       
   798     iTunnelingType = aInternalType;
       
   799     }
       
   800 
       
   801 // ----------------------------------------------------------
       
   802 
   662 void CEapTlsPeap::SetIndexL(
   803 void CEapTlsPeap::SetIndexL(
   663 		const TIndexType aIndexType, 
   804 		const TIndexType aIndexType, 
   664 		const TInt aIndex)
   805 		const TInt aIndex)
   665 {
   806 {
   666 #ifdef USE_EAP_EXPANDED_TYPES
   807 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL()\n")));
   667 	
   808 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetIndexL()\n"));
       
   809 
   668 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   810 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
   669 	TUint aEapVendorType = iEapType.get_vendor_type();
   811 	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
       
   677 
   812 
   678 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL:Start: Old: iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   813 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL:Start: Old: iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
   679 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   814 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
   680 	
   815 	
   681 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: New: IndexType=%d,Index=%d"),
   816 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: New: IndexType=%d,Index=%d"),
   696 	iIndexType = tmpIndexType;
   831 	iIndexType = tmpIndexType;
   697 	iIndex = tmpIndex;
   832 	iIndex = tmpIndex;
   698 	
   833 	
   699 	RDbNamedDatabase db;
   834 	RDbNamedDatabase db;
   700 
   835 
   701 	RDbs session;
   836 	RFs session;
   702 
   837 
   703     EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
   704 	
       
   705 	CleanupClosePushL(session);
   838 	CleanupClosePushL(session);
   706 	CleanupClosePushL(db);
   839 	CleanupClosePushL(db);
   707 	
   840 	TInt error = session.Connect();
       
   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 
   708 	TPtrC settings;
   846 	TPtrC settings;
   709 	TPtrC usercerts;
   847 	TPtrC usercerts;
   710 	TPtrC cacerts;
   848 	TPtrC cacerts;
   711 	TPtrC ciphersuites;
   849 	TPtrC ciphersuites;
   712 
   850 
   713 #ifdef USE_FAST_EAP_TYPE
   851 #ifdef USE_FAST_EAP_TYPE
   714 	TPtrC fastSpecialSettings;
   852 	TPtrC fastSpecialSettings;
   715 #endif
   853 #endif
   716 	
   854 	
   717 #ifdef USE_EAP_EXPANDED_TYPES
   855 	if (iEapType == eap_type_tls)
   718 
   856 	{
   719 	switch (iEapType.get_vendor_type())
   857 		settings.Set(KTlsDatabaseTableName);
   720 	
   858 		usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
   721 #else
   859 		cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
   722 
   860 		ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
   723 	switch (iEapType)
   861 	}
   724 
   862 	else if (iEapType == eap_type_peap)
   725 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   863 	{
   726 	{
   864 		settings.Set(KPeapDatabaseTableName);
   727 	case eap_type_tls:
   865 		usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
   728 		{
   866 		cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
   729 			settings.Set(KTlsDatabaseTableName);
   867 		ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
   730 			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
   868 	}
   731 			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
       
   732 			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
       
   733 		}
       
   734 		break;
       
   735 
       
   736 	case eap_type_peap:
       
   737 		{
       
   738 			settings.Set(KPeapDatabaseTableName);
       
   739 			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
       
   740 			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
       
   741 			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
       
   742 		}
       
   743 		break;
       
   744 
       
   745 #if defined (USE_TTLS_EAP_TYPE)
   869 #if defined (USE_TTLS_EAP_TYPE)
   746 	case eap_type_ttls:
   870 	else if (iEapType == eap_type_ttls)
   747 		{
   871 	{
   748 			settings.Set(KTtlsDatabaseTableName);
   872 		settings.Set(KTtlsDatabaseTableName);
   749 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   873 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   750 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   874 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   751 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   875 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   752 		}
   876 	}
   753 		break;
       
   754 #endif
   877 #endif
   755 
       
   756 #ifdef USE_FAST_EAP_TYPE
   878 #ifdef USE_FAST_EAP_TYPE
   757 	case eap_type_fast:
   879 	else if (iEapType == eap_type_fast)
   758 		{
   880 	{
   759 			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
   881 		settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
   760 			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
   882 		fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
   761 			
   883 		
   762 			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
   884 		usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
   763 			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
   885 		cacerts.Set(KFastAllowedCACertsDatabaseTableName);
   764 			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
   886 		ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
   765 		}
   887 	}
   766 		break;
       
   767 #endif		
   888 #endif		
   768 
   889 	else if (iEapType == eap_expanded_type_ttls_plain_pap.get_type())
   769 	case eap_type_ttls_plain_pap:
   890 	{
   770 		{
   891 		settings.Set(KTtlsDatabaseTableName);
   771 			settings.Set(KTtlsDatabaseTableName);
   892 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   772 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
   893 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   773 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
   894 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   774 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
   895 	}
   775 		}
   896 	else
   776 		break;
   897 	{
   777 		
       
   778 	default:
       
   779 		// Should never happen
   898 		// Should never happen
   780 		User::Leave(KErrArgument);
   899 		User::Leave(KErrArgument);
   781 	}	
   900 	}	
   782 	
   901 	
   783 	EAP_TRACE_DEBUG_SYMBIAN(
   902 	EAP_TRACE_DEBUG_SYMBIAN(
   859 	}// End: if(iEapType == eap_type_fast)
   978 	}// End: if(iEapType == eap_type_fast)
   860 	
   979 	
   861 #endif // End: #ifdef USE_FAST_EAP_TYPE
   980 #endif // End: #ifdef USE_FAST_EAP_TYPE
   862 		
   981 		
   863 	db.Close();
   982 	db.Close();
   864 	CleanupStack::PopAndDestroy(2); // db, session.
   983 	session.Close();
       
   984 
       
   985 	CleanupStack::PopAndDestroy(&db);
       
   986 	CleanupStack::PopAndDestroy(&session);
   865 	
   987 	
   866 	//////// Encapsulated types
   988 	//////// Encapsulated types
   867 
   989 
   868 	if (iEapType == eap_type_peap
   990 	if (iEapType == eap_type_peap
   869 		|| iEapType == eap_type_ttls
   991 		|| iEapType == eap_type_ttls
   870 
   992 
   871 #ifdef USE_FAST_EAP_TYPE
   993 #ifdef USE_FAST_EAP_TYPE
   872 		|| iEapType == eap_type_fast
   994 		|| iEapType == eap_type_fast
   873 #endif				
   995 #endif				
   874 
   996 
   875 		|| iEapType == eap_type_ttls_plain_pap
   997 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
   876 			
   998 			
   877 
   999 
   878 	)
  1000 	)
   879 	{
  1001 	{
   880 		iEapArray.ResetAndDestroy();
  1002 		iEapArray.ResetAndDestroy();
   881 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1003 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
   882 				
  1004 				
   883 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1005 		for (TInt i = 0; i < iEapArray.Count(); i++)
   884 		{
  1006 		{
   885 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1007 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
   886 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
  1008 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
   887 
  1009 
   888 #ifdef USE_FAST_EAP_TYPE
  1010 #ifdef USE_FAST_EAP_TYPE
   889 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1011 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   890 #endif										
  1012 #endif										
   891 
  1013 
   892 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1014 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
   893 										
  1015 										
   894 
  1016 
   895 			)
  1017 			)
   896 			{
  1018 			{
   897 				// Setting the  index for encapsulated EAP type configurations possible 
  1019 				// Setting the  index for encapsulated EAP type configurations possible 
   898 				// inside PEAP, TTLS and FAST.
  1020 				// inside PEAP, TTLS and FAST.
   899 
  1021 
   900 				EAP_TRACE_DEBUG_SYMBIAN(
  1022 				EAP_TRACE_DEBUG_SYMBIAN(
   901 		    		(_L("EapTlsPeapUtils::SetIndexL - Setting the index to encapsulated EAP types\n")));	
  1023 		    		(_L("EapTlsPeapUtils::SetIndexL - Setting the index to encapsulated EAP types\n")));	
   902 				
  1024 				
   903 				CEapType* eapType;
  1025 				CEapTypePlugin* eapType;
   904 			
  1026 			
   905 #ifdef USE_EAP_EXPANDED_TYPES		
  1027 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
   906 			
       
   907 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
       
   908 			
  1028 			
   909 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::SetIndexL: Expanded cue:",
  1029 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::SetIndexL: Expanded cue:",
   910 				expandedCue.Ptr(), expandedCue.Size()));
  1030 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
   911 			
  1031 			
   912 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
  1032 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
   913 
  1033 
   914 				if(eapType == NULL)
  1034 				if(eapType == NULL)
   915 				{
  1035 				{
   916 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: Ecom Error - No specified Expanded EAP plugin")) );
  1036 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetIndexL: Ecom Error - No specified Expanded EAP plugin")) );
   917 					User::Leave(KErrNotFound);
  1037 					User::Leave(KErrNotFound);
   918 				}				
  1038 				}				
   919 				
  1039 				
   920 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1040 			    TEapExpandedType aExpandedType;
   921 
  1041 			    
   922 #else // For normal EAP types.
  1042 			    eap_type_value_e value = iEapType;//.get_vendor_type();
   923 			
  1043 			    TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
   924 				TBuf8<3> cue = iEapArray[i]->DataType();
  1044 			            &value,
   925 			
  1045 			            &aExpandedType);
   926 				eapType = CEapType::NewL(cue, iIndexType, iIndex);	
  1046 
   927 				
  1047 			    eapType->SetTunnelingType(aExpandedType);						
   928 				eapType->SetTunnelingType(iEapType);					
       
   929 
       
   930 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   931 
  1048 
   932 				CleanupStack::PushL(eapType);
  1049 				CleanupStack::PushL(eapType);
   933 				
  1050 				
   934 				eapType->SetIndexL(aIndexType, aIndex);
  1051 				eapType->SetIndexL(aIndexType, aIndex);
   935 				
  1052 				
   945 	
  1062 	
   946 	EAP_TRACE_DEBUG_SYMBIAN(
  1063 	EAP_TRACE_DEBUG_SYMBIAN(
   947 		(_L("EapTlsPeapUtils::SetIndexL - End\n")));		
  1064 		(_L("EapTlsPeapUtils::SetIndexL - End\n")));		
   948 }
  1065 }
   949 
  1066 
       
  1067 // ----------------------------------------------------------
       
  1068 
   950 void CEapTlsPeap::SetConfigurationL(const EAPSettings& aSettings)
  1069 void CEapTlsPeap::SetConfigurationL(const EAPSettings& aSettings)
   951 {
  1070 {
       
  1071 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::SetConfigurationL()\n")));
       
  1072 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::SetConfigurationL()\n"));
       
  1073 
   952 	RDbNamedDatabase db;
  1074 	RDbNamedDatabase db;
   953 
  1075 
   954 	RDbs session;	
  1076 	RFs session;
   955 	
  1077 
       
  1078 	CleanupClosePushL(session);
       
  1079 	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 
   956 	// This also creates the IAP entry if it doesn't exist
  1084 	// This also creates the IAP entry if it doesn't exist
   957 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
  1085 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
   958 	
       
   959 	CleanupClosePushL(session);
       
   960 	CleanupClosePushL(db);
       
   961 
  1086 
   962 	EapTlsPeapUtils::SetConfigurationL(
  1087 	EapTlsPeapUtils::SetConfigurationL(
   963 		db,
  1088 		db,
   964 		aSettings, 
  1089 		aSettings, 
   965 		iIndexType,
  1090 		iIndexType,
   966 		iIndex,
  1091 		iIndex,
   967 		iTunnelingType,
  1092 		iTunnelingType,
   968 		iEapType);		
  1093 		iEapType);		
   969 		
  1094 		
   970 	CleanupStack::PopAndDestroy(2); // db, session
  1095 	db.Close();
   971 }
  1096 	session.Close();
       
  1097 
       
  1098 	CleanupStack::PopAndDestroy(&db);
       
  1099 	CleanupStack::PopAndDestroy(&session);
       
  1100 }
       
  1101 
       
  1102 // ----------------------------------------------------------
   972 
  1103 
   973 void CEapTlsPeap::GetConfigurationL(EAPSettings& aSettings)
  1104 void CEapTlsPeap::GetConfigurationL(EAPSettings& aSettings)
   974 {
  1105 {
       
  1106 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::GetConfigurationL()\n")));
       
  1107 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::GetConfigurationL()\n"));
       
  1108 
   975 	RDbNamedDatabase db;
  1109 	RDbNamedDatabase db;
   976 
  1110 
   977 	RDbs session;
  1111 	RFs session;
   978 	
  1112 	
       
  1113 	CleanupClosePushL(session);
       
  1114 	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 
   979 	// This also creates the IAP entry if it doesn't exist
  1119 	// This also creates the IAP entry if it doesn't exist
   980 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
  1120 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
   981 	
       
   982 	CleanupClosePushL(session);
       
   983 	CleanupClosePushL(db);
       
   984 
  1121 
   985 	EapTlsPeapUtils::GetConfigurationL(
  1122 	EapTlsPeapUtils::GetConfigurationL(
   986 		db,
  1123 		db,
   987 		aSettings, 
  1124 		aSettings, 
   988 		iIndexType,
  1125 		iIndexType,
   989 		iIndex,
  1126 		iIndex,
   990 		iTunnelingType,
  1127 		iTunnelingType,
   991 		iEapType);
  1128 		iEapType);
   992 		
  1129 		
   993 	db.Close();
  1130 	db.Close();
   994 	CleanupStack::PopAndDestroy(2); // db, session
  1131 	session.Close();
   995 }
  1132 
       
  1133 	CleanupStack::PopAndDestroy(&db);
       
  1134 	CleanupStack::PopAndDestroy(&session);
       
  1135 }
       
  1136 
       
  1137 // ----------------------------------------------------------
   996 
  1138 
   997 void CEapTlsPeap::CopySettingsL(
  1139 void CEapTlsPeap::CopySettingsL(
   998 	const TIndexType aDestinationIndexType,
  1140 	const TIndexType aDestinationIndexType,
   999 	const TInt aDestinationIndex)
  1141 	const TInt aDestinationIndex)
  1000 {
  1142 {
  1001 #ifdef USE_EAP_EXPANDED_TYPES
  1143 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL()\n")));
  1002 	
  1144 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::CopySettingsL()\n"));
       
  1145 
  1003 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
  1146 	TUint aTunnelingVendorType = iTunnelingType.get_vendor_type();
  1004 	TUint aEapVendorType = iEapType.get_vendor_type();
  1147 	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
       
  1012 
  1148 
  1013 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
  1149 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL:Start:iIndexType=%d,iIndex=%d,TunnelingType=%d,EapType=%d"),
  1014 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
  1150 			iIndexType, iIndex, aTunnelingVendorType, aEapVendorType));
  1015 	
  1151 	
  1016 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: DestinationIndexType=%d,DestinationIndex=%d"),
  1152 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: DestinationIndexType=%d,DestinationIndex=%d"),
  1027 	iIndexType = tmpIndexType;
  1163 	iIndexType = tmpIndexType;
  1028 	iIndex = tmpIndex;
  1164 	iIndex = tmpIndex;
  1029 	
  1165 	
  1030 	RDbNamedDatabase db;
  1166 	RDbNamedDatabase db;
  1031 
  1167 
  1032 	RDbs session;
  1168 	RFs session;
  1033 	
       
  1034 	EapTlsPeapUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType, iEapType);
       
  1035 	
  1169 	
  1036 	CleanupClosePushL(session);
  1170 	CleanupClosePushL(session);
  1037 	CleanupClosePushL(db);
  1171 	CleanupClosePushL(db);
  1038 	
  1172 	TInt error = session.Connect();
       
  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 
  1039 	TPtrC settings;
  1178 	TPtrC settings;
  1040 	TPtrC usercerts;
  1179 	TPtrC usercerts;
  1041 	TPtrC cacerts;
  1180 	TPtrC cacerts;
  1042 	TPtrC ciphersuites;
  1181 	TPtrC ciphersuites;
  1043 
  1182 
  1044 #ifdef USE_FAST_EAP_TYPE
  1183 #ifdef USE_FAST_EAP_TYPE
  1045 	TPtrC fastSpecialSettings;
  1184 	TPtrC fastSpecialSettings;
  1046 #endif
  1185 #endif
  1047 	
  1186 	
  1048 #ifdef USE_EAP_EXPANDED_TYPES
  1187 	if (iEapType == eap_type_tls)
  1049 
  1188 	{
  1050 	switch (iEapType.get_vendor_type())
  1189 		settings.Set(KTlsDatabaseTableName);
  1051 	
  1190 		usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
  1052 #else
  1191 		cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
  1053 
  1192 		ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
  1054 	switch (iEapType)
  1193 	}
  1055 
  1194 	else if (iEapType == eap_type_peap)
  1056 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1195 	{
  1057 	{
  1196 		settings.Set(KPeapDatabaseTableName);
  1058 	case eap_type_tls:
  1197 		usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
  1059 		{
  1198 		cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
  1060 			settings.Set(KTlsDatabaseTableName);
  1199 		ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
  1061 			usercerts.Set(KTlsAllowedUserCertsDatabaseTableName);
  1200 	}
  1062 			cacerts.Set(KTlsAllowedCACertsDatabaseTableName);
       
  1063 			ciphersuites.Set(KTlsAllowedCipherSuitesDatabaseTableName);
       
  1064 		}
       
  1065 		break;
       
  1066 
       
  1067 	case eap_type_peap:
       
  1068 		{
       
  1069 			settings.Set(KPeapDatabaseTableName);
       
  1070 			usercerts.Set(KPeapAllowedUserCertsDatabaseTableName);
       
  1071 			cacerts.Set(KPeapAllowedCACertsDatabaseTableName);
       
  1072 			ciphersuites.Set(KPeapAllowedCipherSuitesDatabaseTableName);
       
  1073 		}
       
  1074 		break;
       
  1075 
       
  1076 #if defined (USE_TTLS_EAP_TYPE)
  1201 #if defined (USE_TTLS_EAP_TYPE)
  1077 	case eap_type_ttls:
  1202 	else if (iEapType == eap_type_ttls)
  1078 		{
  1203 	{
  1079 			settings.Set(KTtlsDatabaseTableName);
  1204 		settings.Set(KTtlsDatabaseTableName);
  1080 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1205 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1081 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1206 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1082 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1207 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1083 		}
  1208 	}
  1084 		break;
       
  1085 #endif
  1209 #endif
  1086 
  1210 	else if (iEapType == eap_expanded_type_ttls_plain_pap.get_type())
  1087 	case eap_type_ttls_plain_pap:
  1211 	{
  1088 		{
  1212 		settings.Set(KTtlsDatabaseTableName);
  1089 			settings.Set(KTtlsDatabaseTableName);
  1213 		usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1090 			usercerts.Set(KTtlsAllowedUserCertsDatabaseTableName);
  1214 		cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1091 			cacerts.Set(KTtlsAllowedCACertsDatabaseTableName);
  1215 		ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1092 			ciphersuites.Set(KTtlsAllowedCipherSuitesDatabaseTableName);
  1216 	}
  1093 		}
       
  1094 		break;
       
  1095 		
       
  1096 #ifdef USE_FAST_EAP_TYPE
  1217 #ifdef USE_FAST_EAP_TYPE
  1097 	case eap_type_fast:
  1218 	else if (iEapType == eap_type_fast)
  1098 		{
  1219 	{
  1099 			settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
  1220 		settings.Set(KFastGeneralSettingsDBTableName); // This is general settings for FAST.
  1100 			fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
  1221 		fastSpecialSettings.Set(KFastSpecialSettingsDBTableName);
  1101 			
  1222 		
  1102 			usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
  1223 		usercerts.Set(KFastAllowedUserCertsDatabaseTableName);
  1103 			cacerts.Set(KFastAllowedCACertsDatabaseTableName);
  1224 		cacerts.Set(KFastAllowedCACertsDatabaseTableName);
  1104 			ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
  1225 		ciphersuites.Set(KFastAllowedCipherSuitesDatabaseTableName);			
  1105 		}
  1226 	}
  1106 		break;
       
  1107 #endif		
  1227 #endif		
  1108 
  1228 	else
  1109 	default:
  1229 	{
  1110 		// Should never happen
  1230 		// Should never happen
  1111 		User::Leave(KErrArgument);
  1231 		User::Leave(KErrArgument);
  1112 	}	
  1232 	}	
  1113 
  1233 
  1114 	EAP_TRACE_DEBUG_SYMBIAN(
  1234 	EAP_TRACE_DEBUG_SYMBIAN(
  1190 	} // End: if(iEapType == eap_type_fast)
  1310 	} // End: if(iEapType == eap_type_fast)
  1191 	
  1311 	
  1192 #endif // End: #ifdef USE_FAST_EAP_TYPE	
  1312 #endif // End: #ifdef USE_FAST_EAP_TYPE	
  1193 	
  1313 	
  1194 	db.Close();
  1314 	db.Close();
  1195 	CleanupStack::PopAndDestroy(2); // db, session
  1315 	session.Close();
       
  1316 
       
  1317 	CleanupStack::PopAndDestroy(&db);
       
  1318 	CleanupStack::PopAndDestroy(&session);
  1196 	
  1319 	
  1197 	//////// Copy Encapsulated types
  1320 	//////// Copy Encapsulated types
  1198 	
  1321 	
  1199 	// Operator == takes care of expanded EAP type conversion automatically.
  1322 	// Operator == takes care of expanded EAP type conversion automatically.
  1200 	if (iEapType == eap_type_peap
  1323 	if (iEapType == eap_type_peap
  1202 
  1325 
  1203 #ifdef USE_FAST_EAP_TYPE
  1326 #ifdef USE_FAST_EAP_TYPE
  1204 		|| iEapType == eap_type_fast
  1327 		|| iEapType == eap_type_fast
  1205 #endif						
  1328 #endif						
  1206 
  1329 
  1207 		|| iEapType == eap_type_ttls_plain_pap
  1330 		|| iEapType == eap_expanded_type_ttls_plain_pap.get_type()
  1208 						
  1331 						
  1209 
  1332 
  1210 	)
  1333 	)
  1211 	{
  1334 	{
  1212 		EAP_TRACE_DEBUG_SYMBIAN(
  1335 		EAP_TRACE_DEBUG_SYMBIAN(
  1215 		iEapArray.ResetAndDestroy();
  1338 		iEapArray.ResetAndDestroy();
  1216 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1339 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, iEapArray);
  1217 				
  1340 				
  1218 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1341 		for (TInt i = 0; i < iEapArray.Count(); i++)
  1219 		{
  1342 		{
  1220 			if ((iEapType == eap_type_peap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1343 			if ((iEapType == eap_type_peap && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i])) 
  1221 				|| (iEapType == eap_type_ttls && !CEapType::IsDisallowedInsideTTLS(*iEapArray[i]))
  1344 				|| (iEapType == eap_type_ttls && !CEapTypePlugin::IsDisallowedInsideTTLS(*iEapArray[i]))
  1222 
  1345 
  1223 #ifdef USE_FAST_EAP_TYPE
  1346 #ifdef USE_FAST_EAP_TYPE
  1224 				|| (iEapType == eap_type_fast && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1347 				|| (iEapType == eap_type_fast && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
  1225 #endif										
  1348 #endif										
  1226 
  1349 
  1227 				|| (iEapType == eap_type_ttls_plain_pap && !CEapType::IsDisallowedInsidePEAP(*iEapArray[i]))
  1350 				|| (iEapType == eap_expanded_type_ttls_plain_pap.get_type() && !CEapTypePlugin::IsDisallowedInsidePEAP(*iEapArray[i]))
  1228 									
  1351 									
  1229 			)
  1352 			)
  1230 			{
  1353 			{
  1231 				// Copying the settings of encapsulated EAP type configurations possible inside PEAP and TTLS.
  1354 				// Copying the settings of encapsulated EAP type configurations possible inside PEAP and TTLS.
  1232 			
  1355 			
  1233 				CEapType* eapType;
  1356 				CEapTypePlugin* eapType;
  1234 			
  1357 			
  1235 #ifdef USE_EAP_EXPANDED_TYPES		
  1358 				TEapExpandedType expandedCue = iEapArray[i]->DataType();
  1236 			
       
  1237 				TBuf8<KExpandedEAPTypeSize> expandedCue = iEapArray[i]->DataType();
       
  1238 			
  1359 			
  1239 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::CopySettingsL: Expanded cue:",
  1360 				EAP_TRACE_DATA_DEBUG_SYMBIAN(("CEapTlsPeap::CopySettingsL: Expanded cue:",
  1240 				expandedCue.Ptr(), expandedCue.Size()));
  1361 					expandedCue.GetValue().Ptr(), expandedCue.GetValue().Size()));
  1241 			
  1362 			
  1242 				eapType = CEapType::NewL(expandedCue, iIndexType, iIndex);
  1363 				eapType = CEapTypePlugin::NewL(expandedCue.GetValue(), iIndexType, iIndex);
  1243 				
  1364 				
  1244 				if(eapType == NULL)
  1365 				if(eapType == NULL)
  1245 				{
  1366 				{
  1246 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: Ecom Error - No specified Expanded EAP plugin")) );
  1367 					EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::CopySettingsL: Ecom Error - No specified Expanded EAP plugin")) );
  1247 					User::Leave(KErrNotFound);
  1368 					User::Leave(KErrNotFound);
  1248 				}
  1369 				}
  1249 				
  1370 				
  1250 				eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1371                 TEapExpandedType aExpandedType;
  1251 
  1372                 
  1252 #else // For normal EAP types.
  1373                 TInt err = CEapConversion::ConvertInternalTypeToExpandedEAPType(
  1253 			
  1374                         &iEapType,
  1254 				TBuf8<3> cue = iEapArray[i]->DataType();
  1375                         &aExpandedType);
  1255 			
  1376 
  1256 				eapType = CEapType::NewL(cue, iIndexType, iIndex);	
  1377                 eapType->SetTunnelingType(aExpandedType);
  1257 				
  1378 
  1258 				eapType->SetTunnelingType(iEapType);					
  1379                 //eapType->SetTunnelingType(iEapType.get_vendor_type());						
  1259 
  1380 
  1260 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
  1261 				
       
  1262 				CleanupStack::PushL(eapType);
  1381 				CleanupStack::PushL(eapType);
  1263 				
  1382 				
  1264 				eapType->CopySettingsL(aDestinationIndexType, aDestinationIndex);
  1383 				eapType->CopySettingsL(aDestinationIndexType, aDestinationIndex);
  1265 				
  1384 				
  1266 				EAP_TRACE_DEBUG_SYMBIAN(
  1385 				EAP_TRACE_DEBUG_SYMBIAN(
  1274 	EAP_TRACE_DEBUG_SYMBIAN(
  1393 	EAP_TRACE_DEBUG_SYMBIAN(
  1275 		(_L("EapTlsPeapUtils::CopySettingsL - End \n")));	
  1394 		(_L("EapTlsPeapUtils::CopySettingsL - End \n")));	
  1276 
  1395 
  1277 }
  1396 }
  1278 
  1397 
       
  1398 // ----------------------------------------------------------
       
  1399 
  1279 #ifdef USE_PAC_STORE
  1400 #ifdef USE_PAC_STORE
  1280 
  1401 
  1281 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType,
  1402 void CEapTlsPeap::UpdatePacStoreCleanupTableL(const TIndexType aIndexType,
  1282 	const TInt aIndex, 
  1403 	const TInt aIndex, 
  1283 	const eap_type_value_e aTunnelingType)
  1404 	const eap_type_value_e aTunnelingType)
  1284 {
  1405 {
       
  1406 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeap::UpdatePacStoreCleanupTableL()\n")));
       
  1407 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeap::UpdatePacStoreCleanupTableL()\n"));
       
  1408 
  1285 	EAP_TRACE_DEBUG_SYMBIAN(
  1409 	EAP_TRACE_DEBUG_SYMBIAN(
  1286 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start")));
  1410 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: Start")));
  1287 	
  1411 	
  1288 	CPacStoreDatabase * pacStoreDb	= CPacStoreDatabase::NewL();
  1412 	CPacStoreDatabase * pacStoreDb	= CPacStoreDatabase::NewL();
  1289 	User::LeaveIfNull(pacStoreDb);
  1413 	User::LeaveIfNull(pacStoreDb);
  1308 	
  1432 	
  1309 	delete pacStoreDb;
  1433 	delete pacStoreDb;
  1310 			
  1434 			
  1311 	EAP_TRACE_DEBUG_SYMBIAN(
  1435 	EAP_TRACE_DEBUG_SYMBIAN(
  1312 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End")));	
  1436 	(_L("CEapTlsPeap::UpdatePacStoreCleanupTableL: End")));	
  1313 	User::Leave(KErrNone);
  1437 
  1314 }
  1438 }
  1315 
  1439 
  1316 #endif // #ifdef USE_PAC_STORE
  1440 #endif // #ifdef USE_PAC_STORE
  1317 
  1441 
       
  1442 // ----------------------------------------------------------
  1318 // End of file
  1443 // End of file
  1319 
  1444