bearermanagement/mpm/inc/rmpm.h
changeset 0 5a93021fdf25
child 14 7958d42f9d1a
child 20 9c97ad6591ae
child 57 05bc53fe583b
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: This header defines the client API for MPM server
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @file rmpm.h
       
    20 Mobility Policy Manager server client interface definitions.
       
    21 */
       
    22 
       
    23 #ifndef RMPM_H
       
    24 #define RMPM_H
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 #include <e32std.h>
       
    29 #include <wlanmgmtcommon.h> // TWlanSsid
       
    30 #include <e32property.h>    //publish and subscribe
       
    31 #include <cmmanagerdef.h>
       
    32 #include <extendedconnpref.h>
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 // CONSTANTS
       
    37 // Number of pointers allocated for client-server inter-thread reads/writes
       
    38 const TUint KNumPtrs = 8;
       
    39 // Event buffer, adjust size to the proper value
       
    40 const TUint KMpmMessageLength   = 512;
       
    41 const TUint KMpmMaxIAPCount     = 25;
       
    42 
       
    43 // Definitions for Reading/Writing sort snap data 
       
    44 // to publish and subscribe API
       
    45 //
       
    46 // UID of the category
       
    47 const TUid KMPMSortSnapCategory = { 0x101f6d3a };
       
    48 
       
    49 // Property type. Each key contains binary data in 
       
    50 // TMpmSnapPubSubFormat format
       
    51 const TInt KMPMSortSnapType = RProperty::EByteArray;
       
    52 
       
    53 // Maximum property key value. Key values start from 0.
       
    54 // MPM will always write data at least for uncategorised 
       
    55 // entry (iap list may be empty). 
       
    56 const TInt KMPMSortSnapMaxKey = 25;
       
    57 
       
    58 // Read policy, no capabilities required
       
    59 // This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
       
    60 // produces pclint warnings
       
    61 _LIT_SECURITY_POLICY_C1( KMPMSortSnapReadPolicy, ECapability_None );
       
    62 
       
    63 // Write policy
       
    64 _LIT_SECURITY_POLICY_C1( KMPMSortSnapWritePolicy, ECapabilityNetworkControl );
       
    65 
       
    66 // Definitions for Reading/Writing user connection data
       
    67 // to publish and subscribe API
       
    68 //
       
    69 // UID of the category (note that uid is the same as sort snap category)
       
    70 const TUid KMPMUserConnectionCategory = { 0x101f6d3a };
       
    71 
       
    72 // Keys for this category
       
    73 const TUint KMPMPSKeyUserConnectionSnap = 10001;
       
    74 const TUint KMPMPSKeyUserConnectionIap = 10002;
       
    75 
       
    76 // Property types
       
    77 const TInt KMPMUserConnectionSnapType = RProperty::EInt;
       
    78 const TInt KMPMUserConnectionIapType = RProperty::EInt;
       
    79 
       
    80 // Read policy, no capabilities required
       
    81 // This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
       
    82 // produces pclint warnings
       
    83 _LIT_SECURITY_POLICY_C1( KMPMUserConnectionReadPolicy, ECapability_None );
       
    84 
       
    85 // Write policy
       
    86 _LIT_SECURITY_POLICY_C1( KMPMUserConnectionWritePolicy, ECapabilityNetworkControl );
       
    87 
       
    88 // Definitions for Reading/Writing active connection data 
       
    89 // to publish and subscribe API
       
    90 //
       
    91 // UID of the category
       
    92 const TUid KMPMActiveConnectionCategory = { 0x101f6d3a };
       
    93 
       
    94 // Property types
       
    95 const TInt KMPMActiveConnectionIapType = RProperty::EInt;
       
    96 const TInt KMPMActiveConnectionSnapType = RProperty::EInt;
       
    97 const TInt KMPMActiveConnectionBearerType = RProperty::EInt;
       
    98 
       
    99 // Keys for active connection category
       
   100 
       
   101 /**
       
   102  * Iap Id of the active connection.
       
   103  * If set to zero then no active connection
       
   104  */
       
   105 const TUint KMPMPSKeyActiveConnectionIap = 10003;
       
   106 
       
   107 /**
       
   108  * Snap Id of the active connection.
       
   109  * If set to zero then possible iap connection
       
   110  */
       
   111 const TUint KMPMPSKeyActiveConnectionSnap = 10004;
       
   112 
       
   113 /**
       
   114  * Possible values:
       
   115  * 0,
       
   116  * KCommDbBearerVirtual,
       
   117  * KCommDbBearerWLAN,
       
   118  * KCommDbBearerWcdma,
       
   119  * KCommDbBearerUnknown,
       
   120  */
       
   121 const TUint KMPMPSKeyActiveConnectionBearer = 10005;
       
   122 
       
   123 // Read policy, no capabilities required
       
   124 // This format is used instead of _LIT_SECURITY_POLICY_PASS, which 
       
   125 // produces pclint warnings
       
   126 _LIT_SECURITY_POLICY_C1( KMPMActiveConnectionReadPolicy, ECapability_None );
       
   127 
       
   128 // Write policy
       
   129 _LIT_SECURITY_POLICY_C1( KMPMActiveConnectionWritePolicy, ECapabilityNetworkControl );
       
   130 
       
   131 // MACROS
       
   132 _LIT( KPanicCategory, "MPM Client" );
       
   133 
       
   134 // DATA TYPES
       
   135 typedef RArray<TUint32>             RAvailableIAPList;
       
   136 typedef TBuf8<KMpmMessageLength>    TMPMMessageBuffer;
       
   137 typedef TUint32                     TConnectionId;
       
   138 
       
   139 // Notification codes
       
   140 enum TMpmNotifications
       
   141     {
       
   142     EMPMNotificationNone = 0, // NOP
       
   143     EMPMPreferredIAPAvailable,
       
   144     EMPMMobilityErrorNotification,
       
   145     EMPMClientErrorNotification,
       
   146     EMPMStartIAPNotification,
       
   147     EMPMStopIAPNotification
       
   148     };
       
   149 
       
   150 // Asynchronous codes
       
   151 enum TMpmAsynchCodes
       
   152     {
       
   153     EMPMChooseBestIAP = 1,
       
   154     EMPMReselectBestIAP,
       
   155     EMPMProcessError,
       
   156     EMPMWaitNotification,
       
   157     EMPMSortSNAP,
       
   158 #ifdef _DEBUG
       
   159     EMPMDebugGenerateStopIAPNotification = 500,
       
   160     EMPMDebugSwitchConnMonEventsOn = 501,
       
   161     EMPMDebugSwitchConnMonEventsOff = 502,
       
   162     EMPMDebugShutdown = 503,
       
   163 #endif
       
   164     };
       
   165 
       
   166 enum TBMNeededAction
       
   167     {
       
   168     EIgnoreError = 0,
       
   169     EPropagateError,
       
   170     EDoReselection
       
   171     };
       
   172 
       
   173 // CLASS DECLARATION
       
   174 /**
       
   175 *  Contains the sorted list of IAPs belonging to the specified SNAP. 
       
   176 *  Used by method SortSNAP.
       
   177 *
       
   178 *  @since 3.2
       
   179 */
       
   180 NONSHARABLE_CLASS( TMpmSnapBuffer )
       
   181     {
       
   182     public:
       
   183         // Zero values 
       
   184         inline void Reset();    
       
   185         inline const TInt Count() const;
       
   186 
       
   187     public:
       
   188         TUint   iCount;
       
   189         TUint32 iIapId[KMpmMaxIAPCount];
       
   190     };
       
   191 
       
   192 // CLASS DECLARATION
       
   193 /**
       
   194 *  Contains the sorted list of IAPs belonging to the specified SNAP. 
       
   195 *  Used by method SortSNAP.
       
   196 *
       
   197 *  @since 3.2
       
   198 */
       
   199 NONSHARABLE_CLASS( TMpmSnapPubSubFormat )
       
   200     {
       
   201     public:
       
   202         // Snap id. 0 is used for uncategorised
       
   203         TUint32           iSnap;
       
   204         // Iap ids
       
   205         TMpmSnapBuffer  iSortedIaps;
       
   206     };
       
   207             
       
   208 // CLASS DECLARATION
       
   209 /**
       
   210 *  Helper class.
       
   211 *
       
   212 *  @since 3.2
       
   213 */
       
   214 NONSHARABLE_CLASS( TStartIAPNotifInfo )
       
   215     {
       
   216     public:
       
   217         // Zero values 
       
   218         inline void Reset();    
       
   219     public:
       
   220         TUint32         iIap;
       
   221         TConnectionId   iConnId; // useless
       
   222         TUint32         iServiceId;
       
   223     };
       
   224     
       
   225 // CLASS DECLARATION
       
   226 /**
       
   227 *  Helper class.
       
   228 *
       
   229 *  @since 3.2
       
   230 */
       
   231 NONSHARABLE_CLASS( TStopIAPNotifInfo )
       
   232     {
       
   233     public:
       
   234         // Zero values 
       
   235         inline void Reset();    
       
   236     public:
       
   237         TUint32         iIap;
       
   238         TConnectionId   iConnId;
       
   239     };
       
   240     
       
   241 // CLASS DECLARATION
       
   242 /**
       
   243 *  Helper class.
       
   244 *
       
   245 *  @since 3.1
       
   246 */
       
   247 NONSHARABLE_CLASS( TMpmNotification )
       
   248     {
       
   249     public:
       
   250         TMpmNotifications iMPMNotificationType;
       
   251         virtual TInt Length() = 0;
       
   252     };
       
   253 
       
   254 // CLASS DECLARATION
       
   255 /**
       
   256 *  Helper class.
       
   257 *
       
   258 *  @since 3.1
       
   259 */
       
   260 NONSHARABLE_CLASS( TMpmNotificationPrefIAPAvailable ) : 
       
   261     public TMpmNotification
       
   262     {
       
   263     public:
       
   264         inline TInt Length();
       
   265 
       
   266     public:
       
   267         TUint32      iOldIapId;
       
   268         TUint32      iNewIapId;
       
   269         TBool        iIsUpgrade;
       
   270         TBool        iIsSeamless;
       
   271         TUint32      iConnId;
       
   272     };
       
   273     
       
   274 // CLASS DECLARATION
       
   275 /**
       
   276 *  Helper class.
       
   277 *
       
   278 *  @since 3.2
       
   279 */
       
   280 NONSHARABLE_CLASS( TMpmNotificationError ) : public TMpmNotification
       
   281     {
       
   282     public:
       
   283         inline TInt Length();
       
   284 
       
   285     public:
       
   286         TInt    iError;
       
   287         TUint32 iConnId;
       
   288     };
       
   289     
       
   290 
       
   291 // CLASS DECLARATION
       
   292 /**
       
   293 *  Helper class.
       
   294 *
       
   295 *  @since 3.2
       
   296 */
       
   297 NONSHARABLE_CLASS( TMpmNotificationStartIAP ) : public TMpmNotification
       
   298     {
       
   299     public:
       
   300         inline TInt Length();
       
   301     public:
       
   302         TStartIAPNotifInfo iInfo;
       
   303     };
       
   304     
       
   305 // CLASS DECLARATION
       
   306 /**
       
   307 *  Helper class.
       
   308 *
       
   309 *  @since 3.2
       
   310 */
       
   311 NONSHARABLE_CLASS( TMpmNotificationStopIAP ) : public TMpmNotification
       
   312     {
       
   313     public:
       
   314         inline TInt Length();
       
   315     public:
       
   316         TStopIAPNotifInfo iInfo;
       
   317     };
       
   318 
       
   319 // CLASS DECLARATION
       
   320 /**
       
   321 *  ChooseBestIAPPolicyResponse
       
   322 *  Identical in size with the TConnPref but contains different fields
       
   323 *  
       
   324 *  @since 5.2
       
   325 */
       
   326 struct SPolicyConnPref
       
   327     {
       
   328     TUint32 iIapId;
       
   329     TUint32 iNetId;
       
   330     TUint32 iSnapAPId;
       
   331     TUint32 iServiceId; // Is the original IAP's Service ID
       
   332     };
       
   333 
       
   334 NONSHARABLE_CLASS( TPolicyConnPref ) : public TConnPref
       
   335     {
       
   336 protected:
       
   337     inline SPolicyConnPref* PrefPtr() const {
       
   338     return reinterpret_cast<SPolicyConnPref*>(UserPtr());
       
   339     }
       
   340     
       
   341 public:
       
   342     enum { EConnS60PolicyPref = 0x0f }; // TConnPref has defined up to 0x07.
       
   343     inline TPolicyConnPref::TPolicyConnPref()
       
   344     : TConnPref( TPolicyConnPref::EConnS60PolicyPref )
       
   345         {
       
   346         SetIapId( 0 );
       
   347         SetNetId( 0 );
       
   348         SetSnapAPId( 0 );
       
   349         SetServiceId( 0 );
       
   350         }
       
   351 
       
   352 public:
       
   353     inline void SetIapId( TUint32 aIapId ) { PrefPtr()->iIapId = aIapId; };
       
   354     inline TUint32 IapId() const { return PrefPtr()->iIapId; };
       
   355 
       
   356     inline void SetNetId( TUint32 aNetId ) { PrefPtr()->iNetId = aNetId; };
       
   357     inline TUint32 NetId() const { return PrefPtr()->iNetId; };
       
   358 
       
   359     inline void SetSnapAPId( TUint32 aSnapAPId ) { PrefPtr()->iSnapAPId = aSnapAPId; };
       
   360     inline TUint32 SnapAPId() const { return PrefPtr()->iSnapAPId; };
       
   361 
       
   362     inline void SetServiceId( TUint32 aServiceId ) { PrefPtr()->iServiceId = aServiceId; };
       
   363     inline TUint32 ServiceId() const { return PrefPtr()->iServiceId; };
       
   364     };
       
   365     
       
   366 // CLASS DECLARATION
       
   367 /**
       
   368 *  ChooseBestIAPPolicyResponse
       
   369 *  Identical in size with the TConnPref but contains different fields
       
   370 *  
       
   371 *  @since 5.2
       
   372 */
       
   373 struct SMpmConnPref
       
   374     {
       
   375     /** SNAP purpose. */
       
   376     CMManager::TSnapPurpose iSnapPurpose;
       
   377     /** SNAP id. */
       
   378     TUint32 iSnapId;
       
   379     /** IAP id. */
       
   380     TUint32 iIapId;
       
   381     /** Bearer set. */
       
   382     TUint32 iBearerSet;
       
   383     /** UI behaviour. */
       
   384     TUint32 iNoteBehaviour;
       
   385     /** Indicates whether UI disconnect dialog is shown. */
       
   386     TBool iDisconnectDialog;
       
   387     /** Indicates whether UI connection selection dialog is shown. */    
       
   388     TBool iConnSelectionDialog;
       
   389     /** Indicates whether forced roaming is enabled. */
       
   390     TBool iForcedRoaming;
       
   391     
       
   392     // The following variables are used for internal functionality of the MPM.
       
   393     // Client should not set these but leave it to MPM to fullfil them based
       
   394     // on the above variables.
       
   395 
       
   396     /**
       
   397      * Connection type that has been requested from the MPM. This is used
       
   398      * internally by MPM to select correct IAP in the requested manner.
       
   399      */
       
   400     TUint32 iConnType;
       
   401     
       
   402     /**
       
   403      * Indicates whether the given IAP is forced to be used or whether other
       
   404      * IAPs can be used. IAP is set to "mandated" when IAP id is given
       
   405      * through TMpmConnPref (meaning it was given as TExtendedConnPref
       
   406      * to RConnection::Start()). Otherwise IAP is not mandated
       
   407      * because in the old way existing connection was allowed to be
       
   408      * taken into use whenever an IAP was given.
       
   409      */
       
   410     TBool iMandateIap;
       
   411 
       
   412     /**
       
   413      * Access network id. Notice that this field always contains the access
       
   414      * network id and this is not mixed with SNAP id into the same field as
       
   415      * it used to be. SNAP id is in its own field. 
       
   416      */
       
   417     TUint32 iNetId;
       
   418     };
       
   419 
       
   420 NONSHARABLE_CLASS( TMpmConnPref ) : public TConnPref
       
   421     {
       
   422     
       
   423 protected:
       
   424     inline SMpmConnPref* PrefPtr() const {
       
   425         return reinterpret_cast< SMpmConnPref* >( UserPtr() );
       
   426     }
       
   427 
       
   428 public:
       
   429     /**
       
   430      * Extension id for MPM connection preferences.
       
   431      * All connection preferences derived from TConnPref has an extension id. 
       
   432      * TConnPref has defined up to 0x07 and TPolicyconnPref has 0x0f.
       
   433      */
       
   434     enum { EConnPrefMpm = 0x0e };
       
   435 
       
   436     /**
       
   437      * Connection type that has been requested from the MPM.
       
   438      * This is used internally by MPM to select correct IAP
       
   439      * in the requested manner.
       
   440      */
       
   441     enum EConnType {
       
   442         /**
       
   443          * Default connection is requested, that is, nobody requests
       
   444          * specification connection.
       
   445          */
       
   446         EConnTypeDefault = 0,
       
   447         /**
       
   448          * User selects the connection by utilizing Connection Selection
       
   449          * Dialog.
       
   450          */
       
   451         EConnTypeImplicit,
       
   452         /**
       
   453          * Client selects the connection by passing it via connection
       
   454          * preferences.
       
   455          */
       
   456         EConnTypeExplicit
       
   457     };
       
   458     
       
   459     inline TMpmConnPref::TMpmConnPref()
       
   460     : TConnPref( TMpmConnPref::EConnPrefMpm )
       
   461         {
       
   462         SetSnapPurpose( CMManager::ESnapPurposeUnknown );
       
   463         SetSnapId( 0 );
       
   464         SetIapId( 0 );
       
   465         SetBearerSet( TExtendedConnPref::EExtendedConnBearerUnknown );
       
   466         SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourDefault );
       
   467         SetDisconnectDialog( ETrue );
       
   468         SetConnSelectionDialog( EFalse );
       
   469         SetForcedRoaming( ETrue );
       
   470         SetConnType( EConnTypeDefault );
       
   471         SetMandateIap( EFalse );
       
   472         SetNetId( 0 );
       
   473         }
       
   474 
       
   475 public:
       
   476     inline void SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose ) { PrefPtr()->iSnapPurpose = aSnapPurpose; };
       
   477     inline CMManager::TSnapPurpose SnapPurpose() const { return PrefPtr()->iSnapPurpose; };
       
   478 
       
   479     inline void SetSnapId( TUint32 aSnapId ) { PrefPtr()->iSnapId = aSnapId; };
       
   480     inline TUint32 SnapId() const { return PrefPtr()->iSnapId; };
       
   481 
       
   482     inline void SetIapId( TUint32 aIapId ) { PrefPtr()->iIapId = aIapId; };
       
   483     inline TUint32 IapId() const { return PrefPtr()->iIapId; };
       
   484 
       
   485     inline void SetBearerSet( TUint32 aBearerSet ) { PrefPtr()->iBearerSet = aBearerSet; };
       
   486     inline TUint32 BearerSet() const { return PrefPtr()->iBearerSet; };
       
   487     
       
   488     inline void SetNoteBehaviour( TUint32 aNoteBehaviour ) { PrefPtr()->iNoteBehaviour = aNoteBehaviour; };
       
   489     inline TUint32 NoteBehaviour() const { return PrefPtr()->iNoteBehaviour; };
       
   490 
       
   491     inline void SetDisconnectDialog( TBool aDisconnectDialog ) { PrefPtr()->iDisconnectDialog = aDisconnectDialog; };
       
   492     inline TBool DisconnectDialog() const { return PrefPtr()->iDisconnectDialog; };
       
   493     
       
   494     inline void SetConnSelectionDialog( TBool aConnSelectionDialog ) { PrefPtr()->iConnSelectionDialog = aConnSelectionDialog; };
       
   495     inline TBool ConnSelectionDialog() const { return PrefPtr()->iConnSelectionDialog; };
       
   496 
       
   497     inline void SetForcedRoaming( TBool aForcedRoaming ) { PrefPtr()->iForcedRoaming = aForcedRoaming; };
       
   498     inline TBool ForcedRoaming() const { return PrefPtr()->iForcedRoaming; };
       
   499 
       
   500     inline void SetConnType( TMpmConnPref::EConnType aConnType ) { PrefPtr()->iConnType = (TUint32)aConnType; };
       
   501     inline TMpmConnPref::EConnType ConnType() const { return (TMpmConnPref::EConnType)PrefPtr()->iConnType; };
       
   502 
       
   503     inline void SetMandateIap( TBool aMandateIap ) { PrefPtr()->iMandateIap = aMandateIap; };
       
   504     inline TBool MandateIap() const { return PrefPtr()->iMandateIap; };
       
   505 
       
   506     inline void SetNetId( TUint32 aNetId ) { PrefPtr()->iNetId = aNetId; };
       
   507     inline TUint32 NetId() const { return PrefPtr()->iNetId; };
       
   508     };
       
   509 
       
   510 // CLASS DECLARATION
       
   511 /**
       
   512 *  Mobility Policy Manager server client interface.
       
   513 *
       
   514 *  @lib RMPM.lib
       
   515 *  @since 3.0
       
   516 */
       
   517 class RMPM : public RSessionBase
       
   518     {
       
   519     public:   // Constructor
       
   520 
       
   521         inline RMPM() : RSessionBase(), iConnected( EFalse ),
       
   522                         iPtrArray(), iIndex( 0 ) {};
       
   523 
       
   524     public: // New functions
       
   525  
       
   526         /**
       
   527          * Deprecated, doesn't do anything
       
   528          * @since 3.0
       
   529          * @return KErrNone
       
   530          */
       
   531         IMPORT_C TInt LaunchServer();
       
   532 
       
   533         /**
       
   534         * Connects client to a server session. It must be called
       
   535         * before using other session specific methods.
       
   536         * @since 3.0
       
   537         * @return KErrNone if successful, otherwise one of the
       
   538         * system-wide error codes
       
   539         */
       
   540         IMPORT_C TInt Connect();
       
   541 
       
   542         /**
       
   543         * Queries whether MPM is connected.
       
   544         * @since 5.2
       
   545         * @return ETrue if connected
       
   546         */
       
   547         IMPORT_C TBool Connected();
       
   548 
       
   549         /**
       
   550         * Connects client to a server session. It must be called
       
   551         * before using other session specific methods.
       
   552         * @since 5.2
       
   553         * @return KErrNone if successful, otherwise one of the
       
   554         * system-wide error codes
       
   555         */
       
   556         IMPORT_C void Connect( TRequestStatus& aStatus );
       
   557 
       
   558         /**
       
   559         * Returns MPM server version.
       
   560         * @since 3.0
       
   561         * @return Version of the MPM server
       
   562         */
       
   563         IMPORT_C TVersion Version() const;
       
   564 
       
   565         /**
       
   566         * Cancels asynchronous request. In the risk of deadlock use the SendCancelRequest()
       
   567         * @since 3.1
       
   568         * @param aReqToCancel request to be canceled
       
   569         */
       
   570         IMPORT_C void Cancel( TMpmAsynchCodes aReqToCancel ) const;
       
   571 
       
   572         /**
       
   573         * Asynchronous cancellation
       
   574         * @since 5.2
       
   575         * @param aReqToCancel request to be canceled
       
   576         * @return KErrNone if cancel message sending was successful, otherwise one of the
       
   577         * system-wide error codes
       
   578         */
       
   579         IMPORT_C TInt SendCancelRequest( TMpmAsynchCodes aReqToCancel ) const;
       
   580 
       
   581         /**
       
   582         * Closes MPM server session.
       
   583         * @since 3.0
       
   584         */        
       
   585         IMPORT_C void Close();
       
   586         
       
   587         /**
       
   588         * Initial select of the most prefered IAP for the connection.
       
   589         * @since 3.1
       
   590         * @param aConnPref Connection preferences from application 
       
   591         * @param aConnId Connection Id
       
   592         * @param aAppUid Application UId
       
   593         * @param aPolicyPref Connection preferences chosen by MPM
       
   594         * @param aStatus KErrNone if successful, otherwise one of the
       
   595         * system-wide error codes
       
   596         */
       
   597         IMPORT_C void ChooseBestIAP( TConnPref&             aConnPref,
       
   598                                      const TConnectionId    aConnId,
       
   599                                      const TUid             aAppUid,
       
   600                                      TConnPref&             aPolicyPref,
       
   601                                      TRequestStatus&        aStatus );
       
   602 
       
   603         /**
       
   604         * Re-selectBestIAP. Same as ChooseBestIAP but can be called multiple times.
       
   605         * resubmit of 
       
   606         * @since 5.2
       
   607         * @param aConnId Connection Id
       
   608         * @param aPolicyPref Connection preferences chosen by MPM
       
   609         * @param aStatus KErrNone if successful, otherwise one of the
       
   610         * system-wide error codes
       
   611         */
       
   612         IMPORT_C void ReselectBestIAP( const TConnectionId    aConnId,
       
   613                                        TConnPref&             aPolicyPref,
       
   614                                        TRequestStatus&        aStatus );
       
   615 
       
   616         /**
       
   617         * Error processing of connection initiation.
       
   618         * @since 3.1
       
   619         * @param aError Error code
       
   620         * @param aConnId Connection Id
       
   621         * @param aNeededAction Ignore error, propagate error or perform a reselection
       
   622         * @param aStatus KErrNone if successful, otherwise one of the
       
   623         * system-wide error codes
       
   624         */
       
   625         IMPORT_C void ProcessError( TInt&                   aError,
       
   626                                     const TConnectionId     aConnId,
       
   627                                     TBMNeededAction&        aNeededAction,
       
   628                                     TRequestStatus&         aStatus );
       
   629 
       
   630         /**
       
   631         * Error processing of connection initiation.
       
   632         * @deprecated In 5.2, aConnPref not required.
       
   633         * @since 3.1
       
   634         * @param aConnPref Connection preferences
       
   635         * @param aError Error code
       
   636         * @param aConnId Connection Id
       
   637         * @param aNeededAction Ignore error, propagate error or perform a reselection
       
   638         * @param aStatus KErrNone if successful, otherwise one of the
       
   639         * system-wide error codes
       
   640         */
       
   641         IMPORT_C void ProcessError( TConnPref&              aConnPref,
       
   642                                     TInt&                   aError,
       
   643                                     const TConnectionId     aConnId,
       
   644                                     TBMNeededAction&        aNeededAction,
       
   645                                     TRequestStatus&         aStatus );
       
   646 
       
   647         /**
       
   648         * Application leaves connection.
       
   649         * @since 3.1
       
   650         * @param aIapId IAP Id of the connection.
       
   651         * @param aConnId Connection Id
       
   652         * @return KErrNone if successful, otherwise one of the
       
   653         * system-wide error codes
       
   654         */
       
   655         IMPORT_C TInt ApplicationLeavesConnection( const TUint32       aIapId,
       
   656                                                    const TConnectionId aConnId );
       
   657 
       
   658         /**
       
   659         * The whole IAP connection is stopped.
       
   660         * @since 3.1
       
   661         * @param aIapId IAP Id of the connection.
       
   662         * @param aConnId Connection Id
       
   663         * @return KErrNone if successful, otherwise one of the
       
   664         * system-wide error codes
       
   665         */
       
   666         IMPORT_C TInt IAPConnectionStopped( const TUint32       aIapId,
       
   667                                             const TConnectionId aConnId );
       
   668 
       
   669         /**
       
   670         * Bearer manager provides message buffer for MPM notifications,
       
   671         * must be called before registering for notifications.
       
   672         * @since 3.1
       
   673         * @param aMpmNotification notification for BM
       
   674         * @param aStatus KErrNone if successful, otherwise one of the
       
   675         * system-wide error codes
       
   676         */
       
   677         IMPORT_C void WaitNotification( TMPMMessageBuffer& aMpmNotification,
       
   678                                         TRequestStatus&    aStatus );
       
   679 
       
   680         /**
       
   681         * Register for getting preferred IAP notifications.
       
   682         * @since 3.1
       
   683         * @param aConnId Connection Id
       
   684         * @return KErrNone if successful, otherwise one of the
       
   685         * system-wide error codes
       
   686         */
       
   687         IMPORT_C TInt RegisterPrefIAPNotif( const TConnectionId aConnId );
       
   688 
       
   689         /**
       
   690         * Register for getting preferred IAP notifications.
       
   691         * @since 5.2
       
   692         * @param aConnId Connection Id
       
   693         * @param aStatus KErrNone if successful, otherwise one of the
       
   694         * system-wide error codes
       
   695         */
       
   696         IMPORT_C void RegisterPrefIAPNotif( const TConnectionId aConnId,
       
   697                                             TRequestStatus&     aStatus );
       
   698         /**
       
   699         * Register for getting preferred IAP notifications.
       
   700         * @deprecated In 5.2, aConnPref not required.
       
   701         * @since 3.1
       
   702         * @param aConnPref Connection preferences
       
   703         * @param aConnId Connection Id
       
   704         * @return KErrNone if successful, otherwise one of the
       
   705         * system-wide error codes
       
   706         */
       
   707         IMPORT_C TInt RegisterPrefIAPNotif( const TConnPref&    aConnPref,
       
   708                                             const TConnectionId aConnId );
       
   709 
       
   710         /**
       
   711         * Unregister preferred IAP notifications.
       
   712         * @since 3.1
       
   713         * @param aConnId Connection Id
       
   714         */
       
   715         IMPORT_C void UnregisterPrefIAPNotif( const TConnectionId aConnId );
       
   716 
       
   717         /**
       
   718         * Unregister preferred IAP notifications.
       
   719         * @since 5.2
       
   720         * @param aConnId Connection Id
       
   721         */
       
   722         IMPORT_C void UnregisterPrefIAPNotif( const TConnectionId aConnId,
       
   723                                               TRequestStatus&     aStatus );
       
   724 
       
   725         /**
       
   726         * Sort available IAPs belonging to the specified SNAP.
       
   727         * @since 3.2
       
   728         * @param aSNAP Service Network Access Point
       
   729         * @param aSortedList on return contains the sorted list of IAPs
       
   730         * @return KErrNone if successful, otherwise one of the
       
   731         * system-wide error codes
       
   732         */
       
   733         IMPORT_C TInt SortSNAP( const TUint32   aSNAP, 
       
   734                                 TMpmSnapBuffer& aSortedList );
       
   735 
       
   736         /**
       
   737         * Application joins connection.
       
   738         * @since 3.2
       
   739         * @param aIapId IAP Id of the connection.
       
   740         * @param aConnId Connection Id
       
   741         * @return KErrNone if successful, otherwise one of the
       
   742         * system-wide error codes
       
   743         */                
       
   744         IMPORT_C TInt ApplicationJoinsConnection( const TUint32       aIapId,
       
   745                                                   const TConnectionId aConnId );
       
   746 
       
   747         /**
       
   748         * The whole IAP connection is activated.
       
   749         * @since 3.2
       
   750         * @param aIapId IAP Id of the connection.
       
   751         * @param aConnId Connection Id
       
   752         * @return KErrNone if successful, otherwise one of the
       
   753         * system-wide error codes
       
   754         */        
       
   755         IMPORT_C TInt IAPConnectionActivated( const TUint32       aIapId,
       
   756                                               const TConnectionId aConnId );
       
   757 
       
   758         /**
       
   759         * The whole IAP connection is started.
       
   760         * @since 3.2
       
   761         * @param aIapId IAP Id of the connection.
       
   762         * @param aConnId Connection Id
       
   763         * @return KErrNone if successful, otherwise one of the
       
   764         * system-wide error codes
       
   765         */        
       
   766         IMPORT_C TInt IAPConnectionStarted( const TUint32       aIapId,
       
   767                                             const TConnectionId aConnId );
       
   768 
       
   769         /**
       
   770         * Application connection ends.
       
   771         * @since 3.2
       
   772         * @param aConnId Connection Id
       
   773         * @return KErrNone if successful, otherwise one of the
       
   774         * system-wide error codes
       
   775         */
       
   776         IMPORT_C TInt ApplicationConnectionEnds( 
       
   777                                         const TConnectionId aConnId ); 
       
   778 
       
   779         /**
       
   780         * Application migrates to carrier.
       
   781         * @since 3.2
       
   782         * @param aIapId IAP Id of the new carrier.
       
   783         * @param aConnId Connection Id
       
   784         * @return KErrNone if successful, otherwise one of the
       
   785         * system-wide error codes
       
   786         */                
       
   787         IMPORT_C TInt ApplicationMigratesToCarrier( const TUint32       aIapId,
       
   788                                                     const TConnectionId aConnId );
       
   789 
       
   790         /**
       
   791         * Application ignored the carrier.
       
   792         * @since 3.2
       
   793         * @param aIapId IAP Id of the new carrier.
       
   794         * @param aConnId Connection Id
       
   795         * @return KErrNone if successful, otherwise one of the
       
   796         * system-wide error codes
       
   797         */                
       
   798         IMPORT_C TInt ApplicationIgnoredTheCarrier( const TUint32       aIapId,
       
   799                                                     const TConnectionId aConnId );
       
   800 
       
   801         /**
       
   802         * Application accepted the carrier.
       
   803         * @since 3.2
       
   804         * @param aIapId IAP Id of the new carrier.
       
   805         * @param aConnId Connection Id
       
   806         * @return KErrNone if successful, otherwise one of the
       
   807         * system-wide error codes
       
   808         */                
       
   809         IMPORT_C TInt ApplicationAcceptedTheCarrier( const TUint32       aIapId,
       
   810                                                      const TConnectionId aConnId );
       
   811 
       
   812         /**
       
   813         * Application rejected the carrier.
       
   814         * @since 3.2
       
   815         * @param aIapId IAP Id of the new carrier.
       
   816         * @param aConnId Connection Id
       
   817         * @return KErrNone if successful, otherwise one of the
       
   818         * system-wide error codes
       
   819         */                
       
   820         IMPORT_C TInt ApplicationRejectedTheCarrier( const TUint32       aIapId,
       
   821                                                      const TConnectionId aConnId );
       
   822 
       
   823         /**
       
   824         * Displays connecting wait note for Easy WLAN connection.
       
   825         * @since 3.2
       
   826         * @param aSSID the id of selected wlan network
       
   827         */                
       
   828         IMPORT_C TInt EasyWlanSsid( const TWlanSsid& aSSID );
       
   829 
       
   830         /**
       
   831         * The whole IAP connection is started.
       
   832         * @since 5.2
       
   833         * @param aIapId IAP Id of the connection.
       
   834         * @param aConnId Connection Id
       
   835         * @param aStatus KErrNone if successful, otherwise one of the
       
   836         * system-wide error codes
       
   837         */        
       
   838         IMPORT_C void IAPConnectionStarted( const TUint32       aIapId,
       
   839                                             const TConnectionId aConnId,
       
   840                                             TRequestStatus&     aStatus );
       
   841                                             
       
   842         /**
       
   843         * The whole IAP connection is stopped.
       
   844         * @since 5.2
       
   845         * @param aIapId IAP Id of the connection.
       
   846         * @param aConnId Connection Id
       
   847         * @param aStatus KErrNone if successful, otherwise one of the
       
   848         * system-wide error codes
       
   849         */
       
   850         IMPORT_C void IAPConnectionStopped( const TUint32       aIapId,
       
   851                                             const TConnectionId aConnId,
       
   852                                             TRequestStatus&     aStatus );
       
   853 
       
   854         /**
       
   855         * Application joins connection.
       
   856         * @since 5.2
       
   857         * @param aIapId IAP Id of the connection.
       
   858         * @param aConnId Connection Id
       
   859         * @param aStatus KErrNone if successful, otherwise one of the
       
   860         * system-wide error codes
       
   861         */                
       
   862         IMPORT_C void ApplicationJoinsConnection( const TUint32       aIapId,
       
   863                                                   const TConnectionId aConnId,
       
   864                                                   TRequestStatus&     aStatus );
       
   865         /**
       
   866         * Application leaves connection.
       
   867         * @since 5.2
       
   868         * @param aIapId IAP Id of the connection.
       
   869         * @param aConnId Connection Id
       
   870         * @param aStatus KErrNone if successful, otherwise one of the
       
   871         * system-wide error codes
       
   872         */
       
   873         IMPORT_C void ApplicationLeavesConnection( const TUint32       aIapId,
       
   874                                                    const TConnectionId aConnId,
       
   875                                                    TRequestStatus&     aStatus );
       
   876 
       
   877         /**
       
   878         * Application connection ends.
       
   879         * @since 5.2
       
   880         * @param aConnId Connection Id
       
   881         * @param aStatus KErrNone if successful, otherwise one of the
       
   882         * system-wide error codes
       
   883         */
       
   884         IMPORT_C void ApplicationConnectionEnds( const TConnectionId aConnId,
       
   885                                                  TRequestStatus&     aStatus );
       
   886 
       
   887         /**
       
   888         * Application migrates to carrier.
       
   889         * @since 3.2
       
   890         * @param aIapId IAP Id of the new carrier.
       
   891         * @param aConnId Connection Id
       
   892         * @param aStatus KErrNone if successful, otherwise one of the
       
   893         * system-wide error codes
       
   894         */                
       
   895         IMPORT_C void ApplicationMigratesToCarrier( const TUint32       aIapId,
       
   896                                                     const TConnectionId aConnId,
       
   897                                                     TRequestStatus&     aStatus );
       
   898 
       
   899         /**
       
   900         * Application ignored the carrier.
       
   901         * @since 3.2
       
   902         * @param aIapId IAP Id of the new carrier.
       
   903         * @param aConnId Connection Id
       
   904         * @param aStatus KErrNone if successful, otherwise one of the
       
   905         * system-wide error codes
       
   906         */                
       
   907         IMPORT_C void ApplicationIgnoredTheCarrier( const TUint32       aIapId,
       
   908                                                     const TConnectionId aConnId,
       
   909                                                     TRequestStatus&     aStatus );
       
   910 
       
   911         /**
       
   912         * Application rejected the carrier.
       
   913         * @since 3.2
       
   914         * @param aIapId IAP Id of the rejected carrier.
       
   915         * @param aConnId Connection Id
       
   916         * @param aStatus KErrNone if successful, otherwise one of the
       
   917         * system-wide error codes
       
   918         */                
       
   919         IMPORT_C void ApplicationRejectedTheCarrier( const TUint32       aIapId,
       
   920                                                      const TConnectionId aConnId,
       
   921                                                      TRequestStatus&     aStatus );
       
   922 
       
   923         /**
       
   924         * Application accpeted the carrier.
       
   925         * @since 3.2
       
   926         * @param aIapId IAP Id of the accepted carrier.
       
   927         * @param aConnId Connection Id
       
   928         * @param aStatus KErrNone if successful, otherwise one of the
       
   929         * system-wide error codes
       
   930         */                
       
   931         IMPORT_C void ApplicationAcceptedTheCarrier( const TUint32       aIapId,
       
   932                                                      const TConnectionId aConnId,
       
   933                                                      TRequestStatus&     aStatus );
       
   934 
       
   935         /**
       
   936         * Asynchronously sort available IAPs belonging to the specified SNAP.
       
   937         * @since 5.2
       
   938         * @param aSNAP Service Network Access Point
       
   939         * @param aSortedList on return contains the sorted list of IAPs
       
   940         * @param aStatus KErrNone if successful, otherwise one of the
       
   941         * system-wide error codes
       
   942         * @param aMaxAgeSeconds how many seconds old availability data MPM is
       
   943         * allowed to use for priorization.
       
   944         */
       
   945         IMPORT_C void SortSNAP( const TUint32   aSNAP, 
       
   946                                 TMpmSnapBuffer& aSortedList,
       
   947                                 TRequestStatus& aStatus,
       
   948                                 const TUint32   aMaxAgeSeconds = 5 );
       
   949 
       
   950 #ifdef _DEBUG
       
   951         /**
       
   952          * Sends calls into MPM. Only for debugging purposes. Must not be compiled for UREL 
       
   953          */
       
   954         inline void SendReq( TMpmAsynchCodes aReq, TInt aValue );
       
   955 #endif //_DEBUG
       
   956     private: // New functions
       
   957 
       
   958         TPtr8& NextPtr();       
       
   959 
       
   960     private: // Data
       
   961     
       
   962         // Is Client connected
       
   963         TBool iConnected;
       
   964 
       
   965         // Ptr array for IPC messaging
       
   966         RArray< TPtr8 > iPtrArray;
       
   967 
       
   968         // Used for indexing iPtrArray elements
       
   969         TInt iIndex;
       
   970     };
       
   971 
       
   972 #include "rmpm.inl"
       
   973 
       
   974 #endif // RMPM_H
       
   975 
       
   976 // End of File