eapol/eapol_framework/eapol_symbian/am/eapvpnif/src/eap_vpn_if_implementation.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
    14 * Description:  CEapVpnInterfaceImplementation
    14 * Description:  CEapVpnInterfaceImplementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 38.1.5 %
    19 * %version: 61 %
    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>
    25 
    28 
    26 #include "eap_vpn_if_implementation.h"
    29 #include "eap_vpn_if_implementation.h"
    27 #include "eap_am_memory.h"
    30 #include "eap_am_memory.h"
    28 #include "eap_tools.h"
    31 #include "eap_tools.h"
    29 #include "eap_type_all.h"
    32 #include "eap_type_all.h"
    30 #include "eap_am_tools_symbian.h"
    33 #include "eap_am_tools_symbian.h"
    31 #include "eap_crypto_api.h"
    34 #include "eap_crypto_api.h"
    32 #include "eap_type_gsmsim.h"
    35 #include "eap_type_gsmsim.h"
    33 #include "eap_type_aka.h"
    36 #include "eap_type_aka.h"
    34 #include "eap_header_string.h"
    37 #include "eap_header_string.h"
    35 #include "EapolDbDefaults.h"
    38 //#include "EapolDbDefaults.h"
    36 #include "EapolDbParameterNames.h"
    39 //#include "EapolDbParameterNames.h"
    37 #include "eap_am_file_input_symbian.h"
    40 #include "eap_am_file_input_symbian.h"
    38 #include "abs_eap_vpn_if.h"
    41 #include "abs_eap_vpn_if.h"
    39 #include "eap_array_algorithms.h"
    42 #include "eap_array_algorithms.h"
       
    43 #include "eap_core.h"
    40 
    44 
    41 #include "EapSimDbDefaults.h"
    45 #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"
    42 
    51 
    43 // LOCAL CONSTANTS
    52 // LOCAL CONSTANTS
    44 const TUint KMaxConfigStringLength = 256;
    53 const TUint KMaxConfigStringLength = 256;
    45 const u32_t KMTU = 1500u;
    54 const u32_t KMTU = 1500u;
    46 const u32_t KTrailerLength = 0;
    55 const u32_t KTrailerLength = 0;
    47 const u32_t KHeaderOffset = 0;
    56 const u32_t KHeaderOffset = 0;
    48 
    57 
    49 #ifndef USE_EAP_EXPANDED_TYPES
       
    50 
       
    51 static const TUint KMaxEapCueLength = 3;
       
    52 
       
    53 #endif //#ifndef USE_EAP_EXPANDED_TYPES
       
    54 
       
    55 #define KEapIdentityOffset 5
    58 #define KEapIdentityOffset 5
    56 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt");
    59 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt");
    57 
    60 
    58 enum eapol_am_core_timer_id_e
    61 enum eapol_am_core_timer_id_e
    59 {
    62 {
    89 const TInt EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX = 1; 
    92 const TInt EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX = 1; 
    90 
    93 
    91 CEapVpnInterfaceImplementation::CEapVpnInterfaceImplementation()
    94 CEapVpnInterfaceImplementation::CEapVpnInterfaceImplementation()
    92 : m_trace_log_file_name(0)
    95 : m_trace_log_file_name(0)
    93 , m_is_client(true)
    96 , m_is_client(true)
    94 #ifdef USE_EAP_EXPANDED_TYPES
       
    95 , m_eap_type_array(0)
    97 , m_eap_type_array(0)
    96 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
    97 , m_index_type(EVpn)
    98 , m_index_type(EVpn)
    98 , m_index(EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX)
    99 , m_index(EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX)
    99 {
   100 {
   100 }
   101 }
   101 	
   102 	
   213 		}
   214 		}
   214 
   215 
   215 		CleanupStack::PopAndDestroy(buf); // Delete pathbuffer.
   216 		CleanupStack::PopAndDestroy(buf); // Delete pathbuffer.
   216 	}
   217 	}
   217     
   218     
   218 
       
   219 #ifdef USE_EAP_EXPANDED_TYPES
       
   220 
       
   221 	m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools);
   219 	m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools);
   222 	if (m_eap_type_array == 0)
   220 	if (m_eap_type_array == 0)
   223 	{
   221 	{
   224 		User::Leave(KErrGeneral);
   222 		User::Leave(KErrGeneral);
   225 	}
   223 	}
   226 
       
   227 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   228 
       
   229 
   224 
   230     //------ Create network id
   225     //------ Create network id
   231 	{
   226 	{
   232 		EAP_TRACE_DEBUG(
   227 		EAP_TRACE_DEBUG(
   233     		m_am_tools,
   228     		m_am_tools,
   384 	if(m_receive_network_id != 0)
   379 	if(m_receive_network_id != 0)
   385 	{
   380 	{
   386 		delete m_receive_network_id;
   381 		delete m_receive_network_id;
   387 	}
   382 	}
   388 
   383 
   389 	// Unload all loaded plugins
   384 	{
   390 	for(int i = 0; i < m_plugin_if_array.Count(); i++)
   385 		// Unload all loaded EAP-interfaces.
   391 	{
   386 		for(int i = 0; i < m_eap_if_array.Count(); i++)
   392 		delete m_plugin_if_array[i];
   387 		{
   393 	}
   388 			delete m_eap_if_array[i];
   394 
   389 		}
   395 	m_plugin_if_array.Close();
   390 
   396 
   391 		m_eap_if_array.Close();
   397 #ifdef USE_EAP_EXPANDED_TYPES
   392 	}
       
   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 	}
   398 
   403 
   399 	m_enabled_expanded_eap_array.ResetAndDestroy();
   404 	m_enabled_expanded_eap_array.ResetAndDestroy();
   400 
   405 
   401 	m_disabled_expanded_eap_array.ResetAndDestroy();
   406 	m_disabled_expanded_eap_array.ResetAndDestroy();
   402 	
   407 	
   403 	m_eap_type_array->reset();
   408 	m_eap_type_array->reset();
   404 
   409 
   405 	delete m_eap_type_array;
   410 	delete m_eap_type_array;
   406 	m_eap_type_array = 0;
   411 	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
       
   416 
   412 
   417 	delete iManualUsername;
   413 	delete iManualUsername;
   418 	iManualUsername = NULL;
   414 	iManualUsername = NULL;
   419 
   415 
   420 	delete iManualRealm;
   416 	delete iManualRealm;
   681 	}
   677 	}
   682 
   678 
   683 	// Clear packet send and notification blocking.
   679 	// Clear packet send and notification blocking.
   684 	m_block_packet_sends_and_notifications = false;
   680 	m_block_packet_sends_and_notifications = false;
   685 
   681 
   686 #ifdef USE_EAP_EXPANDED_TYPES
       
   687 
       
   688 	if (m_enabled_expanded_eap_array.Count() == 0)
   682 	if (m_enabled_expanded_eap_array.Count() == 0)
   689 	{
   683 	{
   690 		// The EAP field was empty. Allow all types.
   684 		// The EAP field was empty. Allow all types.
   691 
   685 
   692 		EAP_TRACE_ALWAYS(
   686 		EAP_TRACE_ALWAYS(
   756 		} // for()
   750 		} // for()
   757 
   751 
   758 		CleanupStack::PopAndDestroy(&eapArray);
   752 		CleanupStack::PopAndDestroy(&eapArray);
   759 	}
   753 	}
   760 
   754 
   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 
       
   815 	CompleteAssociation(status);
   755 	CompleteAssociation(status);
   816 
   756 
   817 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   757 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);	
   818 	return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status));
   758 	return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status));
   819 }
   759 }
  1076 
  1016 
  1077 	eap_status_e status(eap_status_ok);
  1017 	eap_status_e status(eap_status_ok);
  1078 
  1018 
  1079 	if (iEapCore == 0)
  1019 	if (iEapCore == 0)
  1080 	{        
  1020 	{        
  1081 		iEapCore = new eap_core_c(m_am_tools, this, m_is_client, m_receive_network_id, EFalse);
  1021 		iEapCore = new_eap_core_client_message_if_c(
       
  1022 			m_am_tools,
       
  1023 			this,
       
  1024 			true,
       
  1025 			KMTU);
  1082 
  1026 
  1083 		if (iEapCore == 0
  1027 		if (iEapCore == 0
  1084 			|| iEapCore->get_is_valid() != true)
  1028 			|| iEapCore->get_is_valid() != true)
  1085 		{
  1029 		{
  1086 			if (iEapCore != 0)
  1030 			if (iEapCore != 0)
  1321 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1265 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1322 	}
  1266 	}
  1323 
  1267 
  1324 	EAP_ASSERT_TOOLS(m_am_tools, (type == iRequestedEapType));
  1268 	EAP_ASSERT_TOOLS(m_am_tools, (type == iRequestedEapType));
  1325 
  1269 
  1326 #ifdef USE_EAP_EXPANDED_TYPES
  1270 	TEapExpandedType aEapType;
  1327 
  1271 
  1328 		TBuf8<KExpandedEapTypeSize> cue;
  1272 	TInt error = CEapConversion::ConvertInternalTypeToExpandedEAPType(
  1329 		
  1273 		&iRequestedEapType,
  1330 		// Some indirect way of forming the 8 byte string of an EAP type for the cue is needed here.		
  1274 		&aEapType);
  1331 		TUint8 tmpExpCue[KExpandedEapTypeSize];
  1275 	if (error != KErrNone)
  1332 
  1276 	{
  1333 		// This is to make the tmpExpCue in 8 byte string with correct vendor type and vendor id details.
  1277 		EAP_TRACE_DEBUG_SYMBIAN(
  1334 		status = eap_expanded_type_c::write_type(m_am_tools,
  1278 			(_L("ERROR: CEapVpnInterfaceImplementation::load_module(): Error from CEapConversion::ConvertExpandedEAPTypeToInternalType()=%d\n"),
  1335 												0, // index should be zero here.
  1279 			error));		
  1336 												tmpExpCue,
  1280 	
  1337 												KExpandedEapTypeSize,
  1281 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1338 												true,
  1282 		return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error));
  1339 												iRequestedEapType);
  1283 	}
  1340 		if (status != eap_status_ok)
  1284 
  1341 		{
  1285 	i32_t eapArrayIndex = -1;
       
  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.
  1342 			EAP_TRACE_DEBUG(
  1299 			EAP_TRACE_DEBUG(
  1343 				m_am_tools,
  1300 				m_am_tools,
  1344 				TRACE_FLAGS_DEFAULT,
  1301 				TRACE_FLAGS_DEFAULT,
  1345 				(EAPL("load_module: eap_expanded_type_c::write_type failed \n")));
  1302 				(EAPL("CEapVpnInterfaceImplementation: EAP Type Already loaded\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")));
  1346 		
  1356 		
  1347 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1357 			EAPSettings* setSettings = new EAPSettings;
  1348 			return EAP_STATUS_RETURN(m_am_tools, status);
  1358 			if( setSettings == NULL )     
  1349 		}
  1359 			{
  1350 		
  1360 				EAP_TRACE_DEBUG(
  1351 		// Now copy the 8 byte string to the real expanded cue.
  1361 					m_am_tools,
  1352 		cue.Copy(tmpExpCue, KExpandedEapTypeSize);
  1362 					TRACE_FLAGS_DEFAULT,
  1353 
  1363 					(EAPL("CEapVpnInterfaceImplementation::load_module - EAPSettings allocation error \n")));
  1354 		EAP_TRACE_DATA_DEBUG(
  1364 	    		
  1355 			m_am_tools,
  1365 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1356 			TRACE_FLAGS_DEFAULT,
  1366 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1357 			(EAPL("EAPOL:CEapVpnInterfaceImplementation::load_module: Expanded CUE:"),
  1367 			}
  1358 			cue.Ptr(),
  1368 			
  1359 			cue.Size()));
  1369 			if(iRequestedEapType == eap_type_aka)
  1360 
  1370 			{
  1361 #else
  1371 				setSettings->iEAPExpandedType = *EapExpandedTypeAka.GetType();
  1362 
  1372 				
  1363 	TBuf8<KMaxEapCueLength> cue;
  1373 			}
  1364 	cue.Num(static_cast<TInt>(iRequestedEapType));
  1374 			else if(iRequestedEapType == eap_type_gsmsim)
  1365 
  1375 			{
  1366 #endif //#ifdef USE_EAP_EXPANDED_TYPES
  1376 				setSettings->iEAPExpandedType = *EapExpandedTypeSim.GetType();
  1367 
  1377 			}
  1368 	CEapType* eapType = 0;
  1378 			else
  1369 	TInt error(KErrNone);
  1379 			{
  1370 
  1380 				delete setSettings;
  1371 #ifdef USE_EAP_EXPANDED_TYPES
  1381 				setSettings = 0;
  1372 
  1382 
  1373 	// Check if this EAP type has already been loaded
  1383 				// Only EAP-SIM and AKA are possible now.
  1374 	TInt eapArrayIndex = find<eap_type_value_e>(
  1384 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1375 		m_eap_type_array,
  1385 				return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type);
  1376 		&iRequestedEapType,
  1386 			}
  1377 		m_am_tools);
  1387 			
  1378 
  1388 			if(iManualUsername && iManualUsername->Length() != 0)
  1379 	if (eapArrayIndex >= 0)
  1389 			{
  1380 
  1390     			setSettings->iUsernamePresent = ETrue; // Same value for both SIM and AKA.
  1381 #else // For normal EAP type.
  1391 	    		setSettings->iUsername.Copy(iManualUsername->Des());
  1382 
  1392 			}
  1383 	// Check if this EAP type has already been loaded
  1393 			else
  1384 	TInt eapArrayIndex = m_eap_type_array.Find(iRequestedEapType);
  1394 			{
  1385 
  1395 	    		// No user name. we have to set automatic now.
  1386 	if (eapArrayIndex != KErrNotFound)
  1396 	    		setSettings->iUsernamePresent = EFalse; // Same value for both SIM and AKA.
  1387 
  1397 	    		setSettings->iUseAutomaticUsernamePresent = ETrue; // Same value for both SIM and AKA.
  1388 #endif
  1398 	    		setSettings->iUseAutomaticUsername = ETrue; // Same value for both SIM and AKA.
  1389 
  1399 			}
  1390 	{
  1400 			
  1391 		// Yep. It was loaded already.
  1401 			if(iManualRealm && iManualRealm->Length() != 0)
  1392 		EAP_TRACE_DEBUG(
  1402 			{
  1393 			m_am_tools,
  1403 	    		setSettings->iRealmPresent = ETrue; // Same value for both SIM and AKA.
  1394 			TRACE_FLAGS_DEFAULT,
  1404 	    		setSettings->iRealm.Copy(iManualRealm->Des());
  1395 			(EAPL("CEapVpnInterfaceImplementation: EAP Type Already loaded\n")));
  1405 			}
  1396 
  1406 			else
  1397 		eapType = m_plugin_if_array[eapArrayIndex];		
  1407 			{
  1398 	}
  1408 	    		// No realm. we have to set automatic now.
  1399 	else 
  1409 	    		setSettings->iRealmPresent = EFalse; // Same value for both SIM and AKA.
  1400 	{
  1410 	    		setSettings->iUseAutomaticRealmPresent = ETrue; // Same value for both SIM and AKA.
  1401 		// We must have a trap here since the EAP core knows nothing about Symbian.
  1411 	    		setSettings->iUseAutomaticRealm = ETrue; // Same value for both SIM and AKA.
  1402 		EAP_TRACE_DEBUG(
  1412 			}    
  1403 			m_am_tools,
  1413 			
  1404 			TRACE_FLAGS_DEFAULT,
  1414 			TRAP(error, eapType->SetConfigurationL(*setSettings) );
  1405 			(EAPL("CEapVpnInterfaceImplementation: EAP Type new\n")));
  1415 			if ( error != KErrNone )
  1406 
  1416 			{
  1407 		TRAP(error, (eapType = CEapType::NewL(cue, m_index_type, m_index)));	
  1417 				EAP_TRACE_DEBUG(
       
  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)));
  1408 
  1442 
  1409 		if (error != KErrNone
  1443 		if (error != KErrNone
  1410 			|| eapType == 0)
  1444 			|| eapPlugin == 0)
  1411 		{
  1445 		{
  1412 			// Interface not found or implementation creation function failed
  1446 			// Interface not found or implementation creation function failed
  1413 			
  1447 			
  1414 			delete eapType;
  1448 			delete eapPlugin;
  1415 			eapType = 0;
  1449 			eapPlugin = 0;
  1416 			
  1450 			
  1417 			EAP_TRACE_DEBUG(
  1451 			EAP_TRACE_DEBUG(
  1418 				m_am_tools,
  1452 				m_am_tools,
  1419 				TRACE_FLAGS_DEFAULT,
  1453 				TRACE_FLAGS_DEFAULT,
  1420 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n")));
  1454 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n")));
  1422 				m_am_tools,
  1456 				m_am_tools,
  1423 				TRACE_FLAGS_DEFAULT,
  1457 				TRACE_FLAGS_DEFAULT,
  1424 				(EAPL("ECom could not find/initiate implementation.\n")));
  1458 				(EAPL("ECom could not find/initiate implementation.\n")));
  1425 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1459 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
  1426 		}
  1460 		}
  1427 	}
  1461 
  1428 
  1462 #ifdef USE_EAP_SIMPLE_CONFIG
  1429 	//--------------------------------------------------------
  1463 
  1430 	//--------------------------------------------------------
  1464 		TRAP(error, (*eap_type_if = eapPlugin->GetStackInterfaceL(
  1431 	// Set the values for realm and user name if there is any.
  1465 			m_am_tools, 
  1432 	// If there is no values the default settings will be used( automatic realm and username).
  1466 			partner, 
  1433 
  1467 			is_client_when_true, 
  1434 
  1468 			receive_network_id,
  1435 	{
  1469 			0))); // Check this up.
  1436 		EAP_TRACE_DEBUG(
  1470 
  1437 			m_am_tools,
  1471 #else
  1438 			TRACE_FLAGS_DEFAULT,
  1472 
  1439 			(EAPL("CEapVpnInterfaceImplementation::load_module - About to configure manual/auto username and manual/auto realm \n")));
  1473 		TRAP(error, (*eap_type_if = eapPlugin->GetStackInterfaceL(
  1440 	
  1474 			m_am_tools, 
  1441 	    EAPSettings* setSettings = new EAPSettings;
  1475 			partner, 
  1442 		if( setSettings == NULL )     
  1476 			is_client_when_true, 
       
  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)
  1443 		{
  1484 		{
  1444 			EAP_TRACE_DEBUG(
  1485 			EAP_TRACE_DEBUG(
  1445 				m_am_tools,
  1486 				m_am_tools,
  1446 				TRACE_FLAGS_DEFAULT,
  1487 				TRACE_FLAGS_DEFAULT,
  1447 				(EAPL("CEapVpnInterfaceImplementation::load_module - EAPSettings allocation error \n")));
  1488 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), failed = %d\n"), error));
  1448 	    	
  1489 
  1449 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1490 			EAP_TRACE_ALWAYS(
  1450 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1491 				m_am_tools,
  1451 		}
  1492 				TRACE_FLAGS_DEFAULT,
  1452 	    
  1493 				(EAPL("Could not create EAP type interface instance. Error: %d\n"), error));
  1453 		if(iRequestedEapType == eap_type_aka)
  1494 
  1454 		{
  1495 			status = eap_status_allocation_error;
  1455 			setSettings->iEAPType = EAPSettings::EEapAka;
  1496 
  1456 			
  1497 			// Unload DLL (two ways, depending whether this type was already loaded...)
  1457 		}
  1498 			if  (eapArrayIndex < 0)
  1458 		else if(iRequestedEapType == eap_type_gsmsim)
  1499 			{
  1459 		{
  1500 				// No need to call shutdown here because GetStackInterfaceL has done it.
  1460 			setSettings->iEAPType = EAPSettings::EEapSim;
  1501 				delete m_eap_if_array[m_eap_if_array.Count() - 1];
       
  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
  1461 		}
  1511 		}
  1462 		else
  1512 		else
  1463 		{
  1513 		{
  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 	    {
       
  1497 			EAP_TRACE_DEBUG(
  1514 			EAP_TRACE_DEBUG(
  1498 				m_am_tools,
  1515 				m_am_tools,
  1499 				TRACE_FLAGS_DEFAULT,
  1516 				TRACE_FLAGS_DEFAULT,
  1500 				(EAPL("CEapVpnInterfaceImplementation::load_module - Setting Manual Username and Realm failed.error=%d, Continuing \n")));
  1517 				(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), success\n")));
  1501 	    }
  1518 
  1502 	    
  1519 			status = eap_status_ok;
  1503 	    delete setSettings;
  1520 
  1504 	    setSettings = 0;    
  1521 			if (eapArrayIndex  < 0)
  1505 	}
  1522 			{
  1506     
  1523 				// Add plugin information to the member arrays. There is no need to store eap_type pointer because
  1507 	//--------------------------------------------------------
  1524 				// the stack takes care of its deletion.
  1508 	//--------------------------------------------------------
  1525 				if (m_eap_plugin_if_array.Append(eapPlugin) != KErrNone)
  1509 	
  1526 				{
  1510 	// Create the EAP protocol interface implementation.
  1527 					delete m_eap_if_array[m_eap_if_array.Count() - 1];
  1511 	EAP_TRACE_DEBUG(
  1528 					m_eap_if_array.Remove(m_eap_if_array.Count() - 1);
  1512 		m_am_tools,
  1529 
  1513 		TRACE_FLAGS_DEFAULT,
  1530 					delete eapPlugin;
  1514 		(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n")));
  1531 					status = eap_status_allocation_error;
  1515 
  1532 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1516 #ifdef USE_EAP_SIMPLE_CONFIG
  1533 					return EAP_STATUS_RETURN(m_am_tools, status);				
  1517 
  1534 				}
  1518 	TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL(
  1535 
  1519 		m_am_tools, 
  1536 				eap_type_value_e * tmpEAPType = new eap_type_value_e();
  1520 		partner, 
  1537 				if(tmpEAPType == NULL)
  1521 		is_client_when_true, 
  1538 				{
  1522 		receive_network_id,
  1539 					EAP_TRACE_DEBUG(
  1523 		0))); // Check this up.
  1540 						m_am_tools,
  1524 
  1541 						TRACE_FLAGS_DEFAULT,
  1525 #else
  1542 						(EAPL("eapol_am_wlan_authentication_symbian_c::load_module() eap_type_value_e creation failed\n")));
  1526 
  1543 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1527 	TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL(
  1544 					return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);				
  1528 		m_am_tools, 
  1545 				}
  1529 		partner, 
  1546 				
  1530 		is_client_when_true, 
  1547 				*tmpEAPType = type;
  1531 		receive_network_id)));
  1548 				
  1532 
  1549 				status = m_eap_type_array->add_object(tmpEAPType, true);
  1533 #endif // #ifdef USE_EAP_SIMPLE_CONFIG
  1550 				
  1534 
  1551 				if (status != eap_status_ok)			
  1535 	if (error != KErrNone 
  1552 				{
  1536 		|| *eap_type_if == 0 
  1553 					delete m_eap_if_array[m_eap_if_array.Count() - 1];
  1537 		|| (*eap_type_if)->get_is_valid() == false)
  1554 					m_eap_if_array.Remove(m_eap_if_array.Count() - 1);
  1538 	{
  1555 
  1539 		EAP_TRACE_DEBUG(
  1556 					// Remove the eap type added just previously
  1540 			m_am_tools,
  1557 					m_eap_plugin_if_array.Remove(m_eap_plugin_if_array.Count() - 1);
  1541 			TRACE_FLAGS_DEFAULT,
  1558 					delete eapPlugin;
  1542 			(EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), failed = %d\n"), error));
  1559 
  1543 
  1560 					status = eap_status_allocation_error;
  1544 		EAP_TRACE_ALWAYS(
  1561 
  1545 			m_am_tools,
  1562 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1546 			TRACE_FLAGS_DEFAULT,
  1563 					return EAP_STATUS_RETURN(m_am_tools, status);				
  1547 			(EAPL("Could not create EAP type interface instance. Error: %d\n"), error));
  1564 				}
  1548 
  1565 			} 
  1549 		status = eap_status_allocation_error;
  1566 		}
  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 		} 
       
  1618 	}
  1567 	}
  1619 
  1568 
  1620 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1569 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1621 	return EAP_STATUS_RETURN(m_am_tools, status);
  1570 	return EAP_STATUS_RETURN(m_am_tools, status);
  1622 }
  1571 }
  1627  */
  1576  */
  1628 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type)
  1577 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type)
  1629 {
  1578 {
  1630 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1579 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  1631 	eap_status_e status(eap_status_type_does_not_exists_error);
  1580 	eap_status_e status(eap_status_type_does_not_exists_error);
  1632 
       
  1633 #ifdef USE_EAP_EXPANDED_TYPES
       
  1634 
  1581 
  1635 	// Check if this EAP type has already been loaded
  1582 	// Check if this EAP type has already been loaded
  1636 	TInt index = find<eap_type_value_e>(
  1583 	TInt index = find<eap_type_value_e>(
  1637 		m_eap_type_array,
  1584 		m_eap_type_array,
  1638 		&type,
  1585 		&type,
  1640 		
  1587 		
  1641 	if (index >= 0)
  1588 	if (index >= 0)
  1642 	{
  1589 	{
  1643 		// EAP was loaded before.
  1590 		// EAP was loaded before.
  1644 		
  1591 		
  1645 		delete m_plugin_if_array[index];
  1592 		delete m_eap_if_array[index];
  1646 		m_plugin_if_array.Remove(index);
  1593 		m_eap_if_array.Remove(index);
       
  1594 		
       
  1595 		delete m_eap_plugin_if_array[index];
       
  1596 		m_eap_plugin_if_array.Remove(index);
  1647 		
  1597 		
  1648 		status = m_eap_type_array->remove_object(index);
  1598 		status = m_eap_type_array->remove_object(index);
  1649 	}
  1599 	}
  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
       
  1664 
  1600 
  1665 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1601 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1666 	return EAP_STATUS_RETURN(m_am_tools, status);
  1602 	return EAP_STATUS_RETURN(m_am_tools, status);
  1667 }
  1603 }
  1668 //--------------------------------------------------
  1604 //--------------------------------------------------
  1756 
  1692 
  1757 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1693 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1758 	return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status));
  1694 	return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status));
  1759 }
  1695 }
  1760 
  1696 
       
  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 
  1761 /**
  1773 /**
  1762  * The read_configure() function reads the configuration data identified
  1774  * The read_configure() function reads the configuration data identified
  1763  * by the field string of field_length bytes length. Adaptation module must direct
  1775  * by the field string of field_length bytes length. Adaptation module must direct
  1764  * the query to some persistent store.
  1776  * the query to some persistent store.
  1765  * @see abs_eap_base_type_c::read_configure().
  1777  * @see abs_eap_base_type_c::read_configure().
  1787 		data);
  1799 		data);
  1788 
  1800 
  1789 
  1801 
  1790 	// Check if the wanted parameter is default type
  1802 	// Check if the wanted parameter is default type
  1791 
  1803 
       
  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
  1792 	{
  2293 	{
  1793 		eap_variable_data_c wanted_field(m_am_tools);
  2294 		eap_variable_data_c wanted_field(m_am_tools);
  1794 
  2295 
  1795 		status = wanted_field.set_buffer(
  2296 		status = wanted_field.set_buffer(
  1796 			field->get_field(),
  2297 			field->get_field(),
  1803 			return status;
  2304 			return status;
  1804 		}
  2305 		}
  1805 
  2306 
  1806 
  2307 
  1807 		if (wanted_field.compare(
  2308 		if (wanted_field.compare(
  1808 		cf_str_EAP_default_type_u32_t.get_field()->get_field(),
  2309 			cf_str_EAP_default_type_hex_data.get_field()->get_field(),
  1809 		cf_str_EAP_default_type_u32_t.get_field()->get_field_length()) == 0
  2310 			cf_str_EAP_default_type_hex_data.get_field()->get_field_length()) == 0
  1810 		|| wanted_field.compare(
  2311 		|| wanted_field.compare(
  1811 		cf_str_EAP_server_default_type_u32_t.get_field()->get_field(),
  2312 			cf_str_EAP_server_default_type_hex_data.get_field()->get_field(),
  1812 		cf_str_EAP_server_default_type_u32_t.get_field()->get_field_length()) == 0)
  2313 			cf_str_EAP_server_default_type_hex_data.get_field()->get_field_length()) == 0)
  1813 		{
  2314 		{
  1814 			// We need to return here the next EAP type we should try
  2315 			// We need to return here the next EAP type we should try
  1815 			
       
  1816 #ifdef USE_EAP_EXPANDED_TYPES
       
  1817 
  2316 
  1818 			if(m_enabled_expanded_eap_array.Count() < 1)
  2317 			if(m_enabled_expanded_eap_array.Count() < 1)
  1819 			{
  2318 			{
  1820 				// No enabled EAP types.
  2319 				// No enabled EAP types.
  1821 				
  2320 				
  1872 					(EAPL("CEapVpnInterfaceImplementation::StartL:Trying EAP type:"),
  2371 					(EAPL("CEapVpnInterfaceImplementation::StartL:Trying EAP type:"),
  1873 					expandedEAPType->EapExpandedType.Ptr(),
  2372 					expandedEAPType->EapExpandedType.Ptr(),
  1874 					expandedEAPType->EapExpandedType.Size()));
  2373 					expandedEAPType->EapExpandedType.Size()));
  1875 			}							
  2374 			}							
  1876 
  2375 
  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 
       
  1933 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2376 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  1934 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2377 			return EAP_STATUS_RETURN(m_am_tools, status);		
  1935 		}
  2378 		}
  1936 		else if (wanted_field.compare(
  2379 		else if (wanted_field.compare(
  1937 				cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field(),
  2380 				cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field(),
  2007 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field(),
  2450 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field(),
  2008 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field_length()) == 0)
  2451 				cf_str_EAP_AKA_use_manual_username.get_field()->get_field_length()) == 0)
  2009 		{
  2452 		{
  2010 			// Use ManualUsername of EAP-SIM and EAP-AKA.
  2453 			// Use ManualUsername of EAP-SIM and EAP-AKA.
  2011 			TInt val(1);
  2454 			TInt val(1);
  2012 			if(iManualUsername == NULL || (iManualUsername && (iManualUsername->Length() == 0)))
  2455 			if(iManualUsername == NULL)
       
  2456 			{
       
  2457 				val = 0;
       
  2458 			}
       
  2459 			if (iManualUsername && (iManualUsername->Length() == 0))
  2013 			{
  2460 			{
  2014 				val = 0;
  2461 				val = 0;
  2015 			}
  2462 			}
  2016 			status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
  2463 			status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint));
  2017 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2464 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2023 			|| wanted_field.compare(
  2470 			|| wanted_field.compare(
  2024 				cf_str_EAP_AKA_manual_username.get_field()->get_field(),
  2471 				cf_str_EAP_AKA_manual_username.get_field()->get_field(),
  2025 				cf_str_EAP_AKA_manual_username.get_field()->get_field_length()) == 0)
  2472 				cf_str_EAP_AKA_manual_username.get_field()->get_field_length()) == 0)
  2026 		{
  2473 		{
  2027 			// ManualUsername of EAP-SIM and EAP-AKA.
  2474 			// ManualUsername of EAP-SIM and EAP-AKA.
  2028 			status = data->set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length());
  2475 			if(iManualUsername != NULL)
  2029 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2476 				{
  2030 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2477 				status = data->set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length());
       
  2478 				EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  2479 				return EAP_STATUS_RETURN(m_am_tools, status);		
       
  2480 				}
  2031 		}
  2481 		}
  2032 		else if (wanted_field.compare(
  2482 		else if (wanted_field.compare(
  2033 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2483 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2034 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0
  2484 				cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0
  2035 			|| wanted_field.compare(
  2485 			|| wanted_field.compare(
  2036 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2486 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(),
  2037 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0)
  2487 					cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0)
  2038 		{
  2488 		{
  2039 			// 2-digit MNC configuration of EAP-SIM and EAP-AKA.
  2489 			// 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 
       
  2064 			status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList));
  2490 			status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList));
  2065 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2491 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2066 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2492 			return EAP_STATUS_RETURN(m_am_tools, status);		
  2067 		}
  2493 		}
  2068 		else if (wanted_field.compare(
  2494 		else if (wanted_field.compare(
  2241 	void * const p_data,
  2667 	void * const p_data,
  2242 	const u32_t p_time_ms)
  2668 	const u32_t p_time_ms)
  2243 {
  2669 {
  2244 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2670 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2245 
  2671 
  2246 	const eap_status_e status = m_am_tools->am_set_timer(
  2672 	eap_status_e status(eap_status_ok);
  2247 		p_initializer, 
  2673 
  2248 		p_id, 
  2674 	if (m_am_tools != 0)
  2249 		p_data,
  2675 	{
  2250 		p_time_ms);
  2676 		status = m_am_tools->am_set_timer(
       
  2677 			p_initializer, 
       
  2678 			p_id, 
       
  2679 			p_data,
       
  2680 			p_time_ms);
       
  2681 	}
  2251 
  2682 
  2252 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2683 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2253 	return status;
  2684 	return status;
  2254 }
  2685 }
  2255 
  2686 
  2265 	abs_eap_base_timer_c * const p_initializer, 
  2696 	abs_eap_base_timer_c * const p_initializer, 
  2266 	const u32_t p_id)
  2697 	const u32_t p_id)
  2267 {
  2698 {
  2268 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2699 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2269 
  2700 
  2270 	const eap_status_e status = m_am_tools->am_cancel_timer(
  2701 	eap_status_e status(eap_status_ok);
  2271 		p_initializer, 
  2702 
  2272 		p_id);
  2703 	if (m_am_tools != 0)
       
  2704 	{
       
  2705 		status = m_am_tools->am_cancel_timer(
       
  2706 			p_initializer, 
       
  2707 			p_id);
       
  2708 	}
  2273 
  2709 
  2274 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2710 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2275 	return status;
  2711 	return status;
  2276 }
  2712 }
  2277 
  2713 
  2286  */
  2722  */
  2287 eap_status_e CEapVpnInterfaceImplementation::cancel_all_timers()
  2723 eap_status_e CEapVpnInterfaceImplementation::cancel_all_timers()
  2288 {
  2724 {
  2289 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2725 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2290 
  2726 
  2291 	const eap_status_e status = m_am_tools->am_cancel_all_timers();
  2727 	eap_status_e status(eap_status_ok);
       
  2728 
       
  2729 	if (m_am_tools != 0)
       
  2730 	{
       
  2731 		status = m_am_tools->am_cancel_all_timers();
       
  2732 	}
  2292 
  2733 
  2293 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2734 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2294 	return status;
  2735 	return status;
  2295 }
  2736 }
  2296 
  2737 
  2302 eap_status_e CEapVpnInterfaceImplementation::check_is_valid_eap_type(const eap_type_value_e eap_type)
  2743 eap_status_e CEapVpnInterfaceImplementation::check_is_valid_eap_type(const eap_type_value_e eap_type)
  2303 {
  2744 {
  2304 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2745 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
  2305 
  2746 
  2306 	eap_status_e status(eap_status_illegal_eap_type);
  2747 	eap_status_e status(eap_status_illegal_eap_type);
  2307 
       
  2308 #ifdef USE_EAP_EXPANDED_TYPES
       
  2309 
  2748 
  2310 	for (int i = 0; i < m_enabled_expanded_eap_array.Count(); i++)
  2749 	for (int i = 0; i < m_enabled_expanded_eap_array.Count(); i++)
  2311 	{
  2750 	{
  2312 		TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType);
  2751 		TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType);
  2313 
  2752 
  2344 			// This is Allowed and Valid.
  2783 			// This is Allowed and Valid.
  2345 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2784 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2346 			return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  2785 			return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
  2347 		}
  2786 		}
  2348 	} // End of for()
  2787 	} // 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
       
  2375 
  2788 
  2376 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2789 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2377 
  2790 
  2378 	return EAP_STATUS_RETURN(m_am_tools, status);
  2791 	return EAP_STATUS_RETURN(m_am_tools, status);
  2379 }
  2792 }
  2397 		return EAP_STATUS_RETURN(m_am_tools, status);
  2810 		return EAP_STATUS_RETURN(m_am_tools, status);
  2398 	}
  2811 	}
  2399 
  2812 
  2400 	eap_header_string_c eap_string;
  2813 	eap_header_string_c eap_string;
  2401 	EAP_UNREFERENCED_PARAMETER(eap_string);
  2814 	EAP_UNREFERENCED_PARAMETER(eap_string);
  2402 
       
  2403 #ifdef USE_EAP_EXPANDED_TYPES
       
  2404 
  2815 
  2405 	// This function is same as get_selected_eap_types in behavior.
  2816 	// This function is same as get_selected_eap_types in behavior.
  2406 
  2817 
  2407 	// We need to return only the EAP types available as enabled types.
  2818 	// We need to return only the EAP types available as enabled types.
  2408 	// It means only the ones available in m_enabled_expanded_eap_array.
  2819 	// It means only the ones available in m_enabled_expanded_eap_array.
  2447 		if (status != eap_status_ok)
  2858 		if (status != eap_status_ok)
  2448 		{
  2859 		{
  2449 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2860 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2450 			return EAP_STATUS_RETURN(m_am_tools, status);
  2861 			return EAP_STATUS_RETURN(m_am_tools, status);
  2451 		}		
  2862 		}		
  2452 			
  2863 
  2453 		EAP_TRACE_DEBUG(
  2864 		EAP_TRACE_DEBUG(
  2454 			m_am_tools,
  2865 			m_am_tools,
  2455 			TRACE_FLAGS_DEFAULT,
  2866 			TRACE_FLAGS_DEFAULT,
  2456 			(EAPL("get_eap_type_list():added EAP-type=0x%08x=%s\n"),
  2867 			(EAPL("get_eap_type_list():added EAP-type=0xfe%06x%08x=%s\n"),
       
  2868 			expandedEAPType->get_vendor_id(),
  2457 			expandedEAPType->get_vendor_type(),
  2869 			expandedEAPType->get_vendor_type(),
  2458 			eap_string.get_eap_type_string(*expandedEAPType)));			
  2870 			eap_header_string_c::get_eap_type_string(*expandedEAPType)));
  2459 	}
  2871 	}
  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
       
  2493 
  2872 
  2494 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2873 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
  2495 	return eap_status_ok;
  2874 	return eap_status_ok;
  2496 }
  2875 }
  2497 //--------------------------------------------------
  2876 //--------------------------------------------------
  2654 	implArray->Close();
  3033 	implArray->Close();
  2655 }
  3034 }
  2656 
  3035 
  2657 //--------------------------------------------------
  3036 //--------------------------------------------------
  2658 
  3037 
       
  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 
  2659 // End
  3159 // End