bearermanagement/mpm/inc/mpmserversession.h
changeset 0 5a93021fdf25
child 17 c14618f9de99
child 20 9c97ad6591ae
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: MPM server session class definitions
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file mpmserversession.h
       
    20 Mobility Policy Manager server session class definitions.
       
    21 */
       
    22 
       
    23 #ifndef MPMSERVERSESSION_H
       
    24 #define MPMSERVERSESSION_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <e32base.h>
       
    28 #include <commdbconnpref.h> // for TCommDbConnPref
       
    29 #include <connpref.h>       // for TConnPref
       
    30 #include <rconnmon.h>       // for TConnMonIapInfo
       
    31 #include <ConnectionUiUtilities.h> //TMsgQueryLinkedResults
       
    32 #include "rmpm.h"
       
    33 #include "mpmserver.h"
       
    34 
       
    35 // CONSTANTS
       
    36 const TUint32 KLowestPriority       = 2147483647; // 0x7FFFFFFF
       
    37 const TInt    KFirstArgument        = 0;
       
    38 const TInt    KSecondArgument       = 1;
       
    39 const TInt    KThirdArgument        = 2;
       
    40 const TInt    KFourthArgument       = 3;
       
    41 const TInt    KShift8               = 8;
       
    42 const TInt    KSmaller              = -1;
       
    43 const TInt    KEqual                = 0;
       
    44 const TInt    KBigger               = 1;
       
    45 const TUint32 KUidAlwaysOnlineStarter  = 0x101F85EE;
       
    46 const TUint32 KUidSimApplicationToolkit  = 0x1000A833;
       
    47 const TUint32 KUidBrowser           = 0x10008D39;
       
    48 const TUint32 KUidDVBH  = 0x10208413;
       
    49 const TUint32 KSortUncategorisedIaps  = 0;
       
    50 const TUint   KMPMNrWlansOne        = 1;
       
    51 const TUint   KMPMNrWlansTwo        = 2;
       
    52 const TInt    KMaxGetIntSettingLength = KCommsDbSvrMaxColumnNameLength * 2;
       
    53 _LIT( KIapProxyServiceSetting, "IAP\\IAPService" );
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 class CMPMDisconnectDlg;
       
    57 class CMPMConfirmDlgRoaming;
       
    58 class CMPMCommsDatAccess;
       
    59 class CMPMIapSelection;
       
    60 
       
    61 // CLASS DECLARATION
       
    62 /**
       
    63 *  TNetIap
       
    64 *  Record for commdb IAP table search storage
       
    65 *  @lib MPMServer.exe
       
    66 *  @since 3.0
       
    67 */
       
    68 class TNetIap
       
    69     { 
       
    70     public: // Constructors and destructor
       
    71 
       
    72         /**
       
    73         * Constructor.
       
    74         */
       
    75         TNetIap();
       
    76 
       
    77     public: // New methods
       
    78 
       
    79         /**
       
    80         * Ordering method of class objects.
       
    81         * @since 3.2
       
    82         * @param aFirst First object for comparison
       
    83         * @param aSecond Second object for comparison
       
    84         * @return -1 if aFirst.iRanking >  aSecond.iRanking
       
    85         *          1 if aFirst.iRanking <  aSecond.iRanking
       
    86         *          0 if aFirst.iRanking == aSecond.iRanking
       
    87         */
       
    88         static TInt CompareRanking(const TNetIap& aFirst, const TNetIap& aSecond);
       
    89 
       
    90 
       
    91         /**
       
    92         * Ordering method of class objects. Compares iGlobalPriority and if those values 
       
    93         * are equal return value is determined based on iRanking by CompareRanking function.
       
    94         * @since 3.2
       
    95         * @param aFirst First object for comparison
       
    96         * @param aSecond Second object for comparison
       
    97         * @return -1 if aFirst is higher
       
    98         *          1 if aFirst is lower
       
    99         *          0 if argument objects are equal
       
   100         */
       
   101         static TInt CompareGlobalAndLocalPriority(const TNetIap& aFirst, const TNetIap& aSecond);
       
   102 
       
   103     public: // Data
       
   104         // SNAP
       
   105         TUint32 iSnap;
       
   106         
       
   107         // Embedded SNAP
       
   108         TUint32 iEmbeddedSnap;
       
   109         
       
   110         // IAP Id
       
   111         TUint32 iIapId;
       
   112 
       
   113         // Priority
       
   114         TUint32 iRanking;
       
   115 
       
   116         // Global bearer priority
       
   117         TUint32 iGlobalPriority;
       
   118     };
       
   119 
       
   120 /**
       
   121 * Stores data of whether Preferred IAP Notifications may 
       
   122 * be sent immediately and stores IAP information for later handling.
       
   123 * 
       
   124 * @lib MPMServer.exe
       
   125 * @since 3.2
       
   126 */
       
   127 class TStoredIapInfo
       
   128     {
       
   129     public:
       
   130         /**
       
   131         * Constructor.
       
   132         */
       
   133         TStoredIapInfo();
       
   134         
       
   135         /**
       
   136         * Checks if Preferred IAP notification can 
       
   137         * be sent immediately or not
       
   138         *
       
   139         * @return ETrue if preferred IAP notification 
       
   140         * can't be sent immediately
       
   141         */
       
   142         TBool HoldPrefIapNotif() const;
       
   143 
       
   144         /**
       
   145         * Sets iHoldPrefIapNotif to true, so that notifications 
       
   146         * won't be sent.
       
   147         *
       
   148         */
       
   149         void SetHoldPrefIapNotif();
       
   150 
       
   151         /**
       
   152         * Checks if there is stored IAP info to be handled.
       
   153         * Sets iHoldPrefIapNotif to false so notifications can be sent. 
       
   154         *
       
   155         * @param aStoredIapInfo If stored IAP info exists it is 
       
   156         * written to this argument.
       
   157         * @return ETrue if IAP info to be handled exists
       
   158         */
       
   159         TBool HandleIapInfoWaiting( TConnMonIapInfo& aStoredIapInfo );
       
   160 
       
   161         /**
       
   162         * Sets iStoredIapInfo 
       
   163         *
       
   164         * @param aStoredIapInfo IAP info to be stored
       
   165         */
       
   166         void SetStoredIapInfo( const TConnMonIapInfo& aStoredIapInfo );
       
   167 
       
   168         /**
       
   169         * Clears data so that Pref IAP notifs can be sent 
       
   170         * and no IAP info is stored.
       
   171         *
       
   172         */
       
   173         void ResetStoredIapInfo();
       
   174 
       
   175     private:
       
   176     
       
   177         // True if Preferred IAP Notifications 
       
   178 	    // should be stored for later handling
       
   179 	    TBool iHoldPrefIapNotif;
       
   180 	    
       
   181 	    // True if there is an IAP info waiting 
       
   182 	    // for handling
       
   183 	    TBool iIapInfoWaiting;
       
   184 	    
       
   185 	    // Stored IAP info
       
   186 	    TConnMonIapInfo iStoredIapInfo;
       
   187     };
       
   188 
       
   189 // States for migrating
       
   190 //
       
   191 enum TMigrateToCarrierState
       
   192     {
       
   193     EMigrateNone,
       
   194     EMigrateUserConfirmation,
       
   195     EMigrateOfflineConfirmation
       
   196     };
       
   197     
       
   198 // CLASS DECLARATION
       
   199 /**
       
   200 *  Mobility Policy Manager server session.
       
   201 *  An instance of class CMPMServerSession is created for each client
       
   202 *  @lib MPMServer.exe
       
   203 *  @since 3.0
       
   204 */
       
   205 class CMPMServerSession : public CSession2
       
   206     {
       
   207     public: // Constructors and destructor
       
   208 
       
   209         /**
       
   210         * Two-phased constructor.
       
   211         */
       
   212         static CMPMServerSession* NewL(CMPMServer& aServer);
       
   213 
       
   214         /**
       
   215         * Destructor.
       
   216         */
       
   217         virtual ~CMPMServerSession();
       
   218 
       
   219     public: // New methods
       
   220 
       
   221         /**
       
   222         * Sets iDisconnectDlg pointer to NULL.
       
   223         * @since 3.1
       
   224         */
       
   225         inline void SetDisconnectDlgPtrNull();
       
   226 
       
   227         /**
       
   228         * Sets iConfirmDlgRoaming pointer to NULL.
       
   229         * @since 3.2
       
   230         */
       
   231         inline void SetConfirmDlgRoamingPtrNull();
       
   232 
       
   233         /**
       
   234         * Gets the value of iMyServer.
       
   235         * @since 3.1
       
   236         * @return Value of iMyServer
       
   237         */
       
   238         inline CMPMServer& MyServer();
       
   239 
       
   240         /**
       
   241         * Returns iIapSelection.
       
   242         *
       
   243         * @since 3.2
       
   244         * @return Value of iIapSelection
       
   245         */
       
   246         CMPMIapSelection* IapSelectionL();
       
   247 
       
   248         /**
       
   249         * Gets the value of iConnId.
       
   250         * @since 3.1
       
   251         * @return Value of iConnId
       
   252         */
       
   253         inline TConnectionId ConnectionId() const;
       
   254 
       
   255         /**
       
   256         * Checks the need for preferred IAP notification.
       
   257         * @since 3.1
       
   258         * @param aIapInfo Info about available IAPs
       
   259         * @param aCaller Info about component which initiated this call
       
   260         */
       
   261         void PrefIAPNotificationL( const TConnMonIapInfo&    aIapInfo,
       
   262                                    const TPrefIAPNotifCaller aCaller );
       
   263 
       
   264         /**
       
   265         * Starts sending preferred IAP notification.
       
   266         * @since 3.2
       
   267         * @param aIapId IAP Id 
       
   268         */
       
   269         void StartIAPNotificationL( const TUint32 aIapId );
       
   270 
       
   271         /**
       
   272         * Sends Stop IAP notification.
       
   273         * @param aIapId IAP Id 
       
   274         */
       
   275         void StopIAPNotificationL( TInt aIapId = 0 );
       
   276 
       
   277         /**
       
   278         * Sends mobility error notification.
       
   279         * @since 5.2
       
   280         * @param aError Error code
       
   281         */
       
   282         void MobilityErrorNotificationL( TInt aError );
       
   283         
       
   284         /**
       
   285         * Sends client error notification.
       
   286         * @since 5.2
       
   287         * @param aError Error code
       
   288         */
       
   289         void ClientErrorNotificationL( TInt aError );
       
   290 
       
   291         /**
       
   292         * Checks if phone is in offline mode or not.
       
   293         * @since 3.1
       
   294         * @return ETrue if phone is in offline mode, otherwise EFalse.
       
   295         */
       
   296         TBool IsPhoneOfflineL() const;
       
   297 
       
   298         /**
       
   299         * Returns the list of available IAPs, where the blacklisted IAPs 
       
   300         * have already been removed.
       
   301         * @since 3.2
       
   302         * @param aAvailableIAPs List of IAPs 
       
   303         * @param aConnId Connection Id
       
   304         */
       
   305         void AvailableUnblacklistedIapsL( RAvailableIAPList&  aAvailableIAPs,
       
   306                                           const TConnectionId aConnId );
       
   307 
       
   308         /**
       
   309         * Completing sorting request.
       
   310         * @since 3.2
       
   311         */
       
   312         void CompleteServerSortSNAP();
       
   313 
       
   314         /**
       
   315         * Completing process error call after WLAN scan.
       
   316         * @since 3.2
       
   317         */
       
   318         void ProcessErrorWlanScanCompletedL();
       
   319 
       
   320         /**
       
   321         * Sort Snap functionality
       
   322         *
       
   323         * @since 3.2
       
   324         * @param aSnapId Snap to be sorted
       
   325         * @param aSortedIaps Buffer which will be set to 
       
   326         * contain the sorted iaps
       
   327         */
       
   328         void SortSnapL( const TUint32   aSnapId, 
       
   329                         TMpmSnapBuffer& aSortedIaps );
       
   330 
       
   331         /**
       
   332         * If session is displaying connection selection dialog
       
   333         * updated contents for it are written to publish& subscribe API.
       
   334         *
       
   335         * @since 3.2
       
   336         */
       
   337         void UpdateConnectionDialogL();
       
   338 
       
   339         /**
       
   340         * Returns a reference to iStoredIapInfo. 
       
   341         *
       
   342         * @since 3.2
       
   343         * @return Reference to iStoredIapInfo
       
   344         */        
       
   345         inline TStoredIapInfo& StoredIapInfo();
       
   346 
       
   347         /**
       
   348         * Completes carrier rejected request. Attempts to select
       
   349         * new IAP to use and if successful sends a preferred iap
       
   350         * notification. If not successful, sends error notification. 
       
   351         *
       
   352         * @since 3.2
       
   353         */        
       
   354         void CompleteCarrierRejected();
       
   355 
       
   356         /**
       
   357         * Handling of whether it is required to display 
       
   358         * a confirmation dialog or not.
       
   359         * @since 3.2
       
   360         * @param aIapId IAP Id of the connection.
       
   361         */
       
   362         TBool IsConfirmFirstL( const TUint32 aIapId );
       
   363 
       
   364         /**
       
   365         * Completing choose iap request. Status and resulting
       
   366         * preferences (if preferences exist) are passed back to client.
       
   367         * @since 3.2
       
   368         * @param aError Message status
       
   369         * @param aPolicyPref Policy preference to be returned, NULL if no 
       
   370         * preference should be passed
       
   371         */
       
   372         void ChooseIapComplete( TInt                aError,
       
   373                                 const TMpmConnPref* aPolicyPref );
       
   374 
       
   375         /**
       
   376         * Completing process error request. Error value and needed action
       
   377         * are passed back to client.
       
   378         * @since 3.2
       
   379         * @param aError Message status
       
   380         * @param aErrorReturned Error value to be returned, NULL if no 
       
   381         * value should be passed
       
   382         * @param aNeededAction Needed action to be returned, NULL if no 
       
   383         * value should be passed
       
   384         */
       
   385         void ProcessErrorComplete( TInt             aError, 
       
   386                                    TInt*            aErrorReturned,
       
   387                                    TBMNeededAction* aNeededAction );
       
   388 
       
   389         /**
       
   390         * Callback for handling migrate state transitions.
       
   391         *
       
   392         * @param aError Error code
       
   393         */
       
   394         void MigrateCallbackL( TInt aError );
       
   395 
       
   396         /**
       
   397         * Callback for roaming user confirmation.
       
   398         *
       
   399         * @param aError Error code
       
   400         * @param aResponse User response
       
   401         * @param aReconnect True if confirmation was a reconnect dialog
       
   402         */
       
   403         void RoamingConfirmationCompletedL( TInt aError, TMsgQueryLinkedResults aResponse, TBool aReconnect );
       
   404         
       
   405         /**
       
   406          * Set user connection flag
       
   407          * @since 5.1
       
   408          */
       
   409         inline void SetUserConnection();
       
   410         
       
   411         /**
       
   412          * Set when this session has user connection flag set
       
   413          * @since 5.1
       
   414          * @return ETrue if user connection is active in this session.
       
   415          */
       
   416         inline TBool UserConnection() const;
       
   417         
       
   418         /**
       
   419          * Clear user connection flag
       
   420          * @since 5.1
       
   421          */        
       
   422         inline void ClearUserConnection();
       
   423 
       
   424         /**
       
   425          * Use user connection preferences
       
   426          * @since 5.1
       
   427          */
       
   428         TBool UseUserConnPref();
       
   429         
       
   430         /**
       
   431         * Returns id of the client.
       
   432         *
       
   433         * @since 5.0
       
   434         * @return Id of the client
       
   435         */
       
   436         inline TUint32 AppUid() const;
       
   437 
       
   438         /**
       
   439         * To determine whether choose best iap is called for this ession..
       
   440         *
       
   441         * @since 5.2
       
   442         * @return True is choose best iap is called for this session
       
   443         */
       
   444         inline TBool ChooseBestIapCalled() const;
       
   445 
       
   446 #ifdef _DEBUG
       
   447         /**
       
   448          * Forces MPM to send StopIAPNotification in DEBUG MODE only
       
   449          */
       
   450         void HandleDebugGenerateStopIAPNotification( const RMessage2& aMessage );
       
   451         /**
       
   452          * Forces MPM to filter connmon events
       
   453          */
       
   454         void HandleDebugFilterConnMonEvents( const RMessage2& aMessage, const TBool aVal );       
       
   455         /**
       
   456          * Forces MPM to shutdown
       
   457          */
       
   458         void HandleDebugShutdown( const RMessage2& aMessage, const TBool aVal );
       
   459 #endif //_DEBUG
       
   460 
       
   461         /**
       
   462          * Stops connection
       
   463          */                
       
   464         TInt StopConnection();
       
   465         
       
   466         /**
       
   467         * Returns true if preferred iap notification is requested.
       
   468         *
       
   469         * @since 5.2
       
   470         * @return Ture or false depending on state.
       
   471         */
       
   472         inline TBool PreferredIapRequested() const;
       
   473         
       
   474         /**
       
   475         * To determine whether only WLAN is allowed in current network
       
   476         *
       
   477         * @since 5.2
       
   478         * @param aNewWlansAllowed ETrue if new WLANs can be prompted to the user by MPM
       
   479         * @return ETrue if only WLAN is allowed 
       
   480         */
       
   481         TBool IsWlanOnlyL( TBool& aNewWlansAllowed );
       
   482         
       
   483         /**
       
   484         * Returns custom preference's forced roaming value
       
   485         * @since 5.2
       
   486         * @return forced roaming state
       
   487         */
       
   488         TBool ForcedRoaming();
       
   489 
       
   490         /**
       
   491          * Get available iaps
       
   492          * @since 5.2
       
   493          * @return Returns list of available iaps.
       
   494          */
       
   495         TConnMonIapInfo GetAvailableIAPs();
       
   496 
       
   497         /**
       
   498          * Is bearer accepted
       
   499          * @since 5.2
       
   500          * @param aBearerType Bearer type to be checked (WLAN or packet data)
       
   501          * @return Returns true if given bearer is accepted by this session.
       
   502          */
       
   503         TBool IsBearerAccepted( TMPMBearerType aBearerType );
       
   504         
       
   505         /**
       
   506         * To determine whether IAP is used for MMS
       
   507         *
       
   508         * @since 5.2
       
   509         * @param aIap Iap to be checked
       
   510         * @return ETrue if Iap is used for MMS 
       
   511         */
       
   512         TBool IsMMSIap( TUint32 aIap );
       
   513         
       
   514     public: // Functions from base classes
       
   515 
       
   516         /**
       
   517         * From CSession2. Service dispathcer.
       
   518         * @since 3.0
       
   519         * @param aMessage Message from the client
       
   520         */
       
   521         void ServiceL(const RMessage2& aMessage);
       
   522 
       
   523         /**
       
   524         * From CSession2. Service error handling.
       
   525         * @since 3.2
       
   526         * @param aMessage Message from the client
       
   527         * @param aError Error code
       
   528         */
       
   529         void ServiceError(const RMessage2& aMessage, TInt aError);
       
   530 
       
   531     private: // Constructors
       
   532 
       
   533         /**
       
   534         * C++ default constructor.
       
   535         */
       
   536         CMPMServerSession(CMPMServer& aServer);
       
   537 
       
   538         /**
       
   539         * By default Symbian 2nd phase constructor is private.
       
   540         */
       
   541         void ConstructL() ;
       
   542 
       
   543     private: // New methods
       
   544 
       
   545         /**
       
   546         * Handling of IAP selection.
       
   547         * @since 3.0
       
   548         * @param aMessage message from client
       
   549         */
       
   550         void HandleServerChooseIapL(const RMessage2& aMessage);
       
   551 
       
   552         /**
       
   553         * Handling of request canceling.
       
   554         * @since 3.0
       
   555         * @param aMessage message from client
       
   556         */
       
   557         void HandleServerCancelRequest(const RMessage2& aMessage);
       
   558 
       
   559         /**
       
   560         * Handling of BM application specific connection addition.
       
   561         * @since 3.2
       
   562         * @param aMessage message from client
       
   563         */
       
   564         void HandleServerApplicationJoinsConnection( 
       
   565                 const RMessage2& aMessage);
       
   566 
       
   567         /**
       
   568         * Handling of BM application specific connection removal.
       
   569         * @since 3.1
       
   570         * @param aMessage message from client
       
   571         */
       
   572         void HandleServerApplicationLeavesConnection(
       
   573                 const RMessage2& aMessage);
       
   574 
       
   575         /**
       
   576         * Handling of total BM IAP connection addition.
       
   577         * @since 3.2
       
   578         * @param aMessage message from client
       
   579         */
       
   580         void HandleServerIapConnectionActivatedL(const RMessage2& aMessage);
       
   581 
       
   582         /**
       
   583         * Handling of total BM IAP connection addition.
       
   584         * @since 3.2
       
   585         * @param aMessage message from client
       
   586         */
       
   587         void HandleServerIapConnectionStartedL(const RMessage2& aMessage);
       
   588 
       
   589         /**
       
   590         * Handling of total BM IAP connection removal.
       
   591         * @since 3.1
       
   592         * @param aMessage message from client
       
   593         */
       
   594         void HandleServerIapConnectionStopped( const RMessage2& aMessage );
       
   595 
       
   596         /**
       
   597         * Handling of application connection ending.
       
   598         * @since 3.2
       
   599         * @param aMessage message from client
       
   600         */
       
   601         void HandleServerApplicationConnectionEnds(
       
   602                                             const RMessage2& aMessage );
       
   603         /**
       
   604         * Handling of error processing.
       
   605         * @since 3.1
       
   606         * @param aMessage message from client
       
   607         */
       
   608         void HandleServerProcessErrorL(const RMessage2& aMessage);
       
   609 
       
   610         /**
       
   611         * Handling of prefered IAP notification registration.
       
   612         * @since 3.1
       
   613         * @param aMessage message from client
       
   614         */
       
   615         void HandleServerRegisterPrefIAPNotifL(const RMessage2& aMessage);
       
   616 
       
   617         /**
       
   618         * Handling of preferred IAP notification unregistration.
       
   619         * @since 3.1
       
   620         * @param aMessage message from client
       
   621         */
       
   622         void HandleServerUnregisterPrefIAPNotif(const RMessage2& aMessage);
       
   623 
       
   624         /**
       
   625         * Handling of notification request.
       
   626         * @since 3.1
       
   627         * @param aMessage message from client
       
   628         */
       
   629         void HandleServerWaitNotificationL(const RMessage2& aMessage);
       
   630 
       
   631         /**
       
   632         * Handling of sorting request.
       
   633         * @since 3.2
       
   634         * @param aMessage message from client
       
   635         */
       
   636         void HandleServerSortSNAPL(const RMessage2& aMessage);
       
   637 
       
   638         /**
       
   639         * Handling of application migrating to carrier.
       
   640         * @since 3.2
       
   641         * @param aMessage message from client
       
   642         */
       
   643         void HandleServerApplicationMigratesToCarrierL(
       
   644                                                 const RMessage2& aMessage);
       
   645 
       
   646         /**
       
   647         * Handling of application ignoring the carrier.
       
   648         * @since 3.2
       
   649         * @param aMessage message from client
       
   650         */
       
   651         void HandleServerApplicationIgnoredTheCarrier(
       
   652                                                 const RMessage2& aMessage);
       
   653 
       
   654         /**
       
   655         * Handling of application accepting the carrier.
       
   656         * @since 3.2
       
   657         * @param aMessage message from client
       
   658         */
       
   659         void HandleServerApplicationAcceptedTheCarrier(
       
   660                                                 const RMessage2& aMessage);
       
   661 
       
   662         /**
       
   663         * Handling of application rejecting the carrier.
       
   664         * @since 3.2
       
   665         * @param aMessage message from client
       
   666         */
       
   667         void HandleServerApplicationRejectedTheCarrierL(
       
   668                                                 const RMessage2& aMessage);
       
   669 
       
   670         /**
       
   671         * Handling of ReselectBestIap call.
       
   672         * @since 9.1
       
   673         * @param aMessage message from client
       
   674         */
       
   675         void HandleServerReselectIapL( const RMessage2& aMessage);
       
   676 
       
   677         /**
       
   678         * Extracts connection preferences into format suitable for MPM
       
   679         * and validates that connection preferences are valid.
       
   680         * All different type of connection preferences are mapped and
       
   681         * converted into TMpmConnPref.
       
   682         * Only a a single TMpmConnPref is extracted from the given TConnPref.
       
   683         * That is, only one connection attempt is tried and thus only the
       
   684         * first preferences are taken if TCommDbMultiConnPref is provided.
       
   685         * This function also sets connection type which MPM uses later to 
       
   686         * select correct IAP in the requested manner.
       
   687         * @since 3.0
       
   688         * @param aBasePref Connection preferences to be extracted.
       
   689         * @param aMpmConnPref Extracted connection preferences.
       
   690         * @return KErrNone if successful, otherwise one of the
       
   691         * system-wide error codes
       
   692         */
       
   693         TInt ExtractConnPref(
       
   694             const TConnPref& aBasePref,
       
   695             TMpmConnPref& aMpmConnPref ) const;
       
   696 
       
   697         /**
       
   698         * Extracts TCommDBConnPref connection preferences into format suitable
       
   699         * for MPM and validates that connection preferences are valid.
       
   700         * @since 3.0
       
   701         * @param aBasePref TCommDBConnPref connection preferences.
       
   702         * @param aMpmConnPref Extracted connection preferences.
       
   703         * @return KErrNone if successful, otherwise KErrArgument.
       
   704         */
       
   705         TInt ExtractConnPrefCommDb(
       
   706             const TConnPref& aBasePref,
       
   707             TMpmConnPref& aMpmConnPref ) const;
       
   708 
       
   709         /**
       
   710         * Extracts TCommDbMultiConnPref connection preferences into format
       
   711         * suitable for MPM and validates that connection preferences are
       
   712         * valid.
       
   713         * @since 3.0
       
   714         * @param aBasePref TCommDbMultiConnPref connection preferences.
       
   715         * @param aMpmConnPref Extracted connection preferences.
       
   716         * @return KErrNone if successful, otherwise KErrArgument.
       
   717         */
       
   718         TInt ExtractConnPrefCommDbMulti(
       
   719             const TConnPref& aBasePref,
       
   720             TMpmConnPref& aMpmConnPref ) const;
       
   721 
       
   722         /**
       
   723         * Extracts TConnSnapPref connection preferences into format suitable
       
   724         * for MPM and validates that connection preferences are valid.
       
   725         * @since 3.0
       
   726         * @param aBasePref TConnSnapPref connection preferences.
       
   727         * @param aMpmConnPref Extracted connection preferences.
       
   728         * @return KErrNone if successful, otherwise one of the
       
   729         *         system-wide error codes.
       
   730         */
       
   731         TInt ExtractConnPrefSnap(
       
   732             const TConnPref& aBasePref,
       
   733             TMpmConnPref& aMpmConnPref ) const;
       
   734 
       
   735         /**
       
   736         * Extracts TMpmConnPref connection preferences into format suitable
       
   737         * for MPM and validates that connection preferences are valid.
       
   738         * It's obvious that aBasePref is already in right format.
       
   739         * This function, however, fills in some of the extra field not
       
   740         * existing in TExtendedConnPref and validates preferences.
       
   741         * @since 5.2
       
   742         * @param aBasePref TMpmConnPref connection preferences.
       
   743         * @param aMpmConnPref MPM connection preferences.
       
   744         * @param KErrNone in success, otherwise one of the
       
   745         *         system-wide error codes.
       
   746         */
       
   747         TInt ExtractConnPrefMpm(
       
   748             const TConnPref& aBasePref,
       
   749             TMpmConnPref& aMpmConnPref ) const;
       
   750 
       
   751         /**
       
   752         * Validates extended connection preferences.
       
   753         * Although the input for this function is TMpmConnPref,
       
   754         * the purpose of this function is to verify TExtendedConnPref
       
   755         * into which TMpmConnPref object's first fields match exactly.
       
   756         * @since 5.2
       
   757         * @param aMpmConnPref Custom preferences to be validated.
       
   758         * @return KErrNone if extended connection preferences are valid.
       
   759         *         Otherwise KErrArgument.
       
   760         */
       
   761         TInt ValidateExtendedConnPref( TMpmConnPref& aMpmConnPref ) const;
       
   762 
       
   763         /**
       
   764         * Resolves connection type based on the other attributes
       
   765         * in MPM connection preferences.
       
   766         * @since 3.0
       
   767         * @param aMpmConnPref Extracted connection preferences.
       
   768         */
       
   769         void ResolveConnType( TMpmConnPref& aMpmConnPref ) const;
       
   770 
       
   771         /**
       
   772         * Resolves original Service Id.
       
   773         * @since 5.2
       
   774         * @return The found service id. KErrNotFound if not ok.
       
   775         */
       
   776         TInt GetServiceIdSettingL();
       
   777 
       
   778         /**
       
   779         * Returns the list of available IAPs, where the blacklisted IAPs 
       
   780         * have already been removed.
       
   781         * @since 3.2
       
   782         * @param aAvailableIAPs List of IAPs 
       
   783         * @param aIapInfo Info about available IAPs
       
   784         * @param aConnId Connection Id
       
   785         */
       
   786         void AvailableUnblacklistedIapsL( RAvailableIAPList&        aAvailableIAPs,
       
   787                                           const TConnMonIapInfo&    aIapInfo, 
       
   788                                           const TConnectionId       aConnId );
       
   789 
       
   790         /**
       
   791         * Checks if the given Iap Id is an upgrade or downgrade.
       
   792         * @since 3.2
       
   793         * @param aIapId Given Iap Id 
       
   794         * @param aMigrateIapId Iap Id where application is roaming 
       
   795         * @param aAvailableIAPs List of IAPs 
       
   796         * return ETrue if upgrade, otherwise EFalse.
       
   797         */
       
   798         TBool IsUpgrade( const TUint32            aIapId, 
       
   799                          const TUint32            aMigrateIapId,
       
   800                          const RAvailableIAPList& aAvailableIAPs ) const;
       
   801 
       
   802         /**
       
   803         * Checks if there is a need to send preferred IAP notification.
       
   804         * @since 3.2
       
   805         * @param aCurrentIap Current Iap Id of connection
       
   806         * @param aLastNotifiedIap Last notified Iap Id
       
   807         * @param aValidatedIap Iap validated by MPM for roaming
       
   808         * @return ETrue if necessary, otherwise EFalse.
       
   809         */
       
   810         TBool CheckNotifNeed( const TUint32       aCurrentIap,
       
   811                               const TUint32       aLastNotifiedIap,
       
   812                               const TUint32       aValidatedIap );
       
   813 
       
   814         /**
       
   815         * Returns the list of unavailable IAPs.
       
   816         * @since 3.2
       
   817         * @param aAvailableIAPs Array of available IAPs
       
   818         * @param aUnavailableIAPs Array of unavailable IAPs
       
   819         */
       
   820         void UnavailableIAPsL( const RAvailableIAPList aAvailableIAPs, 
       
   821                                RAvailableIAPList&      aUnavailableIAPs );
       
   822 
       
   823         /**
       
   824         * Removes unavailable IAP Id.
       
   825         * @since 3.2
       
   826         * @param aIapInfo Info about available IAPs 
       
   827         * @param aIapId IAP Id to be removed
       
   828         */
       
   829         void RemoveUnavailableIap( TConnMonIapInfo& aIapInfo, 
       
   830                                    const TUint32    aIapId );
       
   831 
       
   832         /**
       
   833         * Determines whether the process uid belongs 
       
   834         * to a background application.
       
   835         * @since 3.2
       
   836         * @param aUid Application Uid
       
   837         */
       
   838         TBool IsBackgroundApplication( TUint32 aUid ) const;
       
   839 
       
   840         /**
       
   841         * Checks if disconnect dialog should be displayed for this error
       
   842         * @since 3.2
       
   843         * @param aError Error code
       
   844         */
       
   845         TBool DisconnectDlgErrorCode( TInt aError ) const;
       
   846         
       
   847         /**
       
   848         * Gets presumed Iap Id of this connection
       
   849         *
       
   850         * @since 3.2
       
   851         * @return Presumed Iap Id
       
   852         */
       
   853         TUint32 GetPresumedIap();
       
   854 
       
   855         /**
       
   856         * Finshing migration. If no error, updates BM pref iap structure 
       
   857         * and sends start iap notification.
       
   858         *
       
   859         * @param aError KErrNone if migration was succesful
       
   860         */
       
   861         void MigrateDoneL( TInt aError );
       
   862         
       
   863         /**
       
   864         * Sends error notification.
       
   865         * @since 5.2
       
   866         * @param aNotificationType Type of the notification
       
   867         * @param aError Error code
       
   868         */
       
   869         void ErrorNotificationL( TInt aError,
       
   870                                  TMpmNotifications aNotificationType );
       
   871         
       
   872         /**
       
   873          * Removes iaps not according to bearer set
       
   874          * @since 5.2
       
   875          * @param aAvailableIAPs List of available iaps.
       
   876          */
       
   877         void RemoveIapsAccordingToBearerSetL( TConnMonIapInfo& aAvailableIAPs );
       
   878 		
       
   879         /**
       
   880          * Checks whether preferences allow using WLAN connection
       
   881          * @since 5.2
       
   882          * @return ETrue if preferences allow WLAN otherwise EFalse
       
   883          */
       
   884         TBool PrefsAllowWlan();
       
   885 
       
   886     private: // Data
       
   887     
       
   888         // Server class reference
       
   889         CMPMServer& iMyServer;
       
   890 
       
   891         // Pointer to the disconnect dialog active object
       
   892         CMPMDisconnectDlg* iDisconnectDlg;
       
   893 
       
   894         // Pointer to the roaming confirmation dialog active object
       
   895         CMPMConfirmDlgRoaming* iConfirmDlgRoaming;
       
   896 
       
   897         // Connection Id
       
   898         TConnectionId iConnId;
       
   899 
       
   900         // Flag for notification request activity
       
   901         TBool iNotifRequested;
       
   902         
       
   903         // Flag for indicating mobility API support.
       
   904         TBool iPreferredIAPRequested;
       
   905 
       
   906         // Notification message
       
   907         RMessage2 iNotifMessage;
       
   908 
       
   909         // If offline feature is supported then this is ETrue
       
   910         TBool iOfflineFeatureSupported;
       
   911 
       
   912         // Iap Id of Easy WLAN
       
   913         TUint32 iEasyWlanIap;
       
   914 
       
   915         // Uid of the application
       
   916         TUint32 iAppUid;
       
   917 
       
   918         // Choose iap request message to be completed when 
       
   919         // once MPM has received the asyncronous services from 
       
   920         // other servers
       
   921         // 
       
   922         RMessage2 iChooseIapMessage;
       
   923 
       
   924         // Process error request message to be completed when 
       
   925         // MPM has received the asyncronous services from 
       
   926         // other servers
       
   927         //
       
   928         // These messages are stored separately 
       
   929         // 
       
   930         RMessage2 iProcessErrorMessage;
       
   931 
       
   932         // ServerSortSNAPL() request message to be completed  
       
   933         // when MPM has received the asyncronous services 
       
   934         // from other servers
       
   935         //
       
   936         RMessage2 iServerSortSNAPMessage;
       
   937       
       
   938         // Contains state info whether PrefIapnotifs can be sent 
       
   939         // and saved IAP info structure.
       
   940         //
       
   941         TStoredIapInfo iStoredIapInfo;
       
   942             
       
   943         // Iap selection object
       
   944         //    
       
   945         CMPMIapSelection* iIapSelection;
       
   946 
       
   947 		// Stored state of migrating to carrier
       
   948 		// 
       
   949 		TMigrateToCarrierState iMigrateState;
       
   950 
       
   951 		// Last Iap notified using PreferredIap-notification
       
   952 		//
       
   953 		TUint32 iLastNotifiedIap;
       
   954 		
       
   955 		// Iap to which connection is migrating
       
   956         //
       
   957         TUint32 iMigrateIap;
       
   958 
       
   959         // Set when this session is user connection
       
   960 		//
       
   961         TBool iUserConnection;
       
   962     };
       
   963 
       
   964 #include "mpmserversession.inl"
       
   965     
       
   966 #endif // MPMSERVERSESSION_H
       
   967 
       
   968 // End of File