eapol/eapol_framework/eapol_symbian/am/eapvpnif/src/eap_vpn_if_implementation.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
    14 * Description:  CEapVpnInterfaceImplementation
    14 * Description:  CEapVpnInterfaceImplementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 61 %
    19 * %version: 38.1.5 %
    20 */
    20 */
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <w32std.h>
    23 #include <w32std.h>
    24 #include <pathinfo.h>
    24 #include <pathinfo.h>
    25 
       
    26 #include <EapType.h>
       
    27 #include <EapTypePlugin.h>
       
    28 
    25 
    29 #include "eap_vpn_if_implementation.h"
    26 #include "eap_vpn_if_implementation.h"
    30 #include "eap_am_memory.h"
    27 #include "eap_am_memory.h"
    31 #include "eap_tools.h"
    28 #include "eap_tools.h"
    32 #include "eap_type_all.h"
    29 #include "eap_type_all.h"
    33 #include "eap_am_tools_symbian.h"
    30 #include "eap_am_tools_symbian.h"
    34 #include "eap_crypto_api.h"
    31 #include "eap_crypto_api.h"
    35 #include "eap_type_gsmsim.h"
    32 #include "eap_type_gsmsim.h"
    36 #include "eap_type_aka.h"
    33 #include "eap_type_aka.h"
    37 #include "eap_header_string.h"
    34 #include "eap_header_string.h"
    38 //#include "EapolDbDefaults.h"
    35 #include "EapolDbDefaults.h"
    39 //#include "EapolDbParameterNames.h"
    36 #include "EapolDbParameterNames.h"
    40 #include "eap_am_file_input_symbian.h"
    37 #include "eap_am_file_input_symbian.h"
    41 #include "abs_eap_vpn_if.h"
    38 #include "abs_eap_vpn_if.h"
    42 #include "eap_array_algorithms.h"
    39 #include "eap_array_algorithms.h"
    43 #include "eap_core.h"
       
    44 
    40 
    45 #include "EapSimDbDefaults.h"
    41 #include "EapSimDbDefaults.h"
    46 #include "EapConversion.h"
       
    47 #include "eap_session_core_base.h"
       
    48 #include "eap_automatic_variable.h"
       
    49 #include "eap_core_client_message_if.h"
       
    50 #include "eap_process_tlv_message_data.h"
       
    51 
    42 
    52 // LOCAL CONSTANTS
    43 // LOCAL CONSTANTS
    53 const TUint KMaxConfigStringLength = 256;
    44 const TUint KMaxConfigStringLength = 256;
    54 const u32_t KMTU = 1500u;
    45 const u32_t KMTU = 1500u;
    55 const u32_t KTrailerLength = 0;
    46 const u32_t KTrailerLength = 0;
    56 const u32_t KHeaderOffset = 0;
    47 const u32_t KHeaderOffset = 0;
    57 
    48 
       
    49 #ifndef USE_EAP_EXPANDED_TYPES
       
    50 
       
    51 static const TUint KMaxEapCueLength = 3;
       
    52 
       
    53 #endif //#ifndef USE_EAP_EXPANDED_TYPES
       
    54 
    58 #define KEapIdentityOffset 5
    55 #define KEapIdentityOffset 5
    59 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt");
    56 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt");
    60 
    57 
    61 enum eapol_am_core_timer_id_e
    58 enum eapol_am_core_timer_id_e
    62 {
    59 {
    92 const TInt EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX = 1; 
    89 const TInt EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX = 1; 
    93 
    90 
    94 CEapVpnInterfaceImplementation::CEapVpnInterfaceImplementation()
    91 CEapVpnInterfaceImplementation::CEapVpnInterfaceImplementation()
    95 : m_trace_log_file_name(0)
    92 : m_trace_log_file_name(0)
    96 , m_is_client(true)
    93 , m_is_client(true)
       
    94 #ifdef USE_EAP_EXPANDED_TYPES
    97 , m_eap_type_array(0)
    95 , m_eap_type_array(0)
       
    96 #endif //#ifdef USE_EAP_EXPANDED_TYPES
    98 , m_index_type(EVpn)
    97 , m_index_type(EVpn)
    99 , m_index(EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX)
    98 , m_index(EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX)
   100 {
    99 {
   101 }
   100 }
   102 	
   101 	
   214 		}
   213 		}
   215 
   214 
   216 		CleanupStack::PopAndDestroy(buf); // Delete pathbuffer.
   215 		CleanupStack::PopAndDestroy(buf); // Delete pathbuffer.
   217 	}
   216 	}
   218     
   217     
       
   218 
       
   219 #ifdef USE_EAP_EXPANDED_TYPES
       
   220 
   219 	m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools);
   221 	m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools);
   220 	if (m_eap_type_array == 0)
   222 	if (m_eap_type_array == 0)
   221 	{
   223 	{
   222 		User::Leave(KErrGeneral);
   224 		User::Leave(KErrGeneral);
   223 	}
   225 	}
       
   226 
       
   227 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   228 
   224 
   229 
   225     //------ Create network id
   230     //------ Create network id
   226 	{
   231 	{
   227 		EAP_TRACE_DEBUG(
   232 		EAP_TRACE_DEBUG(
   228     		m_am_tools,
   233     		m_am_tools,
   379 	if(m_receive_network_id != 0)
   384 	if(m_receive_network_id != 0)
   380 	{
   385 	{
   381 		delete m_receive_network_id;
   386 		delete m_receive_network_id;
   382 	}
   387 	}
   383 
   388 
   384 	{
   389 	// Unload all loaded plugins
   385 		// Unload all loaded EAP-interfaces.
   390 	for(int i = 0; i < m_plugin_if_array.Count(); i++)
   386 		for(int i = 0; i < m_eap_if_array.Count(); i++)
   391 	{
   387 		{
   392 		delete m_plugin_if_array[i];
   388 			delete m_eap_if_array[i];
   393 	}
   389 		}
   394 
   390 
   395 	m_plugin_if_array.Close();
   391 		m_eap_if_array.Close();
   396 
   392 	}
   397 #ifdef USE_EAP_EXPANDED_TYPES
   393 
       
   394 	{
       
   395 		// Unload all loaded EAP-plugins.
       
   396 		for(int i = 0; i < m_eap_plugin_if_array.Count(); i++)
       
   397 		{
       
   398 			delete m_eap_plugin_if_array[i];
       
   399 		}
       
   400 
       
   401 		m_eap_plugin_if_array.Close();
       
   402 	}
       
   403 
   398 
   404 	m_enabled_expanded_eap_array.ResetAndDestroy();
   399 	m_enabled_expanded_eap_array.ResetAndDestroy();
   405 
   400 
   406 	m_disabled_expanded_eap_array.ResetAndDestroy();
   401 	m_disabled_expanded_eap_array.ResetAndDestroy();
   407 	
   402 	
   408 	m_eap_type_array->reset();
   403 	m_eap_type_array->reset();
   409 
   404 
   410 	delete m_eap_type_array;
   405 	delete m_eap_type_array;
   411 	m_eap_type_array = 0;
   406 	m_eap_type_array = 0;
       
   407 
       
   408 #else // For normal EAP type.
       
   409 
       
   410 	// Delete the IAP EAP type info array
       
   411 	m_iap_eap_array.ResetAndDestroy();
       
   412 
       
   413 	m_eap_type_array.Close();
       
   414 
       
   415 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   412 
   416 
   413 	delete iManualUsername;
   417 	delete iManualUsername;
   414 	iManualUsername = NULL;
   418 	iManualUsername = NULL;
   415 
   419 
   416 	delete iManualRealm;
   420 	delete iManualRealm;
   677 	}
   681 	}
   678 
   682 
   679 	// Clear packet send and notification blocking.
   683 	// Clear packet send and notification blocking.
   680 	m_block_packet_sends_and_notifications = false;
   684 	m_block_packet_sends_and_notifications = false;
   681 
   685 
       
   686 #ifdef USE_EAP_EXPANDED_TYPES
       
   687 
   682 	if (m_enabled_expanded_eap_array.Count() == 0)
   688 	if (m_enabled_expanded_eap_array.Count() == 0)
   683 	{
   689 	{
   684 		// The EAP field was empty. Allow all types.
   690 		// The EAP field was empty. Allow all types.
   685 
   691 
   686 		EAP_TRACE_ALWAYS(
   692 		EAP_TRACE_ALWAYS(
   750 		} // for()
   756 		} // for()
   751 
   757 
   752 		CleanupStack::PopAndDestroy(&eapArray);
   758 		CleanupStack::PopAndDestroy(&eapArray);
   753 	}
   759 	}
   754 
   760 
       
   761 #else // For normal EAP type.
       
   762 
       
   763 	if (m_iap_eap_array.Count() == 0)
       
   764 	{
       
   765 		// The EAP field was empty. Allow all types.
       
   766 
       
   767 		EAP_TRACE_ALWAYS(
       
   768 		m_am_tools,
       
   769 		TRACE_FLAGS_DEFAULT,
       
   770 		(EAPL("Empty EAP field -> enable all types.\n")));
       
   771 
       
   772 		RImplInfoPtrArray eapArray;
       
   773 		CleanupStack::PushL( TCleanupItem( CleanupImplArray, &eapArray ) );
       
   774 
       
   775 		REComSession::ListImplementationsL(KEapTypeInterfaceUid, eapArray);
       
   776 
       
   777 		for (TInt i = 0; i < eapArray.Count(); i++)
       
   778 		{
       
   779 			TEap *eap = new(ELeave) TEap;
       
   780 			eap->UID.Copy(eapArray[i]->DataType());
       
   781 			eap->Enabled = EFalse;
       
   782 
       
   783 			// Convert the string to integer
       
   784 			TLex8 tmp(eap->UID);
       
   785 			TInt val(0);
       
   786 			tmp.Val(val);
       
   787 
       
   788 			if(val == iRequestedEapType)
       
   789 			{
       
   790 				eap->Enabled = ETrue;
       
   791 
       
   792 				EAP_TRACE_ALWAYS(
       
   793 					m_am_tools,
       
   794 					TRACE_FLAGS_DEFAULT,
       
   795 					(EAPL("EAP-Type %d enabled\n"), val));
       
   796 
       
   797 				m_iap_eap_array.Insert(eap, 0);
       
   798 			}
       
   799 			else
       
   800 			{
       
   801 				m_iap_eap_array.Append(eap);
       
   802 
       
   803 				EAP_TRACE_ALWAYS(
       
   804 					m_am_tools,
       
   805 					TRACE_FLAGS_DEFAULT,
       
   806 					(EAPL("EAP-Type %d disabled\n"), val));
       
   807 			}
       
   808 		} // for()
       
   809 
       
   810 		CleanupStack::PopAndDestroy(&eapArray);
       
   811 	}
       
   812 
       
   813 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   814 
   755 	CompleteAssociation(status);
   815 	CompleteAssociation(status);
   756 
   816 
   757 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   817 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   758 	return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status));
   818 	return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status));
   759 }
   819 }
  1016 
  1076 
  1017 	eap_status_e status(eap_status_ok);
  1077 	eap_status_e status(eap_status_ok);
  1018 
  1078 
  1019 	if (iEapCore == 0)
  1079 	if (iEapCore == 0)
  1020 	{        
  1080 	{        
  1021 		iEapCore = new_eap_core_client_message_if_c(
  1081 		iEapCore = new eap_core_c(m_am_tools, this, m_is_client, m_receive_network_id, EFalse);
  1022 			m_am_tools,
       
  1023 			this,
       
  1024 			true,
       
  1025 			KMTU);
       
  1026 
  1082 
  1027 		if (iEapCore == 0
  1083 		if (iEapCore == 0
  1028 			|| iEapCore->get_is_valid() != true)
  1084 			|| iEapCore->get_is_valid() != true)
  1029 		{
  1085 		{
  1030 			if (iEapCore != 0)
  1086 			if (iEapCore != 0)
  1265 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1321 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1266 	}
  1322 	}
  1267 
  1323 
  1268 	EAP_ASSERT_TOOLS(m_am_tools, (type == iRequestedEapType));
  1324 	EAP_ASSERT_TOOLS(m_am_tools, (type == iRequestedEapType));
  1269 
  1325 
  1270 	TEapExpandedType aEapType;
  1326 #ifdef USE_EAP_EXPANDED_TYPES
  1271 
  1327 
  1272 	TInt error = CEapConversion::ConvertInternalTypeToExpandedEAPType(
  1328 		TBuf8<KExpandedEapTypeSize> cue;
  1273 		&iRequestedEapType,
  1329 		
  1274 		&aEapType);
  1330 		// Some indirect way of forming the 8 byte string of an EAP type for the cue is needed here.		
  1275 	if (error != KErrNone)
  1331 		TUint8 tmpExpCue[KExpandedEapTypeSize];
  1276 	{
  1332 
  1277 		EAP_TRACE_DEBUG_SYMBIAN(
  1333 		// This is to make the tmpExpCue in 8 byte string with correct vendor type and vendor id details.
  1278 			(_L("ERROR: CEapVpnInterfaceImplementation::load_module(): Error from CEapConversion::ConvertExpandedEAPTypeToInternalType()=%d\n"),
  1334 		status = eap_expanded_type_c::write_type(m_am_tools,
  1279 			error));		
  1335 												0, // index should be zero here.
  1280 	
  1336 												tmpExpCue,
  1281 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1337 												KExpandedEapTypeSize,
  1282 		return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error));
  1338 												true,
  1283 	}
  1339 												iRequestedEapType);
  1284 
  1340 		if (status != eap_status_ok)
  1285 	i32_t eapArrayIndex = -1;
  1341 		{
  1286 
       
  1287 	{
       
  1288 		CEapType* eapType = 0;
       
  1289 
       
  1290 		// Check if this EAP type has already been loaded
       
  1291 		eapArrayIndex = find<eap_type_value_e>(
       
  1292 			m_eap_type_array,
       
  1293 			&iRequestedEapType,
       
  1294 			m_am_tools);
       
  1295 
       
  1296 		if (eapArrayIndex >= 0)
       
  1297 		{
       
  1298 			// Yep. It was loaded already.
       
  1299 			EAP_TRACE_DEBUG(
  1342 			EAP_TRACE_DEBUG(
  1300 				m_am_tools,
  1343 				m_am_tools,
  1301 				TRACE_FLAGS_DEFAULT,
  1344 				TRACE_FLAGS_DEFAULT,
  1302 				(EAPL("CEapVpnInterfaceImplementation: EAP Type Already loaded\n")));
  1345 				(EAPL("load_module: eap_expanded_type_c::write_type failed \n")));
  1303 
       
  1304 			eapType = m_eap_if_array[eapArrayIndex];		
       
  1305 		}
       
  1306 		else 
       
  1307 		{
       
  1308 			// We must have a trap here since the EAP core knows nothing about Symbian.
       
  1309 			EAP_TRACE_DEBUG(
       
  1310 				m_am_tools,
       
  1311 				TRACE_FLAGS_DEFAULT,
       
  1312 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new\n")));
       
  1313 
       
  1314 			TRAP(error, (eapType = CEapType::NewL(m_index_type, m_index, aEapType)));	
       
  1315 
       
  1316 			if (error != KErrNone
       
  1317 				|| eapType == 0)
       
  1318 			{
       
  1319 				// Interface not found or implementation creation function failed
       
  1320 				
       
  1321 				delete eapType;
       
  1322 				eapType = 0;
       
  1323 				
       
  1324 				EAP_TRACE_DEBUG(
       
  1325 					m_am_tools,
       
  1326 					TRACE_FLAGS_DEFAULT,
       
  1327 					(EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n")));
       
  1328 				EAP_TRACE_ALWAYS(
       
  1329 					m_am_tools,
       
  1330 					TRACE_FLAGS_DEFAULT,
       
  1331 					(EAPL("ECom could not find/initiate implementation.\n")));
       
  1332 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1333 			}
       
  1334 
       
  1335 			// Add EAP-interface information to the member arrays.
       
  1336 			if (m_eap_if_array.Append(eapType) != KErrNone)
       
  1337 			{
       
  1338 				delete eapType;
       
  1339 				status = eap_status_allocation_error;
       
  1340 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1341 				return EAP_STATUS_RETURN(m_am_tools, status);				
       
  1342 			}
       
  1343 		}
       
  1344 
       
  1345 		//--------------------------------------------------------
       
  1346 		//--------------------------------------------------------
       
  1347 		// Set the values for realm and user name if there is any.
       
  1348 		// If there is no values the default settings will be used( automatic realm and username).
       
  1349 
       
  1350 
       
  1351 		{
       
  1352 			EAP_TRACE_DEBUG(
       
  1353 				m_am_tools,
       
  1354 				TRACE_FLAGS_DEFAULT,
       
  1355 				(EAPL("CEapVpnInterfaceImplementation::load_module - About to configure manual/auto username and manual/auto realm \n")));
       
  1356 		
  1346 		
  1357 			EAPSettings* setSettings = new EAPSettings;
  1347 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1358 			if( setSettings == NULL )     
  1348 			return EAP_STATUS_RETURN(m_am_tools, status);
  1359 			{
  1349 		}
  1360 				EAP_TRACE_DEBUG(
  1350 		
  1361 					m_am_tools,
  1351 		// Now copy the 8 byte string to the real expanded cue.
  1362 					TRACE_FLAGS_DEFAULT,
  1352 		cue.Copy(tmpExpCue, KExpandedEapTypeSize);
  1363 					(EAPL("CEapVpnInterfaceImplementation::load_module - EAPSettings allocation error \n")));
  1353 
  1364 	    		
  1354 		EAP_TRACE_DATA_DEBUG(
  1365 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1355 			m_am_tools,
  1366 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1356 			TRACE_FLAGS_DEFAULT,
  1367 			}
  1357 			(EAPL("EAPOL:CEapVpnInterfaceImplementation::load_module: Expanded CUE:"),
  1368 			
  1358 			cue.Ptr(),
  1369 			if(iRequestedEapType == eap_type_aka)
  1359 			cue.Size()));
  1370 			{
  1360 
  1371 				setSettings->iEAPExpandedType = *EapExpandedTypeAka.GetType();
  1361 #else
  1372 				
  1362 
  1373 			}
  1363 	TBuf8<KMaxEapCueLength> cue;
  1374 			else if(iRequestedEapType == eap_type_gsmsim)
  1364 	cue.Num(static_cast<TInt>(iRequestedEapType));
  1375 			{
  1365 
  1376 				setSettings->iEAPExpandedType = *EapExpandedTypeSim.GetType();
  1366 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1377 			}
  1367 
  1378 			else
  1368 	CEapType* eapType = 0;
  1379 			{
  1369 	TInt error(KErrNone);
  1380 				delete setSettings;
  1370 
  1381 				setSettings = 0;
  1371 #ifdef USE_EAP_EXPANDED_TYPES
  1382 
  1372 
  1383 				// Only EAP-SIM and AKA are possible now.
  1373 	// Check if this EAP type has already been loaded
  1384 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1374 	TInt eapArrayIndex = find<eap_type_value_e>(
  1385 				return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1375 		m_eap_type_array,
  1386 			}
  1376 		&iRequestedEapType,
  1387 			
  1377 		m_am_tools);
  1388 			if(iManualUsername && iManualUsername->Length() != 0)
  1378 
  1389 			{
  1379 	if (eapArrayIndex >= 0)
  1390     			setSettings->iUsernamePresent = ETrue; // Same value for both SIM and AKA.
  1380 
  1391 	    		setSettings->iUsername.Copy(iManualUsername->Des());
  1381 #else // For normal EAP type.
  1392 			}
  1382 
  1393 			else
  1383 	// Check if this EAP type has already been loaded
  1394 			{
  1384 	TInt eapArrayIndex = m_eap_type_array.Find(iRequestedEapType);
  1395 	    		// No user name. we have to set automatic now.
  1385 
  1396 	    		setSettings->iUsernamePresent = EFalse; // Same value for both SIM and AKA.
  1386 	if (eapArrayIndex != KErrNotFound)
  1397 	    		setSettings->iUseAutomaticUsernamePresent = ETrue; // Same value for both SIM and AKA.
  1387 
  1398 	    		setSettings->iUseAutomaticUsername = ETrue; // Same value for both SIM and AKA.
  1388 #endif
  1399 			}
  1389 
  1400 			
  1390 	{
  1401 			if(iManualRealm && iManualRealm->Length() != 0)
  1391 		// Yep. It was loaded already.
  1402 			{
  1392 		EAP_TRACE_DEBUG(
  1403 	    		setSettings->iRealmPresent = ETrue; // Same value for both SIM and AKA.
  1393 			m_am_tools,
  1404 	    		setSettings->iRealm.Copy(iManualRealm->Des());
  1394 			TRACE_FLAGS_DEFAULT,
  1405 			}
  1395 			(EAPL("CEapVpnInterfaceImplementation: EAP Type Already loaded\n")));
  1406 			else
  1396 
  1407 			{
  1397 		eapType = m_plugin_if_array[eapArrayIndex];		
  1408 	    		// No realm. we have to set automatic now.
  1398 	}
  1409 	    		setSettings->iRealmPresent = EFalse; // Same value for both SIM and AKA.
  1399 	else 
  1410 	    		setSettings->iUseAutomaticRealmPresent = ETrue; // Same value for both SIM and AKA.
  1400 	{
  1411 	    		setSettings->iUseAutomaticRealm = ETrue; // Same value for both SIM and AKA.
  1401 		// We must have a trap here since the EAP core knows nothing about Symbian.
  1412 			}    
  1402 		EAP_TRACE_DEBUG(
  1413 			
  1403 			m_am_tools,
  1414 			TRAP(error, eapType->SetConfigurationL(*setSettings) );
  1404 			TRACE_FLAGS_DEFAULT,
  1415 			if ( error != KErrNone )
  1405 			(EAPL("CEapVpnInterfaceImplementation: EAP Type new\n")));
  1416 			{
  1406 
  1417 				EAP_TRACE_DEBUG(
  1407 		TRAP(error, (eapType = CEapType::NewL(cue, m_index_type, m_index)));	
  1418 					m_am_tools,
       
  1419 					TRACE_FLAGS_DEFAULT,
       
  1420 					(EAPL("CEapVpnInterfaceImplementation::load_module - Setting Manual Username and Realm failed.error=%d, Continuing \n")));
       
  1421 			}
       
  1422 			
       
  1423 			delete setSettings;
       
  1424 			setSettings = 0;    
       
  1425 		}
       
  1426 	}
       
  1427     
       
  1428 	//--------------------------------------------------------
       
  1429 	//--------------------------------------------------------
       
  1430 	
       
  1431 	// Create the EAP protocol interface implementation.
       
  1432 	EAP_TRACE_DEBUG(
       
  1433 		m_am_tools,
       
  1434 		TRACE_FLAGS_DEFAULT,
       
  1435 		(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n")));
       
  1436 
       
  1437 
       
  1438 	{
       
  1439 		CEapTypePlugin* eapPlugin = 0;
       
  1440 
       
  1441 		TRAP(error, (eapPlugin = CEapTypePlugin::NewL(aEapType.GetValue(), m_index_type, m_index)));
       
  1442 
  1408 
  1443 		if (error != KErrNone
  1409 		if (error != KErrNone
  1444 			|| eapPlugin == 0)
  1410 			|| eapType == 0)
  1445 		{
  1411 		{
  1446 			// Interface not found or implementation creation function failed
  1412 			// Interface not found or implementation creation function failed
  1447 			
  1413 			
  1448 			delete eapPlugin;
  1414 			delete eapType;
  1449 			eapPlugin = 0;
  1415 			eapType = 0;
  1450 			
  1416 			
  1451 			EAP_TRACE_DEBUG(
  1417 			EAP_TRACE_DEBUG(
  1452 				m_am_tools,
  1418 				m_am_tools,
  1453 				TRACE_FLAGS_DEFAULT,
  1419 				TRACE_FLAGS_DEFAULT,
  1454 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n")));
  1420 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n")));
  1456 				m_am_tools,
  1422 				m_am_tools,
  1457 				TRACE_FLAGS_DEFAULT,
  1423 				TRACE_FLAGS_DEFAULT,
  1458 				(EAPL("ECom could not find/initiate implementation.\n")));
  1424 				(EAPL("ECom could not find/initiate implementation.\n")));
  1459 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1425 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1460 		}
  1426 		}
  1461 
  1427 	}
  1462 #ifdef USE_EAP_SIMPLE_CONFIG
  1428 
  1463 
  1429 	//--------------------------------------------------------
  1464 		TRAP(error, (*eap_type_if = eapPlugin->GetStackInterfaceL(
  1430 	//--------------------------------------------------------
  1465 			m_am_tools, 
  1431 	// Set the values for realm and user name if there is any.
  1466 			partner, 
  1432 	// If there is no values the default settings will be used( automatic realm and username).
  1467 			is_client_when_true, 
  1433 
  1468 			receive_network_id,
  1434 
  1469 			0))); // Check this up.
  1435 	{
  1470 
  1436 		EAP_TRACE_DEBUG(
  1471 #else
  1437 			m_am_tools,
  1472 
  1438 			TRACE_FLAGS_DEFAULT,
  1473 		TRAP(error, (*eap_type_if = eapPlugin->GetStackInterfaceL(
  1439 			(EAPL("CEapVpnInterfaceImplementation::load_module - About to configure manual/auto username and manual/auto realm \n")));
  1474 			m_am_tools, 
  1440 	
  1475 			partner, 
  1441 	    EAPSettings* setSettings = new EAPSettings;
  1476 			is_client_when_true, 
  1442 		if( setSettings == NULL )     
  1477 			receive_network_id)));
       
  1478 
       
  1479 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
       
  1480 
       
  1481 		if (error != KErrNone 
       
  1482 			|| *eap_type_if == 0 
       
  1483 			|| (*eap_type_if)->get_is_valid() == false)
       
  1484 		{
  1443 		{
  1485 			EAP_TRACE_DEBUG(
  1444 			EAP_TRACE_DEBUG(
  1486 				m_am_tools,
  1445 				m_am_tools,
  1487 				TRACE_FLAGS_DEFAULT,
  1446 				TRACE_FLAGS_DEFAULT,
  1488 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), failed = %d\n"), error));
  1447 				(EAPL("CEapVpnInterfaceImplementation::load_module - EAPSettings allocation error \n")));
  1489 
  1448 	    	
  1490 			EAP_TRACE_ALWAYS(
  1449 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1491 				m_am_tools,
  1450 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1492 				TRACE_FLAGS_DEFAULT,
  1451 		}
  1493 				(EAPL("Could not create EAP type interface instance. Error: %d\n"), error));
  1452 	    
  1494 
  1453 		if(iRequestedEapType == eap_type_aka)
  1495 			status = eap_status_allocation_error;
  1454 		{
  1496 
  1455 			setSettings->iEAPType = EAPSettings::EEapAka;
  1497 			// Unload DLL (two ways, depending whether this type was already loaded...)
  1456 			
  1498 			if  (eapArrayIndex < 0)
  1457 		}
  1499 			{
  1458 		else if(iRequestedEapType == eap_type_gsmsim)
  1500 				// No need to call shutdown here because GetStackInterfaceL has done it.
  1459 		{
  1501 				delete m_eap_if_array[m_eap_if_array.Count() - 1];
  1460 			setSettings->iEAPType = EAPSettings::EEapSim;
  1502 				m_eap_if_array.Remove(m_eap_if_array.Count() - 1);
       
  1503 
       
  1504 				delete eapPlugin;
       
  1505 			}
       
  1506 			else
       
  1507 			{
       
  1508 				unload_module((eap_type_value_e)iRequestedEapType);
       
  1509 			}
       
  1510 			// Note: even in error cases eap_core_c deletes eap_type_if
       
  1511 		}
  1461 		}
  1512 		else
  1462 		else
  1513 		{
  1463 		{
       
  1464 			delete setSettings;
       
  1465 			setSettings = 0;
       
  1466 
       
  1467 			// Only EAP-SIM and AKA are possible now.
       
  1468 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1469 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
       
  1470 		}
       
  1471 	    
       
  1472 	    if(iManualUsername && iManualUsername->Length() != 0)
       
  1473 	    {
       
  1474     		setSettings->iUsernamePresent = EGSMSIMUseManualUsernameYes; // Same value for both SIM and AKA.
       
  1475 	    	setSettings->iUsername.Copy(iManualUsername->Des());
       
  1476 	    }
       
  1477 	    else
       
  1478 	    {
       
  1479 	    	// No user name. we have to set automatic now.
       
  1480 	    	setSettings->iUsernamePresent = EGSMSIMUseManualUsernameNo; // Same value for both SIM and AKA.
       
  1481 	    }
       
  1482 	    
       
  1483 	    if(iManualRealm && iManualRealm->Length() != 0)
       
  1484 	    {
       
  1485 	    	setSettings->iRealmPresent = EGSMSIMUseManualRealmYes; // Same value for both SIM and AKA.
       
  1486 	    	setSettings->iRealm.Copy(iManualRealm->Des());
       
  1487 	    }
       
  1488 	    else
       
  1489 	    {
       
  1490 	    	// No realm. we have to set automatic now.
       
  1491 	    	setSettings->iRealmPresent = EGSMSIMUseManualRealmNo; // Same value for both SIM and AKA.
       
  1492 	    }    
       
  1493 	    
       
  1494 		TRAP(error, eapType->SetConfigurationL(*setSettings) );
       
  1495 	    if ( error != KErrNone )
       
  1496 	    {
  1514 			EAP_TRACE_DEBUG(
  1497 			EAP_TRACE_DEBUG(
  1515 				m_am_tools,
  1498 				m_am_tools,
  1516 				TRACE_FLAGS_DEFAULT,
  1499 				TRACE_FLAGS_DEFAULT,
  1517 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), success\n")));
  1500 				(EAPL("CEapVpnInterfaceImplementation::load_module - Setting Manual Username and Realm failed.error=%d, Continuing \n")));
  1518 
  1501 	    }
  1519 			status = eap_status_ok;
  1502 	    
  1520 
  1503 	    delete setSettings;
  1521 			if (eapArrayIndex  < 0)
  1504 	    setSettings = 0;    
  1522 			{
  1505 	}
  1523 				// Add plugin information to the member arrays. There is no need to store eap_type pointer because
  1506     
  1524 				// the stack takes care of its deletion.
  1507 	//--------------------------------------------------------
  1525 				if (m_eap_plugin_if_array.Append(eapPlugin) != KErrNone)
  1508 	//--------------------------------------------------------
  1526 				{
  1509 	
  1527 					delete m_eap_if_array[m_eap_if_array.Count() - 1];
  1510 	// Create the EAP protocol interface implementation.
  1528 					m_eap_if_array.Remove(m_eap_if_array.Count() - 1);
  1511 	EAP_TRACE_DEBUG(
  1529 
  1512 		m_am_tools,
  1530 					delete eapPlugin;
  1513 		TRACE_FLAGS_DEFAULT,
  1531 					status = eap_status_allocation_error;
  1514 		(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n")));
  1532 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1515 
  1533 					return EAP_STATUS_RETURN(m_am_tools, status);				
  1516 #ifdef USE_EAP_SIMPLE_CONFIG
  1534 				}
  1517 
  1535 
  1518 	TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL(
  1536 				eap_type_value_e * tmpEAPType = new eap_type_value_e();
  1519 		m_am_tools, 
  1537 				if(tmpEAPType == NULL)
  1520 		partner, 
  1538 				{
  1521 		is_client_when_true, 
  1539 					EAP_TRACE_DEBUG(
  1522 		receive_network_id,
  1540 						m_am_tools,
  1523 		0))); // Check this up.
  1541 						TRACE_FLAGS_DEFAULT,
  1524 
  1542 						(EAPL("eapol_am_wlan_authentication_symbian_c::load_module() eap_type_value_e creation failed\n")));
  1525 #else
  1543 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1526 
  1544 					return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1527 	TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL(
  1545 				}
  1528 		m_am_tools, 
  1546 				
  1529 		partner, 
  1547 				*tmpEAPType = type;
  1530 		is_client_when_true, 
  1548 				
  1531 		receive_network_id)));
  1549 				status = m_eap_type_array->add_object(tmpEAPType, true);
  1532 
  1550 				
  1533 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
  1551 				if (status != eap_status_ok)			
  1534 
  1552 				{
  1535 	if (error != KErrNone 
  1553 					delete m_eap_if_array[m_eap_if_array.Count() - 1];
  1536 		|| *eap_type_if == 0 
  1554 					m_eap_if_array.Remove(m_eap_if_array.Count() - 1);
  1537 		|| (*eap_type_if)->get_is_valid() == false)
  1555 
  1538 	{
  1556 					// Remove the eap type added just previously
  1539 		EAP_TRACE_DEBUG(
  1557 					m_eap_plugin_if_array.Remove(m_eap_plugin_if_array.Count() - 1);
  1540 			m_am_tools,
  1558 					delete eapPlugin;
  1541 			TRACE_FLAGS_DEFAULT,
  1559 
  1542 			(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), failed = %d\n"), error));
  1560 					status = eap_status_allocation_error;
  1543 
  1561 
  1544 		EAP_TRACE_ALWAYS(
  1562 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1545 			m_am_tools,
  1563 					return EAP_STATUS_RETURN(m_am_tools, status);				
  1546 			TRACE_FLAGS_DEFAULT,
  1564 				}
  1547 			(EAPL("Could not create EAP type interface instance. Error: %d\n"), error));
  1565 			} 
  1548 
  1566 		}
  1549 		status = eap_status_allocation_error;
       
  1550 
       
  1551 		// Unload DLL (two ways, depending whether this type was already loaded...)
       
  1552 		if  (eapArrayIndex == KErrNotFound)
       
  1553 		{
       
  1554 			// No need to call shutdown here because GetStackInterfaceL has done it.
       
  1555 			delete eapType;
       
  1556 		}
       
  1557 		else
       
  1558 		{
       
  1559 			unload_module((eap_type_value_e)iRequestedEapType);
       
  1560 		}
       
  1561 		// Note: even in error cases eap_core_c deletes eap_type_if
       
  1562 	}
       
  1563 	else
       
  1564 	{
       
  1565 		EAP_TRACE_DEBUG(
       
  1566 			m_am_tools,
       
  1567 			TRACE_FLAGS_DEFAULT,
       
  1568 			(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), success\n")));
       
  1569 
       
  1570 		status = eap_status_ok;
       
  1571 
       
  1572 		if (eapArrayIndex  == KErrNotFound)
       
  1573 		{
       
  1574 			// Add plugin information to the member arrays. There is no need to store eap_type pointer because
       
  1575 			// the stack takes care of its deletion.
       
  1576 			if (m_plugin_if_array.Append(eapType) != KErrNone)
       
  1577 			{
       
  1578 				delete eapType;
       
  1579 				status = eap_status_allocation_error;
       
  1580 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1581 				return EAP_STATUS_RETURN(m_am_tools, status);				
       
  1582 			}
       
  1583 
       
  1584 #ifdef USE_EAP_EXPANDED_TYPES
       
  1585 
       
  1586 			eap_type_value_e * tmpEAPType = new eap_type_value_e();
       
  1587 			if(tmpEAPType == NULL)
       
  1588 			{
       
  1589 				EAP_TRACE_DEBUG(
       
  1590 					m_am_tools,
       
  1591 					TRACE_FLAGS_DEFAULT,
       
  1592 					(EAPL("eapol_am_wlan_authentication_symbian_c::load_module() eap_type_value_e creation failed\n")));
       
  1593 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1594 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
       
  1595 			}
       
  1596 			
       
  1597 			*tmpEAPType = type;
       
  1598 			
       
  1599 			status = m_eap_type_array->add_object(tmpEAPType, true);
       
  1600 			
       
  1601 			if (status != eap_status_ok)			
       
  1602 
       
  1603 #else // For normal EAP type.			
       
  1604 
       
  1605 			if (m_eap_type_array.Append(iRequestedEapType) != KErrNone)
       
  1606 
       
  1607 #endif
       
  1608 			{
       
  1609 				// Remove the eap type added just previously
       
  1610 				m_plugin_if_array.Remove(m_plugin_if_array.Count() - 1);
       
  1611 				delete eapType;
       
  1612 				status = eap_status_allocation_error;
       
  1613 
       
  1614 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1615 				return EAP_STATUS_RETURN(m_am_tools, status);				
       
  1616 			}
       
  1617 		} 
  1567 	}
  1618 	}
  1568 
  1619 
  1569 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1620 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1570 	return EAP_STATUS_RETURN(m_am_tools, status);
  1621 	return EAP_STATUS_RETURN(m_am_tools, status);
  1571 }
  1622 }
  1576  */
  1627  */
  1577 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type)
  1628 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type)
  1578 {
  1629 {
  1579 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1630 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1580 	eap_status_e status(eap_status_type_does_not_exists_error);
  1631 	eap_status_e status(eap_status_type_does_not_exists_error);
       
  1632 
       
  1633 #ifdef USE_EAP_EXPANDED_TYPES
  1581 
  1634 
  1582 	// Check if this EAP type has already been loaded
  1635 	// Check if this EAP type has already been loaded
  1583 	TInt index = find<eap_type_value_e>(
  1636 	TInt index = find<eap_type_value_e>(
  1584 		m_eap_type_array,
  1637 		m_eap_type_array,
  1585 		&type,
  1638 		&type,
  1587 		
  1640 		
  1588 	if (index >= 0)
  1641 	if (index >= 0)
  1589 	{
  1642 	{
  1590 		// EAP was loaded before.
  1643 		// EAP was loaded before.
  1591 		
  1644 		
  1592 		delete m_eap_if_array[index];
  1645 		delete m_plugin_if_array[index];
  1593 		m_eap_if_array.Remove(index);
  1646 		m_plugin_if_array.Remove(index);
  1594 		
       
  1595 		delete m_eap_plugin_if_array[index];
       
  1596 		m_eap_plugin_if_array.Remove(index);
       
  1597 		
  1647 		
  1598 		status = m_eap_type_array->remove_object(index);
  1648 		status = m_eap_type_array->remove_object(index);
  1599 	}
  1649 	}
       
  1650 
       
  1651 #else // For normal EAP types.
       
  1652 
       
  1653 	TInt index = m_eap_type_array.Find(type);
       
  1654 
       
  1655 	if (index != KErrNotFound)
       
  1656 	{
       
  1657 		delete m_plugin_if_array[index];
       
  1658 		m_plugin_if_array.Remove(index);
       
  1659 		m_eap_type_array.Remove(index);
       
  1660 		status = eap_status_ok;			
       
  1661 	}
       
  1662 
       
  1663 #endif
  1600 
  1664 
  1601 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1665 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1602 	return EAP_STATUS_RETURN(m_am_tools, status);
  1666 	return EAP_STATUS_RETURN(m_am_tools, status);
  1603 }
  1667 }
  1604 //--------------------------------------------------
  1668 //--------------------------------------------------
  1692 
  1756 
  1693 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1757 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1694 	return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status));
  1758 	return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status));
  1695 }
  1759 }
  1696 
  1760 
  1697 
       
  1698 eap_status_e CEapVpnInterfaceImplementation::add_configuration_data(
       
  1699 	eap_process_tlv_message_data_c * const message,
       
  1700 	const eap_configuration_field_c * field,
       
  1701 	const eap_configure_type_e /* type */,
       
  1702 	const eap_variable_data_c * const value_data
       
  1703     )
       
  1704 {
       
  1705 	eap_variable_data_c selector(m_am_tools);
       
  1706 
       
  1707 	eap_status_e status = selector.set_buffer(
       
  1708 		field->get_field(),
       
  1709 		field->get_field_length(),
       
  1710 		false,
       
  1711 		false);
       
  1712 	if (status != eap_status_ok)
       
  1713 	{
       
  1714 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1715 		return status;
       
  1716 	}
       
  1717 
       
  1718 	eap_config_value_c config(m_am_tools);
       
  1719 
       
  1720 	if (config.get_is_valid() == false)
       
  1721 	{
       
  1722 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1723 	}
       
  1724 
       
  1725 	config.set_type(eap_configure_type_hex_data);
       
  1726 
       
  1727 	status = config.get_data()->set_copy_of_buffer(
       
  1728 		value_data);
       
  1729 	if (status != eap_status_ok)
       
  1730 	{
       
  1731 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1732 		return EAP_STATUS_RETURN(m_am_tools, status);
       
  1733 	}
       
  1734 
       
  1735 	status = message->add_parameter_data(
       
  1736 		&selector,
       
  1737 		&config);
       
  1738 	if (status != eap_status_ok)
       
  1739 	{
       
  1740 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1741 		return EAP_STATUS_RETURN(m_am_tools, status);
       
  1742 	}
       
  1743 
       
  1744 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1745 	return EAP_STATUS_RETURN(m_am_tools, status);
       
  1746 }
       
  1747 
       
  1748 
       
  1749 const TUint32 K2DigitMncMccList[]
       
  1750 	= {
       
  1751 		202,204,206,208,213,214,216,218,
       
  1752 		219,220,222,226,228,230,231,232,
       
  1753 		234,238,240,242,244,246,247,248,
       
  1754 		250,255,257,259,260,262,266,268,
       
  1755 		270,272,274,276,278,280,282,284,
       
  1756 		286,288,290,293,294,295,308,340,
       
  1757 		362,363,400,401,402,404,410,413,
       
  1758 		414,415,416,417,419,420,421,422,
       
  1759 		424,425,426,427,428,429,432,434,
       
  1760 		436,437,438,440,441,452,454,455,
       
  1761 		456,457,460,470,472,502,505,510,
       
  1762 		515,520,525,528,530,537,539,541,
       
  1763 		546,547,549,602,603,604,605,607,
       
  1764 		608,609,610,611,612,613,614,615,
       
  1765 		616,617,619,620,621,622,623,624,
       
  1766 		625,626,628,629,630,631,633,634,
       
  1767 		635,636,638,639,640,641,642,643,
       
  1768 		645,646,647,648,649,650,651,652,
       
  1769 		653,654,655,702,704,706,710,712,
       
  1770 		714,716,724,730,734,744,746,901
       
  1771 	};
       
  1772 
       
  1773 /**
  1761 /**
  1774  * The read_configure() function reads the configuration data identified
  1762  * The read_configure() function reads the configuration data identified
  1775  * by the field string of field_length bytes length. Adaptation module must direct
  1763  * by the field string of field_length bytes length. Adaptation module must direct
  1776  * the query to some persistent store.
  1764  * the query to some persistent store.
  1777  * @see abs_eap_base_type_c::read_configure().
  1765  * @see abs_eap_base_type_c::read_configure().
  1799 		data);
  1787 		data);
  1800 
  1788 
  1801 
  1789 
  1802 	// Check if the wanted parameter is default type
  1790 	// Check if the wanted parameter is default type
  1803 
  1791 
  1804 	if (field->get_type() == eap_configure_type_all_configurations
       
  1805 		&& field->compare(
       
  1806 			m_am_tools,
       
  1807 			cf_str_EAP_read_all_configurations.get_field()) == true)
       
  1808 	{
       
  1809 		// Copy all special configurations to data.
       
  1810 
       
  1811 		eap_process_tlv_message_data_c message(m_am_tools);
       
  1812 
       
  1813 		if (message.get_is_valid() == false)
       
  1814 		{
       
  1815 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1816 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1817 		}
       
  1818 
       
  1819 		{
       
  1820 			// cf_str_EAP_default_type_hex_data and cf_str_EAP_server_default_type_hex_data
       
  1821 
       
  1822 			eap_variable_data_c value_data(m_am_tools);
       
  1823 			if (value_data.get_is_valid() == false)
       
  1824 			{
       
  1825 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1826 			}
       
  1827 
       
  1828 			// Now there are enabled EAP type, we need to take the first EAP type from the arrary.
       
  1829 			SEapExpandedType * expandedEAPType = m_enabled_expanded_eap_array[0]; //First item.
       
  1830 
       
  1831 			status = value_data.set_copy_of_buffer(
       
  1832 				expandedEAPType->EapExpandedType.Ptr(),
       
  1833 				KExpandedEapTypeSize);
       
  1834 			if (status != eap_status_ok)
       
  1835 			{
       
  1836 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1837 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1838 			}
       
  1839 
       
  1840 			status = add_configuration_data(
       
  1841 				&message,
       
  1842 				cf_str_EAP_default_type_hex_data.get_field(),
       
  1843 				eap_configure_type_hex_data,
       
  1844 				&value_data);
       
  1845 			if (status != eap_status_ok)
       
  1846 			{
       
  1847 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1848 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1849 			}
       
  1850 
       
  1851 			status = add_configuration_data(
       
  1852 				&message,
       
  1853 				cf_str_EAP_server_default_type_hex_data.get_field(),
       
  1854 				eap_configure_type_hex_data,
       
  1855 				&value_data);
       
  1856 			if (status != eap_status_ok)
       
  1857 			{
       
  1858 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1859 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1860 			}
       
  1861 		}
       
  1862 
       
  1863 		{
       
  1864 			// cf_str_EAP_GSMSIM_UMA_profile, cf_str_EAP_AKA_UMA_profile,
       
  1865 			// cf_str_EAP_GSMSIM_wait_eap_success_packet and cf_str_EAP_AKA_wait_eap_success_packet
       
  1866 
       
  1867 			TInt val(1);
       
  1868 
       
  1869 			eap_variable_data_c value_data(m_am_tools);
       
  1870 			if (value_data.get_is_valid() == false)
       
  1871 			{
       
  1872 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1873 			}
       
  1874 
       
  1875 			status = value_data.set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
       
  1876 			if (status != eap_status_ok)
       
  1877 			{
       
  1878 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1879 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1880 			}
       
  1881 
       
  1882 			status = add_configuration_data(
       
  1883 				&message,
       
  1884 				cf_str_EAP_GSMSIM_UMA_profile.get_field(),
       
  1885 				eap_configure_type_boolean,
       
  1886 				&value_data);
       
  1887 			if (status != eap_status_ok)
       
  1888 			{
       
  1889 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1890 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1891 			}
       
  1892 
       
  1893 			status = add_configuration_data(
       
  1894 				&message,
       
  1895 				cf_str_EAP_AKA_UMA_profile.get_field(),
       
  1896 				eap_configure_type_boolean,
       
  1897 				&value_data);
       
  1898 			if (status != eap_status_ok)
       
  1899 			{
       
  1900 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1901 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1902 			}
       
  1903 
       
  1904 			status = add_configuration_data(
       
  1905 				&message,
       
  1906 				cf_str_EAP_GSMSIM_wait_eap_success_packet.get_field(),
       
  1907 				eap_configure_type_boolean,
       
  1908 				&value_data);
       
  1909 			if (status != eap_status_ok)
       
  1910 			{
       
  1911 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1912 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1913 			}
       
  1914 
       
  1915 			status = add_configuration_data(
       
  1916 				&message,
       
  1917 				cf_str_EAP_AKA_wait_eap_success_packet.get_field(),
       
  1918 				eap_configure_type_boolean,
       
  1919 				&value_data);
       
  1920 			if (status != eap_status_ok)
       
  1921 			{
       
  1922 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1923 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1924 			}
       
  1925 		}
       
  1926 
       
  1927 		{
       
  1928 			// cf_str_EAP_GSMSIM_UMA_realm_prefix and cf_str_EAP_AKA_UMA_realm_prefix
       
  1929 
       
  1930 			eap_variable_data_c value_data(m_am_tools);
       
  1931 			if (value_data.get_is_valid() == false)
       
  1932 			{
       
  1933 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1934 			}
       
  1935 
       
  1936 			// Set uma realm prefix of EAP-SIM and EAP-AKA.
       
  1937 			status = value_data.set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length());
       
  1938 			if (status != eap_status_ok)
       
  1939 			{
       
  1940 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1941 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1942 			}
       
  1943 
       
  1944 			status = add_configuration_data(
       
  1945 				&message,
       
  1946 				cf_str_EAP_GSMSIM_UMA_realm_prefix.get_field(),
       
  1947 				eap_configure_type_string,
       
  1948 				&value_data);
       
  1949 			if (status != eap_status_ok)
       
  1950 			{
       
  1951 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1952 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1953 			}
       
  1954 
       
  1955 			status = add_configuration_data(
       
  1956 				&message,
       
  1957 				cf_str_EAP_AKA_UMA_realm_prefix.get_field(),
       
  1958 				eap_configure_type_string,
       
  1959 				&value_data);
       
  1960 			if (status != eap_status_ok)
       
  1961 			{
       
  1962 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1963 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1964 			}
       
  1965 		}
       
  1966 
       
  1967 		{
       
  1968 			// cf_str_EAP_GSMSIM_use_manual_realm, cf_str_EAP_AKA_use_manual_realm
       
  1969 
       
  1970 			TInt val(1);
       
  1971 
       
  1972 			if(iManualRealm == NULL || (iManualRealm && (iManualRealm->Length() == 0)))
       
  1973 			{
       
  1974 				val = 0;
       
  1975 			}
       
  1976 
       
  1977 			eap_variable_data_c value_data(m_am_tools);
       
  1978 			if (value_data.get_is_valid() == false)
       
  1979 			{
       
  1980 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  1981 			}
       
  1982 
       
  1983 			status = value_data.set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
       
  1984 			if (status != eap_status_ok)
       
  1985 			{
       
  1986 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1987 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1988 			}
       
  1989 
       
  1990 			status = add_configuration_data(
       
  1991 				&message,
       
  1992 				cf_str_EAP_GSMSIM_use_manual_realm.get_field(),
       
  1993 				eap_configure_type_boolean,
       
  1994 				&value_data);
       
  1995 			if (status != eap_status_ok)
       
  1996 			{
       
  1997 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1998 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  1999 			}
       
  2000 
       
  2001 			status = add_configuration_data(
       
  2002 				&message,
       
  2003 				cf_str_EAP_AKA_use_manual_realm.get_field(),
       
  2004 				eap_configure_type_boolean,
       
  2005 				&value_data);
       
  2006 			if (status != eap_status_ok)
       
  2007 			{
       
  2008 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2009 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2010 			}
       
  2011 		}
       
  2012 
       
  2013 		{
       
  2014 			// cf_str_EAP_GSMSIM_manual_realm and cf_str_EAP_AKA_manual_realm
       
  2015 
       
  2016 			eap_variable_data_c value_data(m_am_tools);
       
  2017 			if (value_data.get_is_valid() == false)
       
  2018 			{
       
  2019 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2020 			}
       
  2021 
       
  2022 			if(iManualRealm != NULL)
       
  2023 			{
       
  2024 				// ManualRealm of EAP-SIM and EAP-AKA.
       
  2025 				status = value_data.set_copy_of_buffer(iManualRealm->Ptr(), iManualRealm->Length());
       
  2026 				if (status != eap_status_ok)
       
  2027 				{
       
  2028 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2029 					return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2030 				}
       
  2031 			}
       
  2032 
       
  2033 			status = add_configuration_data(
       
  2034 				&message,
       
  2035 				cf_str_EAP_GSMSIM_manual_realm.get_field(),
       
  2036 				eap_configure_type_string,
       
  2037 				&value_data);
       
  2038 			if (status != eap_status_ok)
       
  2039 			{
       
  2040 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2041 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2042 			}
       
  2043 
       
  2044 			status = add_configuration_data(
       
  2045 				&message,
       
  2046 				cf_str_EAP_AKA_manual_realm.get_field(),
       
  2047 				eap_configure_type_string,
       
  2048 				&value_data);
       
  2049 			if (status != eap_status_ok)
       
  2050 			{
       
  2051 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2052 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2053 			}
       
  2054 		}
       
  2055 
       
  2056 		{
       
  2057 			// cf_str_EAP_GSMSIM_use_manual_username, cf_str_EAP_AKA_use_manual_username
       
  2058 
       
  2059 			// Use ManualUsername of EAP-SIM and EAP-AKA.
       
  2060 			TInt val(1);
       
  2061 			if (iManualUsername == NULL || (iManualUsername->Length() == 0))
       
  2062 				{
       
  2063 				val = 0;
       
  2064 				}
       
  2065 
       
  2066 			eap_variable_data_c value_data(m_am_tools);
       
  2067 			if (value_data.get_is_valid() == false)
       
  2068 			{
       
  2069 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2070 			}
       
  2071 
       
  2072 			status = value_data.set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
       
  2073 			if (status != eap_status_ok)
       
  2074 			{
       
  2075 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2076 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2077 			}
       
  2078 
       
  2079 			status = add_configuration_data(
       
  2080 				&message,
       
  2081 				cf_str_EAP_GSMSIM_use_manual_username.get_field(),
       
  2082 				eap_configure_type_boolean,
       
  2083 				&value_data);
       
  2084 			if (status != eap_status_ok)
       
  2085 			{
       
  2086 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2087 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2088 			}
       
  2089 
       
  2090 			status = add_configuration_data(
       
  2091 				&message,
       
  2092 				cf_str_EAP_AKA_use_manual_username.get_field(),
       
  2093 				eap_configure_type_boolean,
       
  2094 				&value_data);
       
  2095 			if (status != eap_status_ok)
       
  2096 			{
       
  2097 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2098 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2099 			}
       
  2100 		}
       
  2101 
       
  2102 		{
       
  2103 			// cf_str_EAP_GSMSIM_manual_username and cf_str_EAP_AKA_manual_username
       
  2104 
       
  2105 			eap_variable_data_c value_data(m_am_tools);
       
  2106 			if (value_data.get_is_valid() == false)
       
  2107 			{
       
  2108 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2109 			}
       
  2110 
       
  2111 			// ManualUsername of EAP-SIM and EAP-AKA.
       
  2112 			if (iManualUsername != NULL)
       
  2113 				{
       
  2114 				status = value_data.set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length());
       
  2115 				if (status != eap_status_ok)
       
  2116 					{
       
  2117 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2118 					return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2119 					}
       
  2120 				}
       
  2121 			status = add_configuration_data(
       
  2122 				&message,
       
  2123 				cf_str_EAP_GSMSIM_manual_username.get_field(),
       
  2124 				eap_configure_type_string,
       
  2125 				&value_data);
       
  2126 			if (status != eap_status_ok)
       
  2127 			{
       
  2128 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2129 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2130 			}
       
  2131 
       
  2132 			status = add_configuration_data(
       
  2133 				&message,
       
  2134 				cf_str_EAP_AKA_manual_username.get_field(),
       
  2135 				eap_configure_type_string,
       
  2136 				&value_data);
       
  2137 			if (status != eap_status_ok)
       
  2138 			{
       
  2139 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2140 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2141 			}
       
  2142 		}
       
  2143 
       
  2144 		{
       
  2145 			// cf_str_EAP_TRACE_output_file_name
       
  2146 
       
  2147 			eap_variable_data_c value_data(m_am_tools);
       
  2148 			if (value_data.get_is_valid() == false)
       
  2149 			{
       
  2150 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2151 			}
       
  2152 
       
  2153 			status = value_data.set_copy_of_buffer(m_trace_log_file_name);
       
  2154 			if (status != eap_status_ok)
       
  2155 			{
       
  2156 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2157 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2158 			}
       
  2159 
       
  2160 			status = add_configuration_data(
       
  2161 				&message,
       
  2162 				cf_str_EAP_TRACE_output_file_name.get_field(),
       
  2163 				eap_configure_type_string,
       
  2164 				&value_data);
       
  2165 			if (status != eap_status_ok)
       
  2166 			{
       
  2167 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2168 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2169 			}
       
  2170 		}
       
  2171 
       
  2172 		{
       
  2173 			// cf_str_EAP_GSMSIM_max_session_validity_time and cf_str_EAP_AKA_max_session_validity_time
       
  2174 
       
  2175 			u32_t session_validity_time_in_seconds(43200ul);
       
  2176 
       
  2177 			eap_variable_data_c value_data(m_am_tools);
       
  2178 			if (value_data.get_is_valid() == false)
       
  2179 			{
       
  2180 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2181 			}
       
  2182 
       
  2183 			status = value_data.set_copy_of_buffer(reinterpret_cast<u8_t*>(&session_validity_time_in_seconds), sizeof(session_validity_time_in_seconds));
       
  2184 			if (status != eap_status_ok)
       
  2185 			{
       
  2186 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2187 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2188 			}
       
  2189 
       
  2190 			status = add_configuration_data(
       
  2191 				&message,
       
  2192 				cf_str_EAP_GSMSIM_max_session_validity_time.get_field(),
       
  2193 				eap_configure_type_u32_t,
       
  2194 				&value_data);
       
  2195 			if (status != eap_status_ok)
       
  2196 			{
       
  2197 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2198 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2199 			}
       
  2200 
       
  2201 			status = add_configuration_data(
       
  2202 				&message,
       
  2203 				cf_str_EAP_AKA_max_session_validity_time.get_field(),
       
  2204 				eap_configure_type_u32_t,
       
  2205 				&value_data);
       
  2206 			if (status != eap_status_ok)
       
  2207 			{
       
  2208 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2209 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2210 			}
       
  2211 		}
       
  2212 
       
  2213 		{
       
  2214 			// cf_str_EAP_CORE_wait_eap_request_type_timeout
       
  2215 
       
  2216 			u32_t wait_eap_request_type_timeout_in_milli_seconds(30000ul);
       
  2217 
       
  2218 			eap_variable_data_c value_data(m_am_tools);
       
  2219 			if (value_data.get_is_valid() == false)
       
  2220 			{
       
  2221 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2222 			}
       
  2223 
       
  2224 			status = value_data.set_copy_of_buffer(reinterpret_cast<u8_t*>(&wait_eap_request_type_timeout_in_milli_seconds), sizeof(wait_eap_request_type_timeout_in_milli_seconds));
       
  2225 			if (status != eap_status_ok)
       
  2226 			{
       
  2227 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2228 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2229 			}
       
  2230 
       
  2231 			status = add_configuration_data(
       
  2232 				&message,
       
  2233 				cf_str_EAP_CORE_wait_eap_request_type_timeout.get_field(),
       
  2234 				eap_configure_type_u32_t,
       
  2235 				&value_data);
       
  2236 			if (status != eap_status_ok)
       
  2237 			{
       
  2238 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2239 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2240 			}
       
  2241 		}
       
  2242 
       
  2243 		{
       
  2244 			// cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array and cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array
       
  2245 
       
  2246 			eap_variable_data_c value_data(m_am_tools);
       
  2247 			if (value_data.get_is_valid() == false)
       
  2248 			{
       
  2249 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2250 			}
       
  2251 
       
  2252 			// 2-digit MNC configuration of EAP-SIM and EAP-AKA.
       
  2253 			status = value_data.set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList));
       
  2254 			if (status != eap_status_ok)
       
  2255 			{
       
  2256 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2257 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2258 			}
       
  2259 
       
  2260 			status = add_configuration_data(
       
  2261 				&message,
       
  2262 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field(),
       
  2263 				eap_configure_type_u32array,
       
  2264 				&value_data);
       
  2265 			if (status != eap_status_ok)
       
  2266 			{
       
  2267 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2268 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2269 			}
       
  2270 
       
  2271 			status = add_configuration_data(
       
  2272 				&message,
       
  2273 				cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field(),
       
  2274 				eap_configure_type_u32array,
       
  2275 				&value_data);
       
  2276 			if (status != eap_status_ok)
       
  2277 			{
       
  2278 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2279 				return EAP_STATUS_RETURN(m_am_tools, status);			
       
  2280 			}
       
  2281 		}
       
  2282 
       
  2283 		status = data->set_copy_of_buffer(
       
  2284 			message.get_message_data(),
       
  2285 			message.get_message_data_length());
       
  2286 		if (status != eap_status_ok)
       
  2287 		{
       
  2288 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2289 			return EAP_STATUS_RETURN(m_am_tools, status);
       
  2290 		}
       
  2291 	}
       
  2292 	else
       
  2293 	{
  1792 	{
  2294 		eap_variable_data_c wanted_field(m_am_tools);
  1793 		eap_variable_data_c wanted_field(m_am_tools);
  2295 
  1794 
  2296 		status = wanted_field.set_buffer(
  1795 		status = wanted_field.set_buffer(
  2297 			field->get_field(),
  1796 			field->get_field(),
  2304 			return status;
  1803 			return status;
  2305 		}
  1804 		}
  2306 
  1805 
  2307 
  1806 
  2308 		if (wanted_field.compare(
  1807 		if (wanted_field.compare(
  2309 			cf_str_EAP_default_type_hex_data.get_field()->get_field(),
  1808 		cf_str_EAP_default_type_u32_t.get_field()->get_field(),
  2310 			cf_str_EAP_default_type_hex_data.get_field()->get_field_length()) == 0
  1809 		cf_str_EAP_default_type_u32_t.get_field()->get_field_length()) == 0
  2311 		|| wanted_field.compare(
  1810 		|| wanted_field.compare(
  2312 			cf_str_EAP_server_default_type_hex_data.get_field()->get_field(),
  1811 		cf_str_EAP_server_default_type_u32_t.get_field()->get_field(),
  2313 			cf_str_EAP_server_default_type_hex_data.get_field()->get_field_length()) == 0)
  1812 		cf_str_EAP_server_default_type_u32_t.get_field()->get_field_length()) == 0)
  2314 		{
  1813 		{
  2315 			// We need to return here the next EAP type we should try
  1814 			// We need to return here the next EAP type we should try
       
  1815 			
       
  1816 #ifdef USE_EAP_EXPANDED_TYPES
  2316 
  1817 
  2317 			if(m_enabled_expanded_eap_array.Count() < 1)
  1818 			if(m_enabled_expanded_eap_array.Count() < 1)
  2318 			{
  1819 			{
  2319 				// No enabled EAP types.
  1820 				// No enabled EAP types.
  2320 				
  1821 				
  2371 					(EAPL("CEapVpnInterfaceImplementation::StartL:Trying EAP type:"),
  1872 					(EAPL("CEapVpnInterfaceImplementation::StartL:Trying EAP type:"),
  2372 					expandedEAPType->EapExpandedType.Ptr(),
  1873 					expandedEAPType->EapExpandedType.Ptr(),
  2373 					expandedEAPType->EapExpandedType.Size()));
  1874 					expandedEAPType->EapExpandedType.Size()));
  2374 			}							
  1875 			}							
  2375 
  1876 
       
  1877 #else // For normal EAP types
       
  1878 		
       
  1879 			TInt i; 	
       
  1880 
       
  1881 			for (i = 0; i < m_iap_eap_array.Count(); i++)
       
  1882 			{
       
  1883 				// Find the first enabled EAP type (highest priority)
       
  1884 				TEap *eapType = m_iap_eap_array[i];			
       
  1885 				if (eapType->Enabled == 1)
       
  1886 				{
       
  1887 					// Convert the string to integer
       
  1888 					TLex8 tmp(eapType->UID);
       
  1889 					TInt val(0);
       
  1890 					tmp.Val(val);
       
  1891 
       
  1892 					status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
       
  1893 					if (status != eap_status_ok)
       
  1894 					{
       
  1895 						EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1896 						return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);			
       
  1897 					}
       
  1898 
       
  1899 					if(val == iRequestedEapType)
       
  1900 					{
       
  1901 						EAP_TRACE_ALWAYS(
       
  1902 							m_am_tools,
       
  1903 							TRACE_FLAGS_DEFAULT,
       
  1904 							(EAPL("EAPOL: Trying EAP type: %d.\n"), val));
       
  1905 						break;
       
  1906 					}
       
  1907 					else
       
  1908 					{
       
  1909 						continue;
       
  1910 					}
       
  1911 				}
       
  1912 			} // for()
       
  1913 
       
  1914 			if (i >= m_iap_eap_array.Count())
       
  1915 			{
       
  1916 				// Not found
       
  1917 				// Send WLM notification because there is no way that the authentication
       
  1918 				// can be successful if we don't have any EAP types to use...
       
  1919 				if (m_is_client)
       
  1920 				{
       
  1921 					EAP_TRACE_ERROR(
       
  1922 						m_am_tools,
       
  1923 						TRACE_FLAGS_DEFAULT,
       
  1924 						(EAPL("ERROR: No configured EAP types or all tried unsuccessfully.\n")));
       
  1925 				}
       
  1926 
       
  1927 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1928 				return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field);
       
  1929 			}
       
  1930 
       
  1931 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
  1932 
  2376 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1933 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2377 			return EAP_STATUS_RETURN(m_am_tools, status);		
  1934 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2378 		}
  1935 		}
  2379 		else if (wanted_field.compare(
  1936 		else if (wanted_field.compare(
  2380 				cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field(),
  1937 				cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field(),
  2450 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field(),
  2007 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field(),
  2451 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field_length()) == 0)
  2008 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field_length()) == 0)
  2452 		{
  2009 		{
  2453 			// Use ManualUsername of EAP-SIM and EAP-AKA.
  2010 			// Use ManualUsername of EAP-SIM and EAP-AKA.
  2454 			TInt val(1);
  2011 			TInt val(1);
  2455 			if(iManualUsername == NULL)
  2012 			if(iManualUsername == NULL || (iManualUsername && (iManualUsername->Length() == 0)))
  2456 			{
       
  2457 				val = 0;
       
  2458 			}
       
  2459 			if (iManualUsername && (iManualUsername->Length() == 0))
       
  2460 			{
  2013 			{
  2461 				val = 0;
  2014 				val = 0;
  2462 			}
  2015 			}
  2463 			status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
  2016 			status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
  2464 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2017 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2470 			|| wanted_field.compare(
  2023 			|| wanted_field.compare(
  2471 				cf_str_EAP_AKA_manual_username.get_field()->get_field(),
  2024 				cf_str_EAP_AKA_manual_username.get_field()->get_field(),
  2472 				cf_str_EAP_AKA_manual_username.get_field()->get_field_length()) == 0)
  2025 				cf_str_EAP_AKA_manual_username.get_field()->get_field_length()) == 0)
  2473 		{
  2026 		{
  2474 			// ManualUsername of EAP-SIM and EAP-AKA.
  2027 			// ManualUsername of EAP-SIM and EAP-AKA.
  2475 			if(iManualUsername != NULL)
  2028 			status = data->set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length());
  2476 				{
  2029 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2477 				status = data->set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length());
  2030 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2478 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2479 				return EAP_STATUS_RETURN(m_am_tools, status);		
       
  2480 				}
       
  2481 		}
  2031 		}
  2482 		else if (wanted_field.compare(
  2032 		else if (wanted_field.compare(
  2483 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2033 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2484 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0
  2034 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0
  2485 			|| wanted_field.compare(
  2035 			|| wanted_field.compare(
  2486 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2036 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2487 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0)
  2037 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0)
  2488 		{
  2038 		{
  2489 			// 2-digit MNC configuration of EAP-SIM and EAP-AKA.
  2039 			// 2-digit MNC configuration of EAP-SIM and EAP-AKA.
       
  2040 			const TUint32 K2DigitMncMccList[]
       
  2041 				= {
       
  2042 					202,204,206,208,213,214,216,218,
       
  2043 					219,220,222,226,228,230,231,232,
       
  2044 					234,238,240,242,244,246,247,248,
       
  2045 					250,255,257,259,260,262,266,268,
       
  2046 					270,272,274,276,278,280,282,284,
       
  2047 					286,288,290,293,294,295,308,340,
       
  2048 					362,363,400,401,402,404,410,413,
       
  2049 					414,415,416,417,419,420,421,422,
       
  2050 					424,425,426,427,428,429,432,434,
       
  2051 					436,437,438,440,441,452,454,455,
       
  2052 					456,457,460,470,472,502,505,510,
       
  2053 					515,520,525,528,530,537,539,541,
       
  2054 					546,547,549,602,603,604,605,607,
       
  2055 					608,609,610,611,612,613,614,615,
       
  2056 					616,617,619,620,621,622,623,624,
       
  2057 					625,626,628,629,630,631,633,634,
       
  2058 					635,636,638,639,640,641,642,643,
       
  2059 					645,646,647,648,649,650,651,652,
       
  2060 					653,654,655,702,704,706,710,712,
       
  2061 					714,716,724,730,734,744,746,901
       
  2062 				};
       
  2063 
  2490 			status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList));
  2064 			status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList));
  2491 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2065 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2492 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2066 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2493 		}
  2067 		}
  2494 		else if (wanted_field.compare(
  2068 		else if (wanted_field.compare(
  2667 	void * const p_data,
  2241 	void * const p_data,
  2668 	const u32_t p_time_ms)
  2242 	const u32_t p_time_ms)
  2669 {
  2243 {
  2670 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2244 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2671 
  2245 
  2672 	eap_status_e status(eap_status_ok);
  2246 	const eap_status_e status = m_am_tools->am_set_timer(
  2673 
  2247 		p_initializer, 
  2674 	if (m_am_tools != 0)
  2248 		p_id, 
  2675 	{
  2249 		p_data,
  2676 		status = m_am_tools->am_set_timer(
  2250 		p_time_ms);
  2677 			p_initializer, 
       
  2678 			p_id, 
       
  2679 			p_data,
       
  2680 			p_time_ms);
       
  2681 	}
       
  2682 
  2251 
  2683 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2252 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2684 	return status;
  2253 	return status;
  2685 }
  2254 }
  2686 
  2255 
  2696 	abs_eap_base_timer_c * const p_initializer, 
  2265 	abs_eap_base_timer_c * const p_initializer, 
  2697 	const u32_t p_id)
  2266 	const u32_t p_id)
  2698 {
  2267 {
  2699 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2268 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2700 
  2269 
  2701 	eap_status_e status(eap_status_ok);
  2270 	const eap_status_e status = m_am_tools->am_cancel_timer(
  2702 
  2271 		p_initializer, 
  2703 	if (m_am_tools != 0)
  2272 		p_id);
  2704 	{
       
  2705 		status = m_am_tools->am_cancel_timer(
       
  2706 			p_initializer, 
       
  2707 			p_id);
       
  2708 	}
       
  2709 
  2273 
  2710 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2274 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2711 	return status;
  2275 	return status;
  2712 }
  2276 }
  2713 
  2277 
  2722  */
  2286  */
  2723 eap_status_e CEapVpnInterfaceImplementation::cancel_all_timers()
  2287 eap_status_e CEapVpnInterfaceImplementation::cancel_all_timers()
  2724 {
  2288 {
  2725 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2289 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2726 
  2290 
  2727 	eap_status_e status(eap_status_ok);
  2291 	const eap_status_e status = m_am_tools->am_cancel_all_timers();
  2728 
       
  2729 	if (m_am_tools != 0)
       
  2730 	{
       
  2731 		status = m_am_tools->am_cancel_all_timers();
       
  2732 	}
       
  2733 
  2292 
  2734 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2293 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2735 	return status;
  2294 	return status;
  2736 }
  2295 }
  2737 
  2296 
  2743 eap_status_e CEapVpnInterfaceImplementation::check_is_valid_eap_type(const eap_type_value_e eap_type)
  2302 eap_status_e CEapVpnInterfaceImplementation::check_is_valid_eap_type(const eap_type_value_e eap_type)
  2744 {
  2303 {
  2745 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2304 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2746 
  2305 
  2747 	eap_status_e status(eap_status_illegal_eap_type);
  2306 	eap_status_e status(eap_status_illegal_eap_type);
       
  2307 
       
  2308 #ifdef USE_EAP_EXPANDED_TYPES
  2748 
  2309 
  2749 	for (int i = 0; i < m_enabled_expanded_eap_array.Count(); i++)
  2310 	for (int i = 0; i < m_enabled_expanded_eap_array.Count(); i++)
  2750 	{
  2311 	{
  2751 		TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType);
  2312 		TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType);
  2752 
  2313 
  2783 			// This is Allowed and Valid.
  2344 			// This is Allowed and Valid.
  2784 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2345 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2785 			return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  2346 			return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  2786 		}
  2347 		}
  2787 	} // End of for()
  2348 	} // End of for()
       
  2349 		 
       
  2350 #else // For normal unexpanded EAP type
       
  2351 
       
  2352 	TEap *eapType = 0; 
       
  2353 
       
  2354 	for (int i = 0; i < m_iap_eap_array.Count(); i++)
       
  2355 	{
       
  2356 		// Try next EAP type
       
  2357 		eapType = m_iap_eap_array[i];
       
  2358 		if (eapType->Enabled == 1)
       
  2359 		{	
       
  2360 			// Convert the string to integer
       
  2361 			TLex8 tmp(eapType->UID);
       
  2362 			TInt val(0);
       
  2363 			tmp.Val(val);
       
  2364 
       
  2365 			if (val == eap_type)
       
  2366 			{
       
  2367 				// Allowed
       
  2368 				status = eap_status_ok;
       
  2369 				break;
       
  2370 			}	
       
  2371 		}
       
  2372 	} // for()
       
  2373 
       
  2374 #endif // #ifdef USE_EAP_EXPANDED_TYPES
  2788 
  2375 
  2789 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2376 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2790 
  2377 
  2791 	return EAP_STATUS_RETURN(m_am_tools, status);
  2378 	return EAP_STATUS_RETURN(m_am_tools, status);
  2792 }
  2379 }
  2810 		return EAP_STATUS_RETURN(m_am_tools, status);
  2397 		return EAP_STATUS_RETURN(m_am_tools, status);
  2811 	}
  2398 	}
  2812 
  2399 
  2813 	eap_header_string_c eap_string;
  2400 	eap_header_string_c eap_string;
  2814 	EAP_UNREFERENCED_PARAMETER(eap_string);
  2401 	EAP_UNREFERENCED_PARAMETER(eap_string);
       
  2402 
       
  2403 #ifdef USE_EAP_EXPANDED_TYPES
  2815 
  2404 
  2816 	// This function is same as get_selected_eap_types in behavior.
  2405 	// This function is same as get_selected_eap_types in behavior.
  2817 
  2406 
  2818 	// We need to return only the EAP types available as enabled types.
  2407 	// We need to return only the EAP types available as enabled types.
  2819 	// It means only the ones available in m_enabled_expanded_eap_array.
  2408 	// It means only the ones available in m_enabled_expanded_eap_array.
  2858 		if (status != eap_status_ok)
  2447 		if (status != eap_status_ok)
  2859 		{
  2448 		{
  2860 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2449 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2861 			return EAP_STATUS_RETURN(m_am_tools, status);
  2450 			return EAP_STATUS_RETURN(m_am_tools, status);
  2862 		}		
  2451 		}		
  2863 
  2452 			
  2864 		EAP_TRACE_DEBUG(
  2453 		EAP_TRACE_DEBUG(
  2865 			m_am_tools,
  2454 			m_am_tools,
  2866 			TRACE_FLAGS_DEFAULT,
  2455 			TRACE_FLAGS_DEFAULT,
  2867 			(EAPL("get_eap_type_list():added EAP-type=0xfe%06x%08x=%s\n"),
  2456 			(EAPL("get_eap_type_list():added EAP-type=0x%08x=%s\n"),
  2868 			expandedEAPType->get_vendor_id(),
       
  2869 			expandedEAPType->get_vendor_type(),
  2457 			expandedEAPType->get_vendor_type(),
  2870 			eap_header_string_c::get_eap_type_string(*expandedEAPType)));
  2458 			eap_string.get_eap_type_string(*expandedEAPType)));			
  2871 	}
  2459 	}
       
  2460 
       
  2461 #else // for normal EAP types.
       
  2462 
       
  2463 	TEap *eapType = 0; 
       
  2464 
       
  2465 	for (TInt i = 0; i < m_iap_eap_array.Count(); i++)
       
  2466 	{
       
  2467 		// Check if type is enabled
       
  2468 		eapType = m_iap_eap_array[i];
       
  2469 		if (eapType->Enabled == 1)
       
  2470 		{
       
  2471 			TLex8 tmp(eapType->UID);
       
  2472 			TInt val(0);
       
  2473 			tmp.Val(val);
       
  2474 
       
  2475 			eap_type_value_e * const eap_type = new eap_type_value_e(
       
  2476 			static_cast<eap_type_ietf_values_e>(val));
       
  2477 			if (eap_type == 0)
       
  2478 			{
       
  2479 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2480 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
  2481 			}
       
  2482 
       
  2483 			status = eap_type_list->add_object(eap_type, true);
       
  2484 			if (status != eap_status_ok)
       
  2485 			{
       
  2486 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2487 				return EAP_STATUS_RETURN(m_am_tools, status);
       
  2488 			}
       
  2489 		}
       
  2490 	} // for()
       
  2491 
       
  2492 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  2872 
  2493 
  2873 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2494 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2874 	return eap_status_ok;
  2495 	return eap_status_ok;
  2875 }
  2496 }
  2876 //--------------------------------------------------
  2497 //--------------------------------------------------
  3033 	implArray->Close();
  2654 	implArray->Close();
  3034 }
  2655 }
  3035 
  2656 
  3036 //--------------------------------------------------
  2657 //--------------------------------------------------
  3037 
  2658 
  3038 eap_status_e CEapVpnInterfaceImplementation::complete_get_802_11_authentication_mode(
       
  3039 	const eap_status_e /* completion_status */,
       
  3040 	const eap_am_network_id_c * /* const receive_network_id */,
       
  3041 	const eapol_key_802_11_authentication_mode_e /* mode */)
       
  3042 {
       
  3043 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3044 
       
  3045 	EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true);
       
  3046 
       
  3047 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3048 	return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported);
       
  3049 }
       
  3050 
       
  3051 //--------------------------------------------------
       
  3052 
       
  3053 eap_status_e CEapVpnInterfaceImplementation::complete_remove_eap_session(
       
  3054 	const bool /* complete_to_lower_layer */,
       
  3055 	const eap_am_network_id_c * const /* receive_network_id */)
       
  3056 {
       
  3057 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3058 
       
  3059 	EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true);
       
  3060 
       
  3061 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3062 	return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported);
       
  3063 }
       
  3064 
       
  3065 //--------------------------------------------------
       
  3066 
       
  3067 #if defined(USE_EAP_SIMPLE_CONFIG)
       
  3068 
       
  3069 eap_status_e CEapVpnInterfaceImplementation::save_simple_config_session(
       
  3070 	const simple_config_state_e /* state */,
       
  3071 	EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const /* credential_array */,
       
  3072 	const eap_variable_data_c * const /* new_password */,
       
  3073 	const simple_config_Device_Password_ID_e /* Device_Password_ID */,
       
  3074 	const simple_config_payloads_c * const /* other_configuration */
       
  3075 	)
       
  3076 {
       
  3077 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3078 
       
  3079 	EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true);
       
  3080 
       
  3081 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  3082 	return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported);
       
  3083 }
       
  3084 
       
  3085 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
       
  3086 
       
  3087 //--------------------------------------------------
       
  3088 
       
  3089 //
       
  3090 eap_session_core_base_c * CEapVpnInterfaceImplementation::new_eap_core_client_message_if_c(
       
  3091 	abs_eap_am_tools_c * const tools,
       
  3092 	abs_eap_session_core_c * const partner,
       
  3093 	const bool is_client_when_true,
       
  3094 	const u32_t MTU)
       
  3095 {
       
  3096 	eap_am_message_if_c *client_if = new_eap_am_client_message_if_c(
       
  3097 		tools,
       
  3098 		is_client_when_true,
       
  3099 		MTU);
       
  3100 
       
  3101 	eap_automatic_variable_c<eap_am_message_if_c> automatic_server_if(
       
  3102 		tools,
       
  3103 		client_if);
       
  3104 
       
  3105 	if (client_if == 0
       
  3106 		|| client_if->get_is_valid() == false)
       
  3107 	{
       
  3108 		// ERROR.
       
  3109 		if (client_if != 0)
       
  3110 		{
       
  3111 			EAP_TRACE_DEBUG(
       
  3112 				tools,
       
  3113 				TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
       
  3114 				(EAPL("ERROR: calls: eap_session_core_base_c::new_eap_core_client_message_if_c(): client_if->shutdown(): %s.\n"),
       
  3115 				(is_client_when_true == true) ? "client": "server"));
       
  3116 
       
  3117 			(void) client_if->shutdown();
       
  3118 		}
       
  3119 
       
  3120 		return 0;
       
  3121 	}
       
  3122 
       
  3123 	eap_core_client_message_if_c * new_session_core = new eap_core_client_message_if_c(tools, client_if, partner, is_client_when_true);
       
  3124 
       
  3125 	eap_automatic_variable_c<eap_core_client_message_if_c> automatic_new_session_core(
       
  3126 		tools,
       
  3127 		new_session_core);
       
  3128 
       
  3129 	if (new_session_core == 0
       
  3130 		|| new_session_core->get_is_valid() == false)
       
  3131 	{
       
  3132 		// ERROR.
       
  3133 		if (new_session_core != 0)
       
  3134 		{
       
  3135 			EAP_TRACE_DEBUG(
       
  3136 				tools,
       
  3137 				TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, 
       
  3138 				(EAPL("ERROR: calls: eap_session_core_base_c::new_eap_core_client_message_if_c(): new_session_core->shutdown(): %s.\n"),
       
  3139 				(is_client_when_true == true) ? "client": "server"));
       
  3140 
       
  3141 			new_session_core->shutdown();
       
  3142 		}
       
  3143 
       
  3144 		(void) client_if->shutdown();
       
  3145 
       
  3146 		return 0;
       
  3147 	}
       
  3148 
       
  3149 	client_if->set_partner(new_session_core);
       
  3150 
       
  3151 	automatic_server_if.do_not_free_variable();
       
  3152 	automatic_new_session_core.do_not_free_variable();
       
  3153 
       
  3154 	return new_session_core;
       
  3155 }
       
  3156 
       
  3157 //--------------------------------------------------
       
  3158 
       
  3159 // End
  2659 // End