Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 16:03:44 +0300
branchRCL_3
changeset 32 2cdd984ec527
parent 26 822e1f077722
child 40 654ed625511d
Revision: 201023 Kit: 2010125
realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h
realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp
realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp
realtimenetprots/sipfw/SIP/Server/src/CSipCSSession.cpp
realtimenetprots/sipfw/SIP/sipapi/api/siperr.h
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/inc/sipapnconfigurationhandler.h	Mon Jun 21 16:03:44 2010 +0300
@@ -140,10 +140,8 @@
         
         /**
         * Reads the APN of specified IAP.
-        * @param aIapId IAP id
-        * @return APN or NULL if not found. Ownership is transferred.
         */
-        HBufC8* ReadCurrentApnL();
+        void ReadCurrentApnL();
         
 
 	private: // Constructors
--- a/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp	Mon Jun 21 16:03:44 2010 +0300
@@ -126,7 +126,7 @@
 // CSIPApnConfigurationHandler::ReadCurrentApnL
 // -----------------------------------------------------------------------------
 //
-HBufC8* CSIPApnConfigurationHandler::ReadCurrentApnL()
+void CSIPApnConfigurationHandler::ReadCurrentApnL()
 	{
 	HBufC8* apn(NULL);
 		
@@ -193,15 +193,13 @@
 		
 		delete iCurrentApn;
 		iCurrentApn = NULL;
-		iCurrentApn = apn->AllocL();
+		iCurrentApn = apn;
         }
     
     db->ClearAttributeMask( ECDHidden );
     
     CleanupStack::PopAndDestroy( iapRecord );
     CleanupStack::PopAndDestroy( db );
-    
-    return apn;
 	}
 
 // -----------------------------------------------------------------------------
@@ -327,6 +325,7 @@
 	
 	User::LeaveIfError( iSocketSrv.Connect() );
 	iRepository = CRepository::NewL( KCRUidCmManager );
+	ReadCurrentApnL();
 	PROFILE_DEBUG1( 
 	        "CSIPApnConfigurationHandler::ConstructL() exit" )
 	}
@@ -478,16 +477,12 @@
             "CSIPApnConfigurationHandler::ApnChangeNeededL()" )
 
  	TBool apnChangeNeeded( EFalse );
- 	HBufC8* currentApn = ReadCurrentApnL();
-
-	if ( currentApn && currentApn->Compare( aApn ) != 0 )
+	if ( iCurrentApn && iCurrentApn->Compare( aApn ) != 0 )
         {
         // Apn is not the same as wanted
         apnChangeNeeded = ETrue;
         }
 
-	delete currentApn;
-
 	PROFILE_DEBUG3( 
 	        "CSIPApnConfigurationHandler::ApnChangeNeededL(), apnChangeNeeded",
 	        apnChangeNeeded )
@@ -796,13 +791,12 @@
     const TDesC8& aNewApn, 
     TInt aError )
     {
-    if ( !IsPrimaryApnUsed() )
+    HBufC8* currentApn = aNewApn.AllocL();
+    delete iCurrentApn;
+    iCurrentApn = NULL;
+    iCurrentApn = currentApn;
+    if ( IsPrimaryApnUsed() )
         {
-        HBufC8* currentApn = aNewApn.AllocL();
-        delete iCurrentApn;
-        iCurrentApn = NULL;
-        iCurrentApn = currentApn;
-        
         iObserver.ApnChanged( *iCurrentApn, iIapId, aError );
         }
     }
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp	Mon Jun 21 16:03:44 2010 +0300
@@ -242,6 +242,15 @@
 												  TUint32 aContextId)
     {
     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
+    
+    if(aContextId == 0 && item)
+        {
+        if(item->IsApnSwitchEnabled())
+            {
+            UsePrimaryApn(aProfile.IapId());
+            }
+        }
+    
     TRAPD(err, SIPProfileStatusEventL(aProfile.Id(), aContextId));
 
     if (err != KErrNone)
@@ -336,7 +345,20 @@
                         item->IsVpnInUse()))
                 ConfirmSystemstateMonitor(CSipSystemStateMonitor::EVpnState);                
             }       
