vpnengine/vpnconnagt/src/vpnconnagt.cpp
branchRCL_3
changeset 18 5db1ac3b4374
parent 8 032d3a818f49
child 21 5aacbb121f34
equal deleted inserted replaced
16:9fc0ed567871 18:5db1ac3b4374
    13 *
    13 *
    14 * Description:   VPN Connection Agent
    14 * Description:   VPN Connection Agent
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 #include <cmmanager.h>
    18 #include <cmmanager.h>
    21 #include <cmconnectionmethod.h>
    19 #include <cmconnectionmethod.h>
    22 #include <cmpluginvpndef.h>
    20 #include <cmpluginvpndef.h>
    23 #include <commdbconnpref.h>
    21 #include <commdbconnpref.h>
    24 #include <in_iface.h>
    22 #include <in_iface.h>
   313         {
   311         {
   314         LOG(TName name;
   312         LOG(TName name;
   315         name.AppendFormat(_L("[0x%08x]"), this);
   313         name.AppendFormat(_L("[0x%08x]"), this);
   316         Log::Printf(_L("%s Error %d in reading configuration\n"),name.PtrZ(), iLastErrorCode));
   314         Log::Printf(_L("%s Error %d in reading configuration\n"),name.PtrZ(), iLastErrorCode));
   317 
   315 
       
   316         iNotify->AgentProgress(EVPNConnAgtDisconnected, iLastErrorCode);
   318         iNotify->ConnectComplete(iLastErrorCode);
   317         iNotify->ConnectComplete(iLastErrorCode);
       
   318         
   319         aError = iLastErrorCode;
   319         aError = iLastErrorCode;
   320         return;
   320         return;
   321         }
   321         }
   322  
   322  
   323     // SIP is deregistered before starting a VPN session. First tell SIP profile server to 
   323     // SIP is deregistered before starting a VPN session. First tell SIP profile server to 
   767     cmManager.OpenL();
   767     cmManager.OpenL();
   768     CleanupClosePushL( cmManager );      
   768     CleanupClosePushL( cmManager );      
   769     RCmConnectionMethod vpnConnection = 
   769     RCmConnectionMethod vpnConnection = 
   770         cmManager.ConnectionMethodL( iSettings.iIAPId );
   770         cmManager.ConnectionMethodL( iSettings.iIAPId );
   771     CleanupClosePushL(vpnConnection);
   771     CleanupClosePushL(vpnConnection);
   772     ASSERT( vpnConnection.GetBoolAttributeL(ECmVirtual) );
   772 
       
   773     if ( EFalse == vpnConnection.GetBoolAttributeL(ECmVirtual) )
       
   774         {
       
   775         User::Leave( KErrNotSupported );
       
   776         }
   773 
   777 
   774     // Read VPN Network Id
   778     // Read VPN Network Id
   775     const TUint32 vpnNetworkId(vpnConnection.GetIntAttributeL(ECmNetworkId));
   779     const TUint32 vpnNetworkId(vpnConnection.GetIntAttributeL(ECmNetworkId));
   776     iVPNParameters.SetVPNNetworkId(vpnNetworkId);
   780     iVPNParameters.SetVPNNetworkId(vpnNetworkId);
   777 
   781 
   803         {        
   807         {        
   804         // Now load real connection
   808         // Now load real connection
   805         RCmConnectionMethod realConnection = 
   809         RCmConnectionMethod realConnection = 
   806             cmManager.ConnectionMethodL( realIap );
   810             cmManager.ConnectionMethodL( realIap );
   807         CleanupClosePushL(realConnection);      
   811         CleanupClosePushL(realConnection);      
   808         ASSERT( !realConnection.GetBoolAttributeL(ECmVirtual) );
   812 
       
   813         if ( EFalse != realConnection.GetBoolAttributeL(ECmVirtual) )
       
   814             {
       
   815             User::Leave( KErrNotSupported );    
       
   816             }
   809         
   817         
   810         // real iap id
   818         // real iap id
   811         const TUint32 realIapId( realConnection.GetIntAttributeL(ECmIapId) );
   819         const TUint32 realIapId( realConnection.GetIntAttributeL(ECmIapId) );
   812         iVPNParameters.SetRealIapId( realIapId );
   820         iVPNParameters.SetRealIapId( realIapId );
   813         
   821