bearermanagement/mpm/src/mpmserversession.cpp
changeset 47 cb7afde124a3
parent 46 95d45f234cf3
child 53 4af712113915
equal deleted inserted replaced
46:95d45f234cf3 47:cb7afde124a3
    67 //
    67 //
    68 CMPMServerSession::CMPMServerSession(CMPMServer& aServer)
    68 CMPMServerSession::CMPMServerSession(CMPMServer& aServer)
    69     : CSession2(), 
    69     : CSession2(), 
    70       iMyServer( aServer ),
    70       iMyServer( aServer ),
    71       iConfirmDlgRoaming( NULL ),
    71       iConfirmDlgRoaming( NULL ),
       
    72       iConnId( 0 ),
       
    73       iNotifRequested( EFalse ),
       
    74       iPreferredIAPRequested( EFalse ),
       
    75       iOfflineFeatureSupported( EFalse ),
       
    76       iEasyWlanIap( 0 ),
       
    77       iAppUid( 0 ),
    72       iStoredIapInfo(),
    78       iStoredIapInfo(),
    73       iIapSelection( NULL ),
    79       iIapSelection( NULL ),
    74       iMigrateState( EMigrateNone )
    80       iMigrateState( EMigrateNone ),
       
    81       iLastNotifiedIap( 0 ),
       
    82       iMigrateIap( 0 ),
       
    83       iUserConnection( 0 ),
       
    84       iVpnUserConnectionUsed( EFalse )
    75     {
    85     {
    76     }
    86     }
    77 
    87 
    78 
    88 
    79 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
   106 
   116 
   107     // Remove serverside objects for notification session.
   117     // Remove serverside objects for notification session.
   108     // 
   118     // 
   109     iMyServer.RemoveSession( this );
   119     iMyServer.RemoveSession( this );
   110 
   120 
   111     if (UserConnection())
   121     if (VpnUserConnectionUsed())
       
   122         {
       
   123         SetVpnUserConnectionUsed( EFalse );
       
   124     
       
   125     MPMLOGSTRING( "CMPMServerSession::~CMPMServerSession -\
       
   126  VPN user connection usage ended" )    
       
   127         }
       
   128     else if (UserConnection())
   112         {
   129         {
   113         iMyServer.ClearUserConnection();
   130         iMyServer.ClearUserConnection();
   114         ClearUserConnection();
   131         ClearUserConnection();
   115         
   132         
   116         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
   133         MPMLOGSTRING( "CMPMServerSession::~CMPMServerSession -\
   117 User connection deactivated" )
   134 User connection deactivated" )
   118         }   
   135         }   
   119 
   136 
   120     // Clean up the blacklist table 
   137     // Clean up the blacklist table 
   121     iMyServer.HandleServerUnblackListIap( iConnId, 0 );
   138     iMyServer.HandleServerUnblackListIap( iConnId, 0 );
   427                                                 iMyServer.ConnUiUtils() ); 
   444                                                 iMyServer.ConnUiUtils() ); 
   428         }
   445         }
   429     
   446     
   430     MPMLOGSTRING3( "CMPMServerSession::HandleServerChooseIapL - iap %d \
   447     MPMLOGSTRING3( "CMPMServerSession::HandleServerChooseIapL - iap %d \
   431 connType %d", mpmConnPref.IapId(), mpmConnPref.ConnType() )
   448 connType %d", mpmConnPref.IapId(), mpmConnPref.ConnType() )
   432     
   449 
       
   450 
       
   451     if ( iMyServer.UseVpnUserConnection(mpmConnPref,
       
   452                                         AppUid()) )
       
   453         {
       
   454         // VPN user connection needs to be used.
       
   455         TBool prepareOk = iMyServer.PrepareVpnUserConnection( mpmConnPref );
       
   456         if ( prepareOk )
       
   457             {
       
   458             SetVpnUserConnectionUsed( ETrue );
       
   459             MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL -\
       
   460  VPN user connection used" )                    
       
   461             }
       
   462         }
       
   463             
   433     iIapSelection->ChooseIapL( mpmConnPref );
   464     iIapSelection->ChooseIapL( mpmConnPref );
   434 
   465 
   435     if ( iAppUid == iMyServer.CsIdWatcher()->ConnectScreenId() )
   466     if ( iAppUid == iMyServer.CsIdWatcher()->ConnectScreenId() )
   436         {
   467         {
   437         MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL -\
   468         MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL -\
   706     {
   737     {
   707     // Read the Connection Id of the application
   738     // Read the Connection Id of the application
   708     //
   739     //
   709     TConnectionId endId = aMessage.Int0();
   740     TConnectionId endId = aMessage.Int0();
   710 
   741 
   711     if (UserConnection())
   742     if (VpnUserConnectionUsed())
       
   743         {
       
   744         SetVpnUserConnectionUsed( EFalse );
       
   745 
       
   746         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
       
   747  VPN user connection usage ended" )    
       
   748         }
       
   749     else if (UserConnection())
   712         {
   750         {
   713         iMyServer.ClearUserConnection();
   751         iMyServer.ClearUserConnection();
   714         ClearUserConnection();
   752         ClearUserConnection();
   715         
   753         
   716         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
   754         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
  1508             break;
  1546             break;
  1509       
  1547       
  1510         case EStarted:
  1548         case EStarted:
  1511             // Process error according to the fact that the connection 
  1549             // Process error according to the fact that the connection 
  1512             // has already been started.
  1550             // has already been started.
       
  1551             // KErrConnectionTerminated is received when user disconnects
       
  1552             // connection from Settings/Connection mgr.
  1513             //         
  1553             //         
  1514             if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) )
  1554             if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) || ( error == KErrConnectionTerminated ) )
  1515                 {
  1555                 {
  1516                 neededAction = EPropagateError;
  1556                 neededAction = EPropagateError;
  1517 
  1557 
  1518                 MPMLOGSTRING(
  1558                 MPMLOGSTRING(
  1519                     "CMPMServerSession::HandleServerProcessErrorL - \
  1559                     "CMPMServerSession::HandleServerProcessErrorL - \
  3420                 }
  3460                 }
  3421             }
  3461             }
  3422         }
  3462         }
  3423     
  3463     
  3424     return EFalse;
  3464     return EFalse;
       
  3465     }
       
  3466 
       
  3467 // -----------------------------------------------------------------------------
       
  3468 // CMPMServerSession::SetVpnUserConnectionUsed
       
  3469 // -----------------------------------------------------------------------------
       
  3470 //
       
  3471 void CMPMServerSession::SetVpnUserConnectionUsed( const TBool aUseVpnUserConnection )
       
  3472     {
       
  3473     if ( aUseVpnUserConnection )
       
  3474         {
       
  3475         iVpnUserConnectionUsed = ETrue;
       
  3476         iMyServer.AddVpnUserConnectionSession();        
       
  3477         }
       
  3478     else 
       
  3479         {
       
  3480         iVpnUserConnectionUsed = EFalse;
       
  3481         iMyServer.RemoveVpnUserConnectionSession();        
       
  3482         }
  3425     }
  3483     }
  3426 
  3484 
  3427 // -----------------------------------------------------------------------------
  3485 // -----------------------------------------------------------------------------
  3428 // CMPMServerSession::IsWlanOnlyL
  3486 // CMPMServerSession::IsWlanOnlyL
  3429 // -----------------------------------------------------------------------------
  3487 // -----------------------------------------------------------------------------