cmmanager/cmmgr/cmmplugins/cmpluginvpn/src/cmpluginvpn.cpp
changeset 40 c5b848e6c7d1
parent 32 5c4486441ae6
equal deleted inserted replaced
34:3b0cec605979 40:c5b848e6c7d1
   421             {
   421             {
   422             TCommsDBBearerTechnology bearer = KCommDbBearerVirtual; 
   422             TCommsDBBearerTechnology bearer = KCommDbBearerVirtual; 
   423             retVal = bearer;
   423             retVal = bearer;
   424             }
   424             }
   425             break;
   425             break;
   426         case ECmNextLayerIapId: //falls through
   426         case ECmNextLayerIapId:
   427         case EVpnIapId:
   427         case EVpnIapId:
   428             {            
   428             {            
   429             TUint recordId = serviceRecord->iServiceIAP;
   429             TUint recordId = serviceRecord->iServiceIAP;//TODO, can't use this straight? link containd the ID.
   430             if (recordId != 0)
   430             if (recordId != 0)
   431                 {
   431                 {
   432                 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
   432                 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
   433                                         ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
   433                                         ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
   434                 
   434                 
   438                 retVal = iapRecord->RecordId();
   438                 retVal = iapRecord->RecordId();
   439                 CleanupStack::PopAndDestroy( iapRecord );                             
   439                 CleanupStack::PopAndDestroy( iapRecord );                             
   440                 }
   440                 }
   441             }
   441             }
   442             break;
   442             break;
   443         case EVpnNetworkId: //falls through      
   443         case EVpnNetworkId:
   444         case ECmNextLayerSNAPId:
   444         case ECmNextLayerSNAPId:
   445             {
   445             {
   446             TUint recordId = serviceRecord->iServiceSNAP;
   446             TUint recordId = serviceRecord->iServiceSNAP;
   447             if (recordId != 0)
   447             if ( recordId != 0 )
   448                 {
   448                 {
   449                 CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *>
   449                 CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord*>(
   450                                                         ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
   450                         CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
   451                 CleanupStack::PushL( accessPointRecord );
   451                 CleanupStack::PushL( accessPointRecord );
   452                 accessPointRecord->SetRecordId( recordId );
   452                 accessPointRecord->SetRecordId( recordId );
   453                 accessPointRecord->LoadL( iSession );
   453                 accessPointRecord->LoadL( iSession );
   454                 retVal = accessPointRecord->iRecordTag;
   454                 retVal = accessPointRecord->iRecordTag;
   455                 CleanupStack::PopAndDestroy( accessPointRecord );
   455                 CleanupStack::PopAndDestroy( accessPointRecord );
   456                 
   456 
   457                 if (aAttribute == EVpnNetworkId)
   457                 if ( aAttribute == EVpnNetworkId )
   458                     {
   458                     {
   459                     __ASSERT_DEBUG( retVal >= KCmmDestIdIntervalMin, User::Invariant() );
   459                     __ASSERT_DEBUG( retVal >= KCmmDestIdIntervalMin, User::Invariant() );//TODO, replace with iCustomSelectionPolicy
   460                     retVal -= KCmmDestIdIntervalMin;
   460                     retVal -= KCmmDestIdIntervalMin;
   461                     }
   461                     }
   462                 }
   462                 }
   463             }
   463             }
   464             break;
   464             break;
   594             {
   594             {
   595             if ( aValue == 0 || aValue > (KCmmDestIdIntervalLegacyMax - 2) )
   595             if ( aValue == 0 || aValue > (KCmmDestIdIntervalLegacyMax - 2) )
   596                 {
   596                 {
   597                 User::Leave( KErrArgument );
   597                 User::Leave( KErrArgument );
   598                 }
   598                 }
   599             } //falls through
   599             }
       
   600             // Fallthrough intended.
   600         case ECmNextLayerSNAPId:
   601         case ECmNextLayerSNAPId:
   601             {
   602             {
   602             if ( aValue <= (KCmmDestIdIntervalLegacyMax - 2) )
   603             if ( aValue <= ( KCmmDestIdIntervalLegacyMax - 2 ) )
   603                 {
   604                 {
   604                 aValue += KCmmDestIdIntervalMin;
   605                 aValue += KCmmDestIdIntervalMin;
   605                 }
   606                 }
   606             
   607 
   607             if ( aValue <= KCmmDestIdIntervalMin ||
   608             if ( aValue <= KCmmDestIdIntervalMin ||
   608                  aValue > KCmmDestIdIntervalMax - 2 )
   609                     aValue > KCmmDestIdIntervalMax - 2 )
   609                 {
   610                 {
   610                 User::Leave( KErrArgument );
   611                 User::Leave( KErrArgument );
   611                 }
   612                 }
   612             
   613 
   613             CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *>
   614             CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord*>(
   614                                                     ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
   615                     CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
   615             CleanupStack::PushL( accessPointRecord );
   616             CleanupStack::PushL( accessPointRecord );
   616             accessPointRecord->iRecordTag = aValue;
   617             accessPointRecord->iRecordTag = aValue;
   617             if ( accessPointRecord->FindL( iSession ) )
   618             if ( accessPointRecord->FindL( iSession ) )
   618                 {
   619                 {
   619                 serviceRecord->iServiceIAP = 0;
   620                 serviceRecord->iServiceIAP = 0;
   623                 virtualIapNextLayerRecord->iNextLayerSNAP.SetL( aValue );
   624                 virtualIapNextLayerRecord->iNextLayerSNAP.SetL( aValue );
   624                 }
   625                 }
   625             else
   626             else
   626                 {
   627                 {
   627                 User::Leave( KErrArgument );
   628                 User::Leave( KErrArgument );
   628                 }            
   629                 }
   629             CleanupStack::PopAndDestroy( accessPointRecord );
   630             CleanupStack::PopAndDestroy( accessPointRecord );
   630             }
   631             }
   631             break;
   632             break;
   632         default:
   633         default:
   633             {
   634             {