realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
changeset 34 3c8db403127f
parent 21 9565022eef45
child 37 0295359a7673
equal deleted inserted replaced
27:740ceea8e153 34:3c8db403127f
   240 //
   240 //
   241 void CSIPProfileServerCore::SIPProfileStatusEvent(CSIPConcreteProfile& aProfile,
   241 void CSIPProfileServerCore::SIPProfileStatusEvent(CSIPConcreteProfile& aProfile,
   242 												  TUint32 aContextId)
   242 												  TUint32 aContextId)
   243     {
   243     {
   244     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
   244     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
       
   245     
       
   246     if(aContextId == 0 && item)
       
   247         {
       
   248         if(item->IsApnSwitchEnabled())
       
   249             {
       
   250             UsePrimaryApn(aProfile.IapId());
       
   251             }
       
   252         }
       
   253     
   245     TRAPD(err, SIPProfileStatusEventL(aProfile.Id(), aContextId));
   254     TRAPD(err, SIPProfileStatusEventL(aProfile.Id(), aContextId));
   246 
   255 
   247     if (err != KErrNone)
   256     if (err != KErrNone)
   248         {
   257         {
   249 		if (item)
   258 		if (item)
   334                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
   343                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
   335             else if((FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )&& 
   344             else if((FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )&& 
   336                         item->IsVpnInUse()))
   345                         item->IsVpnInUse()))
   337                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);                
   346                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);                
   338             }       
   347             }       
   339         }		
   348         
       
   349         if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching))
       
   350             {
       
   351             if(item && item->IsApnSwitchEnabled() && aContextId)
       
   352                 {
       
   353                 CSIPConcreteProfile::TStatus status;
       
   354                 iPluginDirector->State( status, item->Profile() );
       
   355                 if(status == CSIPConcreteProfile::EUnregistered)
       
   356                     {
       
   357                     UseBackupApn(item->Profile().IapId(), EFalse);
       
   358                     }
       
   359                 }
       
   360             }
       
   361         }
   340     CheckServerStatus();
   362     CheckServerStatus();
   341     }
   363     }
   342 
   364 
   343 // -----------------------------------------------------------------------------
   365 // -----------------------------------------------------------------------------
   344 // CSIPProfileServerCore::SIPProfileErrorEvent
   366 // CSIPProfileServerCore::SIPProfileErrorEvent
   473                 {                
   495                 {                
   474                 StartConnectionCloseTimer(KOfflineTimer);
   496                 StartConnectionCloseTimer(KOfflineTimer);
   475                 TBool waitForDeregistration = EFalse;
   497                 TBool waitForDeregistration = EFalse;
   476                 for (TInt i = 0; i < iProfileCache.Count(); i++)
   498                 for (TInt i = 0; i < iProfileCache.Count(); i++)
   477                     {
   499                     {
   478                     iProfileCache[i]->OfflineInitiated(ETrue);
       
   479                     CSIPConcreteProfile::TStatus status;
   500                     CSIPConcreteProfile::TStatus status;
   480                     iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   501                     iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   481                     if(status != CSIPConcreteProfile::EUnregistered)
   502                     if(status != CSIPConcreteProfile::EUnregistered)
   482                         waitForDeregistration = ETrue;            
   503                         waitForDeregistration = ETrue;   
       
   504                     iProfileCache[i]->OfflineInitiated(ETrue);
   483                     }
   505                     }
   484                 if(!waitForDeregistration)
   506                 if(!waitForDeregistration)
   485                     {
   507                     {
   486                     ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
   508                     ConfirmSystemstateMonitor(CSipSystemStateMonitor::ESystemState);
   487                     }
   509                     }
   513 	        {
   535 	        {
   514 	        PROFILE_DEBUG1("RFS Started, de-registering the profiles")
   536 	        PROFILE_DEBUG1("RFS Started, de-registering the profiles")
   515 	        TBool waitForDeregistration = EFalse;
   537 	        TBool waitForDeregistration = EFalse;
   516 	        for (TInt i = 0; i < iProfileCache.Count(); i++)         
   538 	        for (TInt i = 0; i < iProfileCache.Count(); i++)         
   517 	            {
   539 	            {
   518 	            iProfileCache[i]->RfsInprogress(ETrue);
       
   519 	            CSIPConcreteProfile::TStatus status;
   540 	            CSIPConcreteProfile::TStatus status;
   520 	            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   541 	            iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   521 	            if (status != CSIPConcreteProfile::EUnregistered)
   542 	            if (status != CSIPConcreteProfile::EUnregistered)
   522 	                waitForDeregistration = ETrue;
   543 	                waitForDeregistration = ETrue;
       
   544 	            iProfileCache[i]->RfsInprogress(ETrue);
   523 	            }      
   545 	            }      
   524 	        if(!waitForDeregistration)
   546 	        if(!waitForDeregistration)
   525 	            {
   547 	            {
   526 	            ConfirmSystemstateMonitor(CSipSystemStateMonitor::ERfsState);
   548 	            ConfirmSystemstateMonitor(CSipSystemStateMonitor::ERfsState);
   527 	            }
   549 	            }
   562             {
   584             {
   563             PROFILE_DEBUG1("VPN Initiated , de-registering the profiles")
   585             PROFILE_DEBUG1("VPN Initiated , de-registering the profiles")
   564             TBool waitForDeregistration = EFalse;
   586             TBool waitForDeregistration = EFalse;
   565             for (TInt i = 0; i < iProfileCache.Count(); i++)
   587             for (TInt i = 0; i < iProfileCache.Count(); i++)
   566                 {
   588                 {
   567                 iProfileCache[i]->VpnInUse( ETrue );
       
   568                 iProfileCache[i]->ShutdownInitiated();
       
   569                 CSIPConcreteProfile::TStatus status;
   589                 CSIPConcreteProfile::TStatus status;
   570                 iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   590                 iPluginDirector->State(status, iProfileCache[i]->UsedProfile());
   571                 if (status != CSIPConcreteProfile::EUnregistered)
   591                 if (status != CSIPConcreteProfile::EUnregistered)
   572                     waitForDeregistration = ETrue;
   592                     waitForDeregistration = ETrue;
       
   593                 iProfileCache[i]->VpnInUse( ETrue );
   573                 }
   594                 }
   574             if (!waitForDeregistration)
   595             if (!waitForDeregistration)
   575                 {
   596                 {
   576                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);
   597                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);
   577                 }
   598                 }
  1644 //
  1665 //
  1645 void CSIPProfileServerCore::HandleAsyncError(CSIPProfileCacheItem& aItem, 
  1666 void CSIPProfileServerCore::HandleAsyncError(CSIPProfileCacheItem& aItem, 
  1646 	CSIPConcreteProfile::TStatus aStatus,
  1667 	CSIPConcreteProfile::TStatus aStatus,
  1647     TInt aError)
  1668     TInt aError)
  1648     {
  1669     {
  1649     TInt err(aError);
  1670     PROFILE_DEBUG3("CSIPProfileServerCore::HandleAsyncError, error", aError)
  1650     if (aStatus == CSIPConcreteProfile::EUnregistrationInProgress)
  1671     TBool isFatal(EFalse);
  1651         {
  1672     if(aError != KErrSIPApnSwitchNonFatalFailure)
  1652         err = KErrNone;
  1673         {
  1653         }
  1674         TInt err(aError);
  1654 
  1675         if (aStatus == CSIPConcreteProfile::EUnregistrationInProgress)
  1655     if (HandleProfileError(aItem, err))
  1676             {
  1656     	{
  1677             err = KErrNone;
  1657 	    if (err == KErrTotalLossOfPrecision)
  1678             }
  1658 	        {
  1679 
  1659 	        TRAP_IGNORE(SendUnregisteredStatusEventL(aItem))
  1680         if (HandleProfileError(aItem, err))
  1660 	        }
  1681             {
  1661 	    else
  1682             if (err == KErrTotalLossOfPrecision)
  1662 	        {
  1683                 {
  1663 	        SendErrorEvent(aItem, aStatus, aError);
  1684                 TRAP_IGNORE(SendUnregisteredStatusEventL(aItem))
  1664 	        }
  1685                 }
  1665     	}
  1686             else
       
  1687                 {
       
  1688                 SendErrorEvent(aItem, aStatus, aError);
       
  1689                 isFatal = ETrue;
       
  1690                 }
       
  1691             }
       
  1692         }
       
  1693     
  1666     if(aItem.IsApnSwitchEnabled())
  1694     if(aItem.IsApnSwitchEnabled())
  1667         {
  1695         {
  1668         UseBackupApn(aItem.Profile().IapId(), ETrue);
  1696         UseBackupApn(aItem.Profile().IapId(), isFatal);
  1669         }
  1697         }
  1670     }
  1698     }
  1671 
  1699 
  1672 // -----------------------------------------------------------------------------
  1700 // -----------------------------------------------------------------------------
  1673 // CSIPProfileServerCore::ReleaseStorage
  1701 // CSIPProfileServerCore::ReleaseStorage
  2399 //
  2427 //
  2400 void CSIPProfileServerCore::UseBackupApn( TUint32 aIapId, TBool aFatalFailure )
  2428 void CSIPProfileServerCore::UseBackupApn( TUint32 aIapId, TBool aFatalFailure )
  2401     {
  2429     {
  2402     PROFILE_DEBUG1("CSIPProfileServerCore::UseBackupApn")
  2430     PROFILE_DEBUG1("CSIPProfileServerCore::UseBackupApn")
  2403     
  2431     
  2404     if ( iApnManager->IsFailed( aIapId ) || aFatalFailure )
  2432     if ( !iApnManager->IsFailed( aIapId ) || aFatalFailure )
  2405         {
  2433         {
  2406         iApnManager->SetFailed( aIapId, ETrue, aFatalFailure );
  2434         iApnManager->SetFailed( aIapId, ETrue, aFatalFailure );
  2407         }
  2435         }
  2408     
  2436     
  2409     PROFILE_DEBUG1("CSIPIMSProfileAgent::UseBackupApn, exit")
  2437     PROFILE_DEBUG1("CSIPIMSProfileAgent::UseBackupApn, exit")