eapol/eapol_framework/eapol_symbian/eap_if/src/EapFastPacStoreImpl.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 22 %
       
    20 */
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ecom/implementationproxy.h>
       
    24 #include "EapolUID.h"
       
    25 #include "EapTraceSymbian.h"
       
    26 #include "EapFastPacStoreImpl.h"
       
    27 #include "eap_automatic_variable.h"
       
    28 
       
    29 // ----------------------------------------------------------
       
    30 
       
    31 const TImplementationProxy ImplementationTable[] = 
       
    32 {
       
    33 	{{0x2002BC93}, reinterpret_cast<TProxyNewLPtr> (CEapFastPacStoreImpl::NewL)}
       
    34 };
       
    35 
       
    36 // ----------------------------------------------------------
       
    37 
       
    38 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    39 {
       
    40 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
    41 
       
    42 	return ImplementationTable;
       
    43 }
       
    44 
       
    45 // ----------------------------------------------------------
       
    46 
       
    47 CEapFastPacStore* CEapFastPacStoreImpl::NewL()
       
    48 {
       
    49     EAP_TRACE_DEBUG_SYMBIAN(
       
    50      (_L("CEapFastPacStoreImpl::NewL")));  
       
    51 
       
    52     CEapFastPacStoreImpl* self = new (ELeave) CEapFastPacStoreImpl();
       
    53 		
       
    54 		self->ConstructL();
       
    55 
       
    56     EAP_TRACE_DEBUG_SYMBIAN(
       
    57      (_L("CEapFastPacStoreImpl::NewL end")));  
       
    58 	return self;
       
    59  	
       
    60 }
       
    61 
       
    62 // ----------------------------------------------------------
       
    63 
       
    64 CEapFastPacStoreImpl::CEapFastPacStoreImpl():
       
    65    	iTools(abs_eap_am_tools_c::new_abs_eap_am_tools_c())
       
    66 	  ,iPartner(eap_pac_store_message_base_c::new_eap_pac_store_client_message_if_c(
       
    67 			iTools,
       
    68 			this))
       
    69     ,iIsValid (EFalse)
       
    70    	,iWaitState(eap_fast_pac_store_impl_wait_state_none)
       
    71     ,iPacStorePassword (new eap_variable_data_c(iTools))
       
    72     ,iIsPresent(EFalse)
       
    73 		,iIsMatching(EFalse)
       
    74 	{
       
    75     EAP_TRACE_DEBUG_SYMBIAN(
       
    76      (_L("CEapFastPacStoreImpl::CEapFastPacStoreImpl")));
       
    77 		
       
    78 		
       
    79     EAP_TRACE_DEBUG_SYMBIAN(
       
    80      (_L("CEapFastPacStoreImpl::CEapFastPacStoreImpl end")));  
       
    81 	}
       
    82 	
       
    83 // ----------------------------------------------------------
       
    84 
       
    85 void CEapFastPacStoreImpl::ConstructL()
       
    86 	{
       
    87     EAP_TRACE_DEBUG_SYMBIAN(
       
    88      (_L("CEapFastPacStoreImpl::ConstructL")));
       
    89 
       
    90 	eap_status_e status = iPartner->configure();
       
    91 	if (status != eap_status_ok)
       
    92 		{
       
    93 			TInt aError = iTools->convert_eapol_error_to_am_error(status);
       
    94 			
       
    95 		abs_eap_am_tools_c::delete_abs_eap_am_tools_c(iTools);
       
    96 		delete iPartner;
       
    97 		iPartner = NULL;
       
    98 		User::Leave(aError);
       
    99 		}
       
   100 			
       
   101     EAP_TRACE_DEBUG_SYMBIAN(
       
   102      (_L("CEapFastPacStoreImpl::ConstructL end")));  
       
   103 		
       
   104 	}
       
   105 	
       
   106 // ----------------------------------------------------------
       
   107 
       
   108 CEapFastPacStoreImpl::~CEapFastPacStoreImpl()
       
   109 	{
       
   110     EAP_TRACE_DEBUG_SYMBIAN(
       
   111      (_L("CEapFastPacStoreImpl::~CEapFastPacStoreImpl")));
       
   112  
       
   113      if ( iPacStorePassword != NULL )
       
   114         {
       
   115         delete iPacStorePassword;
       
   116         }
       
   117 
       
   118 		if (iPartner != 0)
       
   119 			{
       
   120 			iPartner->shutdown();
       
   121 			}
       
   122 		delete iPartner;
       
   123 
       
   124     EAP_TRACE_DEBUG_SYMBIAN(
       
   125      (_L("CEapFastPacStoreImpl::~CEapFastPacStoreImpl end")));  
       
   126 		
       
   127 		abs_eap_am_tools_c::delete_abs_eap_am_tools_c(iTools);
       
   128 		iTools = NULL;
       
   129 	}
       
   130 	
       
   131 
       
   132 // ----------------------------------------------------------
       
   133 
       
   134 void CEapFastPacStoreImpl::Activate()
       
   135 {
       
   136 	EAP_TRACE_DEBUG(
       
   137 		iTools,
       
   138 		TRACE_FLAGS_DEFAULT,
       
   139 		(EAPL("CEapFastPacStoreImpl::Activate(): iAsyncronousStatus=%u\n"),
       
   140 			iAsyncronousStatus.Int()));
       
   141 
       
   142 	EAP_TRACE_RETURN_STRING(iTools, "returns: CEapFastPacStoreImpl::Activate()");
       
   143 
       
   144 	iAsyncronousStatus = KRequestPending;
       
   145 }
       
   146 
       
   147 //----------------------------------------------------------------
       
   148 
       
   149 void CEapFastPacStoreImpl::Complete()
       
   150 {
       
   151 	EAP_TRACE_DEBUG(
       
   152 		iTools,
       
   153 		TRACE_FLAGS_DEFAULT,
       
   154 		(EAPL("CEapFastPacStoreImpl::Complete(): iAsyncronousStatus=%u\n"),
       
   155 		iAsyncronousStatus.Int()));
       
   156 
       
   157 	EAP_TRACE_RETURN_STRING(iTools, "returns: CEapFastPacStoreImpl::Complete()");
       
   158 
       
   159 	iAsyncronousStatus = KErrNone;
       
   160 
       
   161 	// This is needed to continue the execution after Wait.Start(); 
       
   162 	iWait.AsyncStop();
       
   163 }
       
   164 
       
   165 //----------------------------------------------------------------
       
   166 
       
   167 void CEapFastPacStoreImpl::WaitCompletion()
       
   168 {
       
   169 	EAP_TRACE_DEBUG(
       
   170 		iTools,
       
   171 		TRACE_FLAGS_DEFAULT,
       
   172 		(EAPL("CEapFastPacStoreImpl::WaitCompletion(): iAsyncronousStatus=%u\n"),
       
   173 		iAsyncronousStatus.Int()));
       
   174 
       
   175 	EAP_TRACE_RETURN_STRING(iTools, "returns: CEapFastPacStoreImpl::WaitCompletion()");
       
   176 
       
   177 	while (iAsyncronousStatus == KRequestPending)
       
   178 	{
       
   179 		EAP_TRACE_DEBUG(
       
   180 			iTools,
       
   181 			TRACE_FLAGS_DEFAULT,
       
   182 			(EAPL("CEapFastPacStoreImpl::WaitCompletion(): calls iWait.Start()\n")));
       
   183 
       
   184 		iWait.Start();
       
   185 
       
   186 		EAP_TRACE_DEBUG(
       
   187 			iTools,
       
   188 			TRACE_FLAGS_DEFAULT,
       
   189 			(EAPL("CEapFastPacStoreImpl::WaitCompletion(): iWait.Start() returns, iAsyncronousStatus=%u\n"),
       
   190 			iAsyncronousStatus.Int()));
       
   191 	}
       
   192 }
       
   193 
       
   194 // ----------------------------------------------------------
       
   195 
       
   196 void CEapFastPacStoreImpl::OpenPacStoreL()
       
   197 	{
       
   198   EAP_TRACE_DEBUG_SYMBIAN(
       
   199      (_L("CEapFastPacStoreImpl::OpenPacStoreL")));  
       
   200 
       
   201 		eap_status_e status = iPartner->open_pac_store(
       
   202 		iCompletionStatus);
       
   203 		
       
   204 	if (status != eap_status_ok)
       
   205 	{
       
   206 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   207 			EAP_STATUS_RETURN(iTools, status)));
       
   208 	}
       
   209 
       
   210 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_open_pac_store;
       
   211     Activate();
       
   212     WaitCompletion();
       
   213 
       
   214 	if (iCompletionStatus != eap_status_ok)
       
   215 	{
       
   216 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   217 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   218 	}
       
   219 
       
   220   EAP_TRACE_DEBUG_SYMBIAN(
       
   221      (_L("CEapFastPacStoreImpl::OpenPacStoreL end")));  
       
   222 
       
   223 }
       
   224     
       
   225 // ----------------------------------------------------------
       
   226 
       
   227 void CEapFastPacStoreImpl::CreateDeviceSeedL()
       
   228 {
       
   229     EAP_TRACE_DEBUG_SYMBIAN(
       
   230      (_L("CEapFastPacStoreImpl::CreateDeviceSeedL")));  
       
   231 
       
   232 	eap_status_e status = iPartner->create_device_seed(
       
   233 		iCompletionStatus);
       
   234 
       
   235 	if (status != eap_status_ok)
       
   236 	{
       
   237 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   238 			EAP_STATUS_RETURN(iTools, status)));
       
   239 	}
       
   240 
       
   241 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_create_device_seed;
       
   242     Activate();
       
   243     WaitCompletion();
       
   244 
       
   245 	if (iCompletionStatus != eap_status_ok)
       
   246 	{
       
   247 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   248 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   249 	}
       
   250 
       
   251     EAP_TRACE_DEBUG_SYMBIAN(
       
   252      (_L("CEapFastPacStoreImpl::CreateDeviceSeedL end")));  
       
   253 
       
   254 }
       
   255 
       
   256 // ----------------------------------------------------------
       
   257 
       
   258 TBool CEapFastPacStoreImpl::IsMasterKeyPresentL()
       
   259 {
       
   260     EAP_TRACE_DEBUG_SYMBIAN(
       
   261      (_L("CEapFastPacStoreImpl::IsMasterKeyPresentL")));  
       
   262 
       
   263 	eap_status_e status = iPartner->is_master_key_present(
       
   264 		iCompletionStatus);
       
   265 
       
   266 	if (status != eap_status_ok)
       
   267 	{
       
   268 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   269 			EAP_STATUS_RETURN(iTools, status)));
       
   270 	}
       
   271 
       
   272 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_is_master_key_present;
       
   273     Activate();
       
   274     WaitCompletion();
       
   275 
       
   276 	if (iCompletionStatus != eap_status_ok)
       
   277 	{
       
   278 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   279 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   280 	}
       
   281 
       
   282   EAP_TRACE_DEBUG_SYMBIAN(
       
   283      (_L("CEapFastPacStoreImpl::IsMasterKeyPresentL end")));  
       
   284 
       
   285 	return iIsPresent;
       
   286 
       
   287 }
       
   288 
       
   289 // ----------------------------------------------------------
       
   290 
       
   291 TBool CEapFastPacStoreImpl::IsMasterKeyAndPasswordMatchingL(
       
   292 		const TDesC8 & aPassword8)
       
   293 {
       
   294     EAP_TRACE_DEBUG_SYMBIAN(
       
   295      (_L("CEapFastPacStoreImpl::IsMasterKeyAndPasswordMatchingL")));  
       
   296 
       
   297 	(void)iPacStorePassword->set_copy_of_buffer(aPassword8.Ptr(), aPassword8.Size());
       
   298 
       
   299 	eap_status_e status = iPartner->is_master_key_and_password_matching(
       
   300 		iPacStorePassword
       
   301 		,iCompletionStatus);
       
   302 
       
   303 	if (status != eap_status_ok)
       
   304 	{
       
   305 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   306 			EAP_STATUS_RETURN(iTools, status)));
       
   307 	}
       
   308 
       
   309 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_is_master_key_and_password_matching;
       
   310     Activate();
       
   311     WaitCompletion();
       
   312 
       
   313 	if (iCompletionStatus != eap_status_ok)
       
   314 	{
       
   315 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   316 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   317 	}
       
   318 
       
   319   EAP_TRACE_DEBUG_SYMBIAN(
       
   320      (_L("CEapFastPacStoreImpl::IsMasterKeyAndPasswordMatchingL end")));  
       
   321 
       
   322 	return iIsMatching;
       
   323 
       
   324 }
       
   325 
       
   326 // ----------------------------------------------------------
       
   327 
       
   328 TInt CEapFastPacStoreImpl::CreateAndSaveMasterKeyL(
       
   329 		const TDesC8 & aPassword8)
       
   330 {
       
   331     EAP_TRACE_DEBUG_SYMBIAN(
       
   332      (_L("CEapFastPacStoreImpl::CreateAndSaveMasterKeyL")));  
       
   333 
       
   334 	
       
   335 	(void)iPacStorePassword->set_copy_of_buffer(aPassword8.Ptr(), aPassword8.Size());
       
   336 
       
   337 	eap_status_e status = iPartner->create_and_save_master_key(
       
   338 		iPacStorePassword
       
   339 		,iCompletionStatus);
       
   340 
       
   341 	if (status != eap_status_ok)
       
   342 	{
       
   343 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   344 			EAP_STATUS_RETURN(iTools, status)));
       
   345 	}
       
   346 
       
   347 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_create_and_save_master_key;
       
   348     Activate();
       
   349     WaitCompletion();
       
   350 
       
   351 	if (iCompletionStatus != eap_status_ok)
       
   352 	{
       
   353 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   354 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   355 	}
       
   356 
       
   357   EAP_TRACE_DEBUG_SYMBIAN(
       
   358      (_L("CEapFastPacStoreImpl::CreateAndSaveMasterKeyL end")));  
       
   359 
       
   360   return iCompletionStatus;
       
   361 
       
   362 }
       
   363 
       
   364 // ----------------------------------------------------------
       
   365 
       
   366 TBool CEapFastPacStoreImpl::ComparePacStorePasswordL(
       
   367 		TDes8 & aPassword8)
       
   368 {
       
   369     EAP_TRACE_DEBUG_SYMBIAN(
       
   370      (_L("CEapFastPacStoreImpl::ComparePacStorePasswordL")));  
       
   371 
       
   372 	(void)iPacStorePassword->set_copy_of_buffer(aPassword8.Ptr(), aPassword8.Size());
       
   373 
       
   374 	eap_status_e status = iPartner->compare_pac_store_password(
       
   375 		iPacStorePassword);
       
   376 		
       
   377 	if (status != eap_status_ok)
       
   378 	{
       
   379 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   380 			EAP_STATUS_RETURN(iTools, status)));
       
   381 	}
       
   382 
       
   383 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_compare_pac_store_password;
       
   384     Activate();
       
   385     WaitCompletion();
       
   386 
       
   387 	if (iCompletionStatus != eap_status_ok)
       
   388 	{
       
   389 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   390 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   391 	}
       
   392 
       
   393   EAP_TRACE_DEBUG_SYMBIAN(
       
   394      (_L("CEapFastPacStoreImpl::ComparePacStorePasswordL end")));  
       
   395      
       
   396   return iIsPwMatching;
       
   397 
       
   398 }
       
   399 
       
   400  TBool CEapFastPacStoreImpl::IsPacStorePasswordPresentL()
       
   401  	{
       
   402      EAP_TRACE_DEBUG_SYMBIAN(
       
   403      (_L("CEapFastPacStoreImpl::IsPacStorePasswordPresentL")));  
       
   404 
       
   405 	eap_status_e status = iPartner->is_pacstore_password_present();
       
   406 
       
   407 	if (status != eap_status_ok)
       
   408 	{
       
   409 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   410 			EAP_STATUS_RETURN(iTools, status)));
       
   411 	}
       
   412 
       
   413 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_is_pacstore_password_present;
       
   414     Activate();
       
   415     WaitCompletion();
       
   416 
       
   417 	if (iCompletionStatus != eap_status_ok)
       
   418 	{
       
   419 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   420 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   421 	}
       
   422 
       
   423   EAP_TRACE_DEBUG_SYMBIAN(
       
   424      (_L("CEapFastPacStoreImpl::IsPacStorePasswordPresentL end")));  
       
   425 
       
   426 	return iIsPwPresent;
       
   427 		
       
   428  	}
       
   429 
       
   430 // ----------------------------------------------------------
       
   431 
       
   432 TInt CEapFastPacStoreImpl::SetPacStorePasswordL(
       
   433 		const TDesC8 & aPassword8)
       
   434 {
       
   435     EAP_TRACE_DEBUG_SYMBIAN(
       
   436      (_L("CEapFastPacStoreImpl::SetPacStorePasswordL")));  
       
   437 
       
   438 	(void)iPacStorePassword->set_copy_of_buffer(aPassword8.Ptr(), aPassword8.Size());
       
   439 	
       
   440 	eap_status_e status = iPartner->set_pac_store_password(
       
   441 		iPacStorePassword
       
   442 		,iCompletionStatus);
       
   443 
       
   444 	if (status != eap_status_ok)
       
   445 	{
       
   446 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   447 			EAP_STATUS_RETURN(iTools, status)));
       
   448 	}
       
   449 
       
   450 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_set_pac_store_password;
       
   451     Activate();
       
   452     WaitCompletion();
       
   453 
       
   454 	if (iCompletionStatus != eap_status_ok)
       
   455 	{
       
   456 		User::Leave(iTools->convert_eapol_error_to_am_error(
       
   457 			EAP_STATUS_RETURN(iTools, iCompletionStatus)));
       
   458 	}
       
   459 
       
   460   EAP_TRACE_DEBUG_SYMBIAN(
       
   461      (_L("CEapFastPacStoreImpl::SetPacStorePasswordL end")));  
       
   462 
       
   463 	return iCompletionStatus;
       
   464 
       
   465 
       
   466 }
       
   467 
       
   468 // ----------------------------------------------------------
       
   469 
       
   470 TInt CEapFastPacStoreImpl::DestroyPacStore()
       
   471 {
       
   472     EAP_TRACE_DEBUG_SYMBIAN(
       
   473      (_L("CEapFastPacStoreImpl::DestroyPacStore")));  
       
   474 
       
   475 	eap_status_e status = iPartner->destroy_pac_store(
       
   476 		iCompletionStatus);
       
   477 
       
   478 	if (status != eap_status_ok)
       
   479 	{
       
   480 		return iTools->convert_eapol_error_to_am_error(status);
       
   481 	}
       
   482 
       
   483 	iWaitState = eap_fast_pac_store_impl_wait_state_complete_destroy_pac_store;
       
   484     Activate();
       
   485     WaitCompletion();
       
   486 
       
   487   EAP_TRACE_DEBUG_SYMBIAN(
       
   488      (_L("CEapFastPacStoreImpl::DestroyPacStore end")));  
       
   489 
       
   490 	return iCompletionStatus;
       
   491 
       
   492 
       
   493 }
       
   494 
       
   495 // ----------------------------------------------------------
       
   496 
       
   497 eap_status_e CEapFastPacStoreImpl::complete_open_pac_store(
       
   498 		const eap_status_e completion_status)
       
   499 {
       
   500 	EAP_TRACE_DEBUG(
       
   501 		iTools,
       
   502 		TRACE_FLAGS_DEFAULT,
       
   503 		(EAPL("CEapFastPacStoreImpl::complete_open_pac_store(): this=0x%08x, iWaitState=%d\n"),
       
   504 		this,
       
   505 		iWaitState));
       
   506 
       
   507 	iCompletionStatus = completion_status;
       
   508 
       
   509 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_open_pac_store
       
   510 		&& iCompletionStatus == eap_status_ok)
       
   511 	{
       
   512 		// ERROR wrong state.
       
   513 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   514 	}
       
   515 
       
   516 	Complete();
       
   517 
       
   518     EAP_TRACE_DEBUG_SYMBIAN(
       
   519      (_L("CEapFastPacStoreImpl::complete_open_pac_store end")));  
       
   520 
       
   521 	return iCompletionStatus;
       
   522 
       
   523 }
       
   524 
       
   525 // ----------------------------------------------------------
       
   526 
       
   527 eap_status_e CEapFastPacStoreImpl::complete_create_device_seed(
       
   528 		const eap_status_e completion_status)
       
   529 {
       
   530 	EAP_TRACE_DEBUG(
       
   531 		iTools,
       
   532 		TRACE_FLAGS_DEFAULT,
       
   533 		(EAPL("CEapFastPacStoreImpl::complete_create_device_seed(): this=0x%08x, iWaitState=%d\n"),
       
   534 		this,
       
   535 		iWaitState));
       
   536 
       
   537 	iCompletionStatus = completion_status;
       
   538 
       
   539 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_create_device_seed
       
   540 		&& iCompletionStatus == eap_status_ok)
       
   541 	{
       
   542 		// ERROR wrong state.
       
   543 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   544 	}
       
   545 
       
   546 	Complete();
       
   547 
       
   548   EAP_TRACE_DEBUG_SYMBIAN(
       
   549      (_L("CEapFastPacStoreImpl::complete_create_device_seed end")));  
       
   550 
       
   551 	return iCompletionStatus;
       
   552 
       
   553 }
       
   554 
       
   555 // ----------------------------------------------------------
       
   556 
       
   557 eap_status_e CEapFastPacStoreImpl::complete_is_master_key_present(
       
   558 		bool is_present
       
   559 		,const eap_status_e completion_status)
       
   560 {
       
   561 	EAP_TRACE_DEBUG(
       
   562 		iTools,
       
   563 		TRACE_FLAGS_DEFAULT,
       
   564 		(EAPL("CEapFastPacStoreImpl::complete_is_master_key_present(): this=0x%08x, iWaitState=%d\n"),
       
   565 		this,
       
   566 		iWaitState));
       
   567 
       
   568 	iIsPresent = is_present;
       
   569 	iCompletionStatus = completion_status;
       
   570 
       
   571 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_is_master_key_present
       
   572 		&& iCompletionStatus == eap_status_ok)
       
   573 	{
       
   574 		// ERROR wrong state.
       
   575 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   576 	}
       
   577 	
       
   578 	iIsPresent = is_present;
       
   579 	Complete();
       
   580 
       
   581     EAP_TRACE_DEBUG_SYMBIAN(
       
   582      (_L("CEapFastPacStoreImpl::complete_is_master_key_present end")));  
       
   583 
       
   584 	return iCompletionStatus;
       
   585 
       
   586 }
       
   587 
       
   588 // ----------------------------------------------------------
       
   589 
       
   590 eap_status_e CEapFastPacStoreImpl::complete_is_master_key_and_password_matching(
       
   591 		bool is_matching
       
   592 		,const eap_status_e completion_status)
       
   593 {
       
   594 	EAP_TRACE_DEBUG(
       
   595 		iTools,
       
   596 		TRACE_FLAGS_DEFAULT,
       
   597 		(EAPL("CEapFastPacStoreImpl::complete_is_master_key_and_password_matching(): this=0x%08x, iWaitState=%d\n"),
       
   598 		this,
       
   599 		iWaitState));
       
   600 
       
   601 	iCompletionStatus = completion_status;
       
   602 
       
   603 	iIsMatching = is_matching;
       
   604 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_is_master_key_and_password_matching
       
   605 		&& iCompletionStatus == eap_status_ok)
       
   606 	{
       
   607 		// ERROR wrong state.
       
   608 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   609 	}
       
   610 	iIsMatching = is_matching;
       
   611 	
       
   612 	Complete();
       
   613 
       
   614   EAP_TRACE_DEBUG_SYMBIAN(
       
   615      (_L("CEapFastPacStoreImpl::complete_is_master_key_and_password_matching end")));  
       
   616 
       
   617 	return iCompletionStatus;
       
   618 
       
   619 }
       
   620 
       
   621 // ----------------------------------------------------------
       
   622 
       
   623 eap_status_e CEapFastPacStoreImpl::complete_create_and_save_master_key(
       
   624 		const eap_status_e completion_status)
       
   625 {
       
   626 	EAP_TRACE_DEBUG(
       
   627 		iTools,
       
   628 		TRACE_FLAGS_DEFAULT,
       
   629 		(EAPL("CEapFastPacStoreImpl::complete_create_and_save_master_key(): this=0x%08x, iWaitState=%d\n"),
       
   630 		this,
       
   631 		iWaitState));
       
   632 
       
   633 	iCompletionStatus = completion_status;
       
   634 
       
   635 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_create_and_save_master_key
       
   636 		&& iCompletionStatus == eap_status_ok)
       
   637 	{
       
   638 		// ERROR wrong state.
       
   639 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   640 	}
       
   641 
       
   642 	Complete();
       
   643 
       
   644   EAP_TRACE_DEBUG_SYMBIAN(
       
   645      (_L("CEapFastPacStoreImpl::complete_create_and_save_master_key end")));  
       
   646 
       
   647 	return iCompletionStatus;
       
   648 
       
   649 }
       
   650 
       
   651 // ----------------------------------------------------------
       
   652 
       
   653 eap_status_e CEapFastPacStoreImpl::complete_compare_pac_store_password(
       
   654 		bool is_matching)
       
   655 {
       
   656 	EAP_TRACE_DEBUG(
       
   657 		iTools,
       
   658 		TRACE_FLAGS_DEFAULT,
       
   659 		(EAPL("CEapFastPacStoreImpl::complete_compare_pac_store_password(): this=0x%08x, iWaitState=%d\n"),
       
   660 		this,
       
   661 		iWaitState));
       
   662 
       
   663 	iCompletionStatus = eap_status_ok;
       
   664 
       
   665 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_compare_pac_store_password)
       
   666 	{
       
   667 		// ERROR wrong state.
       
   668 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   669 	}
       
   670 
       
   671 	iIsPwMatching = is_matching;
       
   672 	Complete();
       
   673 
       
   674   EAP_TRACE_DEBUG_SYMBIAN(
       
   675      (_L("CEapFastPacStoreImpl::complete_compare_pac_store_password end")));  
       
   676 
       
   677 	return iCompletionStatus;
       
   678 
       
   679 }
       
   680 
       
   681 // ----------------------------------------------------------
       
   682 
       
   683 eap_status_e CEapFastPacStoreImpl::complete_is_pacstore_password_present(
       
   684 		bool is_present)
       
   685 {
       
   686 	EAP_TRACE_DEBUG(
       
   687 		iTools,
       
   688 		TRACE_FLAGS_DEFAULT,
       
   689 		(EAPL("CEapFastPacStoreImpl::complete_is_pacstore_password_present(): this=0x%08x, iWaitState=%d\n"),
       
   690 		this,
       
   691 		iWaitState));
       
   692 
       
   693 	iCompletionStatus = eap_status_ok;
       
   694 
       
   695 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_is_pacstore_password_present)
       
   696 	{
       
   697 		// ERROR wrong state.
       
   698 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   699 	}
       
   700 
       
   701 	iIsPwPresent = is_present;
       
   702 	Complete();
       
   703 
       
   704   EAP_TRACE_DEBUG_SYMBIAN(
       
   705      (_L("CEapFastPacStoreImpl::complete_is_pacstore_password_present end")));  
       
   706 
       
   707 	return iCompletionStatus;
       
   708 
       
   709 }
       
   710 // ----------------------------------------------------------
       
   711 
       
   712 eap_status_e CEapFastPacStoreImpl::complete_set_pac_store_password(
       
   713 		const eap_status_e completion_status)
       
   714 {
       
   715 	EAP_TRACE_DEBUG(
       
   716 		iTools,
       
   717 		TRACE_FLAGS_DEFAULT,
       
   718 		(EAPL("CEapFastPacStoreImpl::complete_set_pac_store_password(): this=0x%08x, iWaitState=%d\n"),
       
   719 		this,
       
   720 		iWaitState));
       
   721 
       
   722 	iCompletionStatus = completion_status;
       
   723 
       
   724 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_set_pac_store_password
       
   725 		&& iCompletionStatus == eap_status_ok)
       
   726 	{
       
   727 		// ERROR wrong state.
       
   728 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   729 	}
       
   730 
       
   731 	Complete();
       
   732 
       
   733   EAP_TRACE_DEBUG_SYMBIAN(
       
   734      (_L("CEapFastPacStoreImpl::complete_set_pac_store_password end")));  
       
   735 
       
   736 	return iCompletionStatus;
       
   737 
       
   738 }
       
   739 
       
   740 // ----------------------------------------------------------
       
   741 
       
   742 eap_status_e CEapFastPacStoreImpl::complete_destroy_pac_store(
       
   743 		const eap_status_e completion_status)
       
   744 {
       
   745 	EAP_TRACE_DEBUG(
       
   746 		iTools,
       
   747 		TRACE_FLAGS_DEFAULT,
       
   748 		(EAPL("CEapFastPacStoreImpl::complete_destroy_pac_store(): this=0x%08x, iWaitState=%d\n"),
       
   749 		this,
       
   750 		iWaitState));
       
   751 
       
   752 	iCompletionStatus = completion_status;
       
   753 
       
   754 	if (iWaitState != eap_fast_pac_store_impl_wait_state_complete_destroy_pac_store
       
   755 		&& iCompletionStatus == eap_status_ok)
       
   756 	{
       
   757 		// ERROR wrong state.
       
   758 		iCompletionStatus = eap_status_wrong_eap_type_state;
       
   759 	}
       
   760 
       
   761 	Complete();
       
   762 
       
   763   EAP_TRACE_DEBUG_SYMBIAN(
       
   764      (_L("CEapFastPacStoreImpl::complete_destroy_pac_store end")));  
       
   765 
       
   766 	return iCompletionStatus;
       
   767 
       
   768 }
       
   769 
       
   770 // ----------------------------------------------------------
       
   771 
       
   772 eap_am_message_if_c * eap_am_message_if_c::new_eap_am_message_if_c(
       
   773 	abs_eap_am_tools_c * const tools)
       
   774 {
       
   775 	EAP_TRACE_DEBUG(
       
   776 		tools,
       
   777 		TRACE_FLAGS_DEFAULT,
       
   778 		(EAPL("eap_am_message_if_c::new_eap_am_server_pac_store_message_c()\n")));
       
   779 
       
   780     eap_am_message_if_c *client_if = new eap_am_message_if_symbian_c(tools, EEapPacStoreNew);
       
   781 
       
   782 	eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if(
       
   783 		tools,
       
   784 		client_if);
       
   785 
       
   786 	if (client_if == 0
       
   787 		|| client_if->get_is_valid() == false)
       
   788 	{
       
   789 		// ERROR.
       
   790 		if (client_if != 0)
       
   791 		{
       
   792 			EAP_TRACE_DEBUG(
       
   793 				tools,
       
   794 				TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
       
   795 				(EAPL("ERROR: calls: eap_am_message_if_c::new_eap_am_server_general_settings_c(): client_if->shutdown()\n")));
       
   796 
       
   797 			client_if->shutdown();
       
   798 		}
       
   799 		return 0;
       
   800 	}
       
   801 
       
   802 	automatic_client_if.do_not_free_variable();
       
   803 
       
   804 	return client_if;
       
   805 
       
   806 }
       
   807 
       
   808 // ----------------------------------------------------------
       
   809 
       
   810 EAP_FUNC_EXPORT eap_pac_store_message_base_c * eap_pac_store_message_base_c::new_eap_pac_store_client_message_if_c(
       
   811 	abs_eap_am_tools_c * const tools,
       
   812 	abs_eap_pac_store_message_c * const partner)
       
   813 {
       
   814 	EAP_TRACE_DEBUG(
       
   815 		tools,
       
   816 		TRACE_FLAGS_DEFAULT,
       
   817 		(EAPL("eap_pac_store_message_base_c::new_eap_pac_store_client_message_if_c()\n")));
       
   818 
       
   819 	eap_am_message_if_c *client_if = eap_am_message_if_c::new_eap_am_message_if_c(
       
   820 		tools);
       
   821 
       
   822 	eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if(
       
   823 		tools,
       
   824 		client_if);
       
   825 
       
   826 	if (client_if == 0
       
   827 		|| client_if->get_is_valid() == false)
       
   828 	{
       
   829 		// ERROR.
       
   830 		if (client_if != 0)
       
   831 		{
       
   832 			EAP_TRACE_DEBUG(
       
   833 				tools,
       
   834 				TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
       
   835 				(EAPL("ERROR: calls: eap_pac_store_message_base_c::new_eap_pac_store_client_message_if_c(): client_if->shutdown()\n")));
       
   836 
       
   837 			(void) client_if->shutdown();
       
   838 		}
       
   839 		return 0;
       
   840 	}
       
   841 
       
   842 	eap_pac_store_client_message_if_c * new_session_core = new eap_pac_store_client_message_if_c(tools, client_if, partner);
       
   843 
       
   844 	eap_automatic_variable_c<eap_pac_store_client_message_if_c> automatic_new_session_core(
       
   845 		tools,
       
   846 		new_session_core);
       
   847 
       
   848 	if (new_session_core == 0
       
   849 		|| new_session_core->get_is_valid() == false)
       
   850 	{
       
   851 		// ERROR.
       
   852 		if (new_session_core != 0)
       
   853 		{
       
   854 			EAP_TRACE_DEBUG(
       
   855 				tools,
       
   856 				TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
       
   857 				(EAPL("ERROR: calls: eap_pac_store_message_base_c::new_eap_pac_store_client_message_if_c(): new_session_core->shutdown()\n")));
       
   858 
       
   859 			new_session_core->shutdown();
       
   860 		}
       
   861 		return 0;
       
   862 	}
       
   863 
       
   864 	client_if->set_partner(new_session_core);
       
   865 
       
   866 	automatic_client_if.do_not_free_variable();
       
   867 	automatic_new_session_core.do_not_free_variable();
       
   868 
       
   869 	return new_session_core;
       
   870 }
       
   871 
       
   872 
       
   873 // ----------------------------------------------------------
       
   874 
       
   875