-        }		
+        
+        if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching))
+            {
+            if(item && item->IsApnSwitchEnabled() && aContextId)
+                {
+                CSIPConcreteProfile::TStatus status;
+                iPluginDirector->State( status, item->Profile() );
+                if(status == CSIPConcreteProfile::EUnregistered)
+                    {
+                    UseBackupApn(item->Profile().IapId(), EFalse);
+                    }
+                }
+            }
+        }
     CheckServerStatus();
     }
 
@@ -1645,26 +1667,33 @@
 	CSIPConcreteProfile::TStatus aStatus,
     TInt aError)
     {
-    TInt err(aError);
-    if (aStatus == CSIPConcreteProfile::EUnregistrationInProgress)
+    PROFILE_DEBUG3("CSIPProfileServerCore::HandleAsyncError, error", aError)
+    TBool isFatal(EFalse);
+    if(aError != KErrSIPApnSwitchNonFatalFailure)
         {
-        err = KErrNone;
-        }
+        TInt err(aError);
+        if (aStatus == CSIPConcreteProfile::EUnregistrationInProgress)
+            {
+            err = KErrNone;
+            }
 
-    if (HandleProfileError(aItem, err))
-    	{
-	    if (err == KErrTotalLossOfPrecision)
-	        {
-	        TRAP_IGNORE(SendUnregisteredStatusEventL(aItem))
-	        }
-	    else
-	        {
-	        SendErrorEvent(aItem, aStatus, aError);
-	        }
-    	}
+        if (HandleProfileError(aItem, err))
+            {
+            if (err == KErrTotalLossOfPrecision)
+                {
+                TRAP_IGNORE(SendUnregisteredStatusEventL(aItem))
+                }
+            else
+                {
+                SendErrorEvent(aItem, aStatus, aError);
+                isFatal = ETrue;
+                }
+            }
+        }
+    
     if(aItem.IsApnSwitchEnabled())
         {
-        UseBackupApn(aItem.Profile().IapId(), ETrue);
+        UseBackupApn(aItem.Profile().IapId(), isFatal);
         }
     }
 
@@ -2400,7 +2429,7 @@
     {
     PROFILE_DEBUG1("CSIPProfileServerCore::UseBackupApn")
     
-    if ( iApnManager->IsFailed( aIapId ) || aFatalFailure )
+    if ( !iApnManager->IsFailed( aIapId ) || aFatalFailure )
         {
         iApnManager->SetFailed( aIapId, ETrue, aFatalFailure );
         }
--- a/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransport.cpp	Mon Jun 21 16:03:44 2010 +0300
@@ -274,7 +274,7 @@
 				if ( IsConnectedTransport() )
 					{
 					TResponseRoute route( id, aRemoteAddr );
-					iIDArray.Append( route );
+					iIDArray.AppendL( route );
 					}
 				TRAP( leaveValue,
 					  receiver->ReceiveL( static_cast<CSIPRequest*>( aMessage ) ) );
--- a/realtimenetprots/sipfw/SIP/Server/src/CSipCSSession.cpp	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/Server/src/CSipCSSession.cpp	Mon Jun 21 16:03:44 2010 +0300
@@ -252,7 +252,10 @@
             {
             TInt handle = 0;
             ITC().ReadL(aMessage,handle,ESipItcArgSubSessionHandle);
-            CloseSubSession (handle);
+			if(iSubSessionIndex->AtL(handle))
+	            CloseSubSession (handle);
+			else
+				{}
             } 
             break;
 
--- a/realtimenetprots/sipfw/SIP/sipapi/api/siperr.h	Wed Jun 09 10:04:26 2010 +0300
+++ b/realtimenetprots/sipfw/SIP/sipapi/api/siperr.h	Mon Jun 21 16:03:44 2010 +0300
@@ -93,4 +93,7 @@
 /** ICMP error has occured */
 const TInt KErrSIPICMPFailure = -17718;
 
+/** Error code to indicate switching to secondary APN on non fatal error  */
+const TInt KErrSIPApnSwitchNonFatalFailure = -17719;
+
 #endif //SIPERR_H