realtimenetprots/sipfw/ProfileAgent/IMS_Agent/Src/sipimsprofileagent.cpp
branchRCL_3
changeset 6 43c4dec3cb1f
parent 4 c2e8c8b73582
equal deleted inserted replaced
5:532ef74cdfa0 6:43c4dec3cb1f
   133             }
   133             }
   134         i++;
   134         i++;
   135         }
   135         }
   136     __ASSERT_ALWAYS(found, User::Leave(KErrNotFound));     
   136     __ASSERT_ALWAYS(found, User::Leave(KErrNotFound));     
   137     
   137     
       
   138     PROFILE_DEBUG1("CSIPIMSProfileAgent::ConstructL, etel ok")     
       
   139     
   138     iXMLParser = CSIPNotifyXmlBodyParser::NewL();
   140     iXMLParser = CSIPNotifyXmlBodyParser::NewL();
   139 	iInit = CSIPPrflInitState::NewL(*this);
   141 	iInit = CSIPPrflInitState::NewL(*this);
   140 	iResolvingProxies = CSIPPrflResolvingProxiesState::NewL(*this);
   142 	iResolvingProxies = CSIPPrflResolvingProxiesState::NewL(*this);
   141 	iRegRequested = CSIPPrflRegisterRequestedState::NewL(*this);
   143 	iRegRequested = CSIPPrflRegisterRequestedState::NewL(*this);
   142 	iRegInProgress = CSIPPrflRegistrationInProgressState::NewL(*this);
   144 	iRegInProgress = CSIPPrflRegistrationInProgressState::NewL(*this);
   153 							 *iInit, *iRegRequested,*iRegDelayRequested);
   155 							 *iInit, *iRegRequested,*iRegDelayRequested);
   154 	iDeregRequested->LinkStates(*iInit, *iRegistered, *iDeregInProgress);
   156 	iDeregRequested->LinkStates(*iInit, *iRegistered, *iDeregInProgress);
   155 	iDeregInProgress->LinkStates(*iInit);
   157 	iDeregInProgress->LinkStates(*iInit);
   156 	iRegDelayRequested->LinkStates(*iInit);
   158 	iRegDelayRequested->LinkStates(*iInit);
   157 	
   159 	
       
   160 	PROFILE_DEBUG1("CSIPIMSProfileAgent::ConstructL, states ok")   
       
   161 	
   158 	iSIMRecord = CSIPProfileSIMRecord::NewL();	
   162 	iSIMRecord = CSIPProfileSIMRecord::NewL();	
   159 	iProfileQueueHandling = CSIPProfileQueueHandling::NewL(*this);
   163 	iProfileQueueHandling = CSIPProfileQueueHandling::NewL(*this);
   160 	TRAPD(err, iUsimProvider = 
   164 	TRAPD(err, iUsimProvider = 
   161 	    CSIPProfileUsimProvider::NewL(
   165 	    CSIPProfileUsimProvider::NewL(
   162 	        *iSIMRecord, iTelServer, phoneInfo, *this));
   166 	        *iSIMRecord, iTelServer, phoneInfo, *this));
   163 	if(err == KErrNoMemory)
   167 	if(err == KErrNoMemory)
   164 		{
   168 		{
   165 		User::Leave(err);
   169 		User::Leave(err);
   166 		}
   170 		}
       
   171 	
       
   172 	PROFILE_DEBUG1("CSIPIMSProfileAgent::ConstructL, sim ok") 
   167 	iConfigExtension = NULL;
   173 	iConfigExtension = NULL;
       
   174 	PROFILE_DEBUG1("CSIPIMSProfileAgent::ConstructL, exit")
   168     }
   175     }
   169 
   176 
   170 // -----------------------------------------------------------------------------
   177 // -----------------------------------------------------------------------------
   171 // CSIPIMSProfileAgent::~CSIPIMSProfileAgent
   178 // CSIPIMSProfileAgent::~CSIPIMSProfileAgent
   172 // Symbian 2nd phase constructor can leave.
   179 // Symbian 2nd phase constructor can leave.
   198 	delete iSIMRecord;
   205 	delete iSIMRecord;
   199 	iTelServer.Close();
   206 	iTelServer.Close();
   200 	delete iHttpDigest;
   207 	delete iHttpDigest;
   201 	delete iSIP;
   208 	delete iSIP;
   202 	SIPStrings::Close();	
   209 	SIPStrings::Close();	
       
   210 	PROFILE_DEBUG1("CSIPIMSProfileAgent::~CSIPIMSProfileAgent, exit")
   203 	}
   211 	}
   204 
   212 
   205 // -----------------------------------------------------------------------------
   213 // -----------------------------------------------------------------------------
   206 // CSIPIMSProfileAgent::RegAllowedWithUSIMorISIML
   214 // CSIPIMSProfileAgent::RegAllowedWithUSIMorISIML
   207 // (other items were commented in a header).
   215 // (other items were commented in a header).
   384 	
   392 	
   385 	// If digest settings are configured, no need to do USIM/SIM authorization	
   393 	// If digest settings are configured, no need to do USIM/SIM authorization	
   386 	if (iUsimProvider && 
   394 	if (iUsimProvider && 
   387 	    !CSIPIMSProfileContext::IsHttpDigestSettingsConfigured(aSIPConcreteProfile))
   395 	    !CSIPIMSProfileContext::IsHttpDigestSettingsConfigured(aSIPConcreteProfile))
   388 	    {
   396 	    {
       
   397         TBool requestFailed = EFalse;
   389 	   	if (!iUsimProvider->IsUsimSupported())
   398 	   	if (!iUsimProvider->IsUsimSupported())
   390     		{
   399     		{
   391     		iSIMWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
   400     		iSIMWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
   392     		iUsimProvider->RequestL(ETrue);
   401     		requestFailed = iUsimProvider->RequestL(EFalse);
       
   402     		if(requestFailed)
       
   403     		    {
       
   404                 AuthorizationSIMFailed();
       
   405     		    }
   393     		}
   406     		}
   394 	    else
   407 	    else
   395 			{
   408 			{
   396 			iUSimWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
   409 			iUSimWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
   397 			iUsimProvider->RequestL();
   410 			requestFailed = iUsimProvider->RequestL(ETrue);
       
   411 			if(requestFailed)
       
   412 			    {
       
   413                 AuthorizationUSIMFailed();
       
   414 			    }
   398 			}
   415 			}
   399 	    }
   416 	    }
   400     else
   417     else
   401 		{
   418 		{
   402 		iWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
   419 		iWaitForAuthorizedArray.AppendL(&aSIPConcreteProfile);
  1114 			profile = RemoveFirstProfileFromArray( 
  1131 			profile = RemoveFirstProfileFromArray( 
  1115 								iUSimWaitForAuthorizedArray );
  1132 								iUSimWaitForAuthorizedArray );
  1116 		
  1133 		
  1117 			if (RegAllowedWithUSIMorISIML(*profile))
  1134 			if (RegAllowedWithUSIMorISIML(*profile))
  1118 				{
  1135 				{
  1119 				if (profile->IsSecurityNegotiationEnabled() &&
  1136                  PROFILE_DEBUG1("CSIPIMSProfileAgent::AuthorizedL ISIM Registration Allowed")
       
  1137 				 if (profile->IsSecurityNegotiationEnabled() &&
  1120 	 				!CSIPIMSProfileContext::IsHttpDigestSettingsConfigured(
  1138 	 				!CSIPIMSProfileContext::IsHttpDigestSettingsConfigured(
  1121 	 									*profile))
  1139 	 									*profile))
  1122 					{	
  1140 					{	
  1123 					_LIT8(KSIPIpSec3gpp, "ipsec-3gpp");
  1141 					_LIT8(KSIPIpSec3gpp, "ipsec-3gpp");
  1124 					if (CSIPIMSProfileContext::IsSupportedSecurityMechanismL(
  1142 					if (CSIPIMSProfileContext::IsSupportedSecurityMechanismL(
  1206 	{
  1224 	{
  1207 	PROFILE_DEBUG1("CSIPIMSProfileAgent::AuthorizationFailed")
  1225 	PROFILE_DEBUG1("CSIPIMSProfileAgent::AuthorizationFailed")
  1208 	TInt error = 0;
  1226 	TInt error = 0;
  1209 	//function called after async call to request for authorization info
  1227 	//function called after async call to request for authorization info
  1210 	CSIPConcreteProfile* profile = NULL;
  1228 	CSIPConcreteProfile* profile = NULL;
  1211 	while (iUSimWaitForAuthorizedArray.Count() > 0)
  1229 	for(TUint i = iUSimWaitForAuthorizedArray.Count(); i>0; i--)
  1212 		{
  1230 		{
  1213 		profile = RemoveFirstProfileFromArray( 
  1231 		profile = RemoveFirstProfileFromArray( 
  1214 									iUSimWaitForAuthorizedArray );
  1232 									iUSimWaitForAuthorizedArray );
  1215 		if (RegAllowedWithSIM(*profile))
  1233 		if (RegAllowedWithSIM(*profile))
  1216 			{
  1234 			{
  1219 		else
  1237 		else
  1220 			{
  1238 			{
  1221 			TerminateAndErrorEvent( *profile, KErrNotSupported );
  1239 			TerminateAndErrorEvent( *profile, KErrNotSupported );
  1222 			}
  1240 			}
  1223 		}
  1241 		}
  1224 	if (!error)
  1242 	TBool requestFailed = EFalse;
  1225 		{
  1243 	if ( iSIMWaitForAuthorizedArray.Count() > 0 && !error )
  1226 		TRAP(error, iUsimProvider->RequestL());
  1244 		{
  1227 		}
  1245 		TRAP(error, requestFailed = iUsimProvider->RequestL(EFalse));
  1228 	if(error)
  1246 		}
       
  1247 	
       
  1248 	if(error || requestFailed)
  1229 		{
  1249 		{
  1230 		AuthorizationSIMFailed();
  1250 		AuthorizationSIMFailed();
  1231 		AuthorizationUSIMFailed();
       
  1232 		}
  1251 		}
  1233 	}	
  1252 	}	
  1234 
  1253 
  1235 // -----------------------------------------------------------------------------
  1254 // -----------------------------------------------------------------------------
  1236 // CSIPIMSProfileAgent::AuthorizationSIMFailed
  1255 // CSIPIMSProfileAgent::AuthorizationSIMFailed