bearermanagement/mpm/src/mpmserversession.cpp
changeset 3 f7816ffc66ed
parent 2 086aae6fc07e
child 8 2e6c4614c58e
child 18 fcbbe021d614
equal deleted inserted replaced
2:086aae6fc07e 3:f7816ffc66ed
  3598         {
  3598         {
  3599         // Iap selection hasn't done for this session -> just return
  3599         // Iap selection hasn't done for this session -> just return
  3600         return;
  3600         return;
  3601         }
  3601         }
  3602     
  3602     
       
  3603     MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
       
  3604  bearerset=%d", iIapSelection->MpmConnPref().BearerSet() )
       
  3605     
  3603     // Drop iaps not according to bearer set
  3606     // Drop iaps not according to bearer set
  3604     if ( iIapSelection->MpmConnPref().BearerSet() != 
  3607     if ( iIapSelection->MpmConnPref().BearerSet() != 
  3605          TExtendedConnPref::EExtendedConnBearerUnknown )
  3608          TExtendedConnPref::EExtendedConnBearerUnknown )
  3606         {
  3609         {
  3607         TInt index = 0;
  3610         TInt index = 0;
  3608         
  3611         
       
  3612         // First filter away physical IAPs (WLAN, packet data...)
  3609         while ( index != aIapInfo.iCount )
  3613         while ( index != aIapInfo.iCount )
  3610             {
  3614             {
  3611             // Get bearer type
  3615             // Get bearer type
  3612             TMPMBearerType bearerType = EMPMBearerTypeOther;
  3616             TMPMBearerType bearerType = EMPMBearerTypeOther;
  3613             bearerType =
  3617             bearerType =
  3627                 {
  3631                 {
  3628                 // Don't remove this iap
  3632                 // Don't remove this iap
  3629                 index++;
  3633                 index++;
  3630                 continue;
  3634                 continue;
  3631                 }
  3635                 }
       
  3636             else if ( bearerType == EMPMBearerTypeVpn )
       
  3637                 {
       
  3638                 // Don't remove this VPN IAP on this round. 
       
  3639                 // VPN IAPs are filtered after this.
       
  3640                 index++;
       
  3641                 continue;
       
  3642                 }
  3632             else
  3643             else
  3633                 {
  3644                 {
       
  3645                 MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
       
  3646  Filtered IAP ID:%d", aIapInfo.iIap[index].iIapId );
       
  3647  
  3634                 // Remove this iap from the list
  3648                 // Remove this iap from the list
  3635                 for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
  3649                 for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
  3636                     {
  3650                     {
  3637                     aIapInfo.iIap[index2].iIapId = aIapInfo.iIap[index2 + 1].iIapId;
  3651                     aIapInfo.iIap[index2].iIapId = aIapInfo.iIap[index2 + 1].iIapId;
  3638                     }
  3652                     }
  3639                 
  3653                 
  3640                 aIapInfo.iCount--;
  3654                 aIapInfo.iCount--;
  3641                 }
  3655                 }
  3642             }
  3656             }
       
  3657         // Next filter away the VPN IAPs from the remaining IAPs.
       
  3658         // VPN IAP should survive this filter only if it has at least
       
  3659         // one unfiltered physical IAP still available. If it does not
       
  3660         // then it cannot be used to establish connection and should 
       
  3661         // be filtered.
       
  3662         index = 0;
       
  3663         RAvailableIAPList availableIaps; 
       
  3664             
       
  3665         for ( TUint i = 0; i < aIapInfo.iCount; i++ )
       
  3666             {
       
  3667             availableIaps.AppendL( aIapInfo.iIap[i].iIapId );
       
  3668             }
       
  3669         
       
  3670         MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
       
  3671  Starting VPN IAP filtering (iap count: %d)", aIapInfo.iCount );
       
  3672         
       
  3673         while ( index != aIapInfo.iCount )
       
  3674             {
       
  3675             // Get bearer type
       
  3676             TMPMBearerType bearerType = EMPMBearerTypeOther;
       
  3677             TUint32 realIapId( 0 );
       
  3678             bearerType =
       
  3679                 iMyServer.CommsDatAccess()->GetBearerTypeL ( aIapInfo.iIap[index].iIapId );
       
  3680             
       
  3681             if ( bearerType == EMPMBearerTypeVpn )
       
  3682                 {
       
  3683                 iMyServer.CommsDatAccess()->FindRealIapL( aIapInfo.iIap[index].iIapId, 
       
  3684                                                            realIapId, 
       
  3685                                                            availableIaps, 
       
  3686                                                            *this);
       
  3687                 
       
  3688                 MPMLOGSTRING3( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
       
  3689 VPN IAP id: %d, real IAP id: %d", aIapInfo.iIap[index].iIapId, realIapId );
       
  3690                 
       
  3691                 if ( realIapId != 0 )
       
  3692                     {
       
  3693                     // Actual physical IAP was found for this VPN IAP. Do not filter.
       
  3694                     index++;    
       
  3695                     continue;
       
  3696                     }                
       
  3697                 MPMLOGSTRING2( "CMPMServerSession::RemoveIapsAccordingToBearerSetL:\
       
  3698 Filtered away VPN IAP: %d", aIapInfo.iIap[index].iIapId );
       
  3699                 
       
  3700                 // Remove this iap from the list
       
  3701                 for ( TInt index2 = index; index2 < aIapInfo.iCount; index2++ )
       
  3702                     {
       
  3703                     aIapInfo.iIap[index2].iIapId = aIapInfo.iIap[index2 + 1].iIapId;
       
  3704                     }
       
  3705                 
       
  3706                 aIapInfo.iCount--;                               
       
  3707                 }
       
  3708             index++;
       
  3709             }        
  3643         }
  3710         }
  3644     }
  3711     }
  3645 
  3712 
  3646 // -----------------------------------------------------------------------------
  3713 // -----------------------------------------------------------------------------
  3647 // CMPMServerSession::GetAvailableIAPs()
  3714 // CMPMServerSession::GetAvailableIAPs()