cmmanager/cmmgr/cmmcommon/inc/cmmserverdefs.h
changeset 20 9c97ad6591ae
child 23 7ec726f93df1
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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:
       
    15 * Common definitions and enumerations for connection method manager server
       
    16 * (internal use).
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CMMSERVERDEFS_H
       
    22 #define CMMSERVERDEFS_H
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 static const TUid KCmmUid3 = { 0x20016A7A };
       
    27 
       
    28 /**
       
    29  * CmManager server name.
       
    30  */
       
    31 _LIT( KCmmServer, "!CmmServer" );
       
    32 
       
    33 /**
       
    34  * CmManager server filename.
       
    35  */
       
    36 _LIT( KCmmServerFile, "cmmserver" );
       
    37 
       
    38 const TInt KCmmServerStackSize    = 0x5000; //TODO, check if really used (in common code).
       
    39 const TInt KCmmServerInitHeapSize = 0x1000; //TODO, check if really used (in common code).
       
    40 const TInt KCmmServerMaxHeapSize  = 0x1000000; //TODO, check if really used (in common code).
       
    41 
       
    42 const TInt KBitsInOneByte = 8;
       
    43 const TInt KBitsInTwoBytes = 16;
       
    44 const TInt KBitsInThreeBytes = 24;
       
    45 
       
    46 /**
       
    47  * The server version. A version must be specified when creating a session with
       
    48  * the server.
       
    49  */
       
    50 const TUint KCmmServerMajorVersionNumber = 0; //TODO, check if really used (in common code).
       
    51 const TUint KCmmServerMinorVersionNumber = 1; //TODO, check if really used (in common code).
       
    52 const TUint KCmmServerBuildVersionNumber = 1; //TODO, check if really used (in common code).
       
    53 
       
    54 /**
       
    55  * Amount of time in microseconds that the server will wait before shutting
       
    56  * down, after last client has gone.
       
    57  */
       
    58 #if defined(__WINSCW__)
       
    59 const TUint KCmmShutdownDelay = 5000000; // 5 seconds, for testing purposes.
       
    60 #else
       
    61 const TUint KCmmShutdownDelay = 70000000; // 70 seconds.
       
    62 #endif
       
    63 
       
    64 const TUint32 KCmDefaultDestinationAPTagId = 0x1000;
       
    65 const TUint32 KCmMaxDestinationAPTagId = 0x1100;
       
    66 
       
    67 const TUint32 KCmmConnMethodIdIntervalMin = 0;
       
    68 const TUint32 KCmmConnMethodIdIntervalMax = 0x0100;
       
    69 
       
    70 const TUint32 KCmmDestIdIntervalLegacyMin = 0;
       
    71 const TUint32 KCmmDestIdIntervalLegacyMax = 0x0100;
       
    72 
       
    73 const TUint32 KCmmDestIdIntervalMin = 0x1000;
       
    74 const TUint32 KCmmDestIdIntervalMax = 0x1100;
       
    75 
       
    76 const TInt KCmmStringLengthMax = 1024; //TODO, need to find out correct value here
       
    77 
       
    78 const TUint32 KTemporaryIdCounterStart = 32768;
       
    79 
       
    80 const TUint32 KDestProtectionLevelMask = 0xF0000000;
       
    81 const TInt KBitsToShiftDestProtectionLevel = 28;
       
    82 
       
    83 
       
    84 // Buffer size for initial connection method query
       
    85 const TInt KCmmConnMethodAmountNormal = 64; //TODO, Check value
       
    86 // Maximum theoretical amount of connection methods
       
    87 const TInt KCmmConnMethodAmountMax = 256;
       
    88 
       
    89 // Buffer size for initial destination query
       
    90 const TInt KCmmDestAmountNormal = 32;
       
    91 // Maximum theoretical amount of connection methods
       
    92 const TInt KCmmDestAmountMax = 256;
       
    93 
       
    94 // Buffer size for supported bearers query
       
    95 const TInt KCmmBearerAmountNormal = 10;
       
    96 
       
    97 // Buffer size for bearer priority array query, first attempt
       
    98 const TInt KCmmDefaultBearerPriorityArraySize = 256;
       
    99 
       
   100 // iPriority:           2 16-bit values,
       
   101 // iUIPriority:         2 16-bit values,
       
   102 // iServiceType length: 1 16-bit value.
       
   103 const TInt KCmmBearerPriorityHeaderLength = 5;
       
   104 
       
   105 
       
   106 // Opcodes used in message passing between client and server
       
   107 enum TCmmRequests
       
   108     {
       
   109     ECmmGetBearerInfoInt                     = 0,
       
   110     ECmmGetBearerInfoBool                    = 1,
       
   111     ECmmGetBearerInfoString                  = 2,
       
   112     ECmmGetBearerInfoString8                 = 3,
       
   113     ECmmGetConnMethodArray                   = 4,
       
   114     ECmmGetAllDestinations                   = 5,
       
   115     ECmmGetBearerPriorityArray               = 6,
       
   116     ECmmGetEasyWlanId                        = 7,
       
   117     ECmmReadDefaultConnection                = 8,
       
   118     ECmmReadGeneralConnectionSettings        = 9,
       
   119     ECmmGetSupportedBearers                  = 10,
       
   120 
       
   121     ECmmGetConnMethodInfoInt                 = 11,
       
   122     ECmmGetConnMethodInfoBool                = 12,
       
   123     ECmmGetConnMethodInfoString              = 13,
       
   124     ECmmGetConnMethodInfoString8             = 14,
       
   125 
       
   126     ECmmUpdateBearerPriorityArray            = 15,
       
   127     ECmmWriteDefaultConnection               = 16,
       
   128     ECmmWriteGeneralConnectionSettings       = 17,
       
   129     ECmmCopyConnMethod                       = 18,
       
   130     ECmmMoveConnMethod                       = 19,
       
   131     ECmmRemoveConnMethod                     = 20,
       
   132     ECmmRemoveAllReferences                  = 21, // Connection method becomes uncategorized.
       
   133 
       
   134     // RCmDestination starts from 100
       
   135     EDestGetDestination                      = 100,
       
   136     EDestRefresh                             = 101,
       
   137     EDestCloseDestination                    = 102,
       
   138     EDestGetConnMethodCount                  = 103,
       
   139     EDestGetConnMethodPriority               = 104,
       
   140     EDestGetName                             = 105,
       
   141     EDestGetId                               = 106,
       
   142     EDestGetElementId                        = 107,
       
   143     EDestMetadata                            = 108,
       
   144     EDestGetProtectionLevel                  = 109,
       
   145     EDestIsHidden                            = 110,
       
   146     EDestIsEqual                             = 111,
       
   147     EDestGetEmbeddedDestination              = 112,
       
   148 
       
   149     EDestCreateDestinationWithName           = 113,
       
   150     EDestCreateDestinationWithNameAndId      = 114,
       
   151     EDestIsConnected                         = 115,
       
   152     EDestAddConnMethod                       = 116,
       
   153     EDestAddEmbeddedDestination              = 117,
       
   154     EDestDeleteConnMethod                    = 118,
       
   155     EDestRemoveConnMethod                    = 119,
       
   156     EDestModifyPriority                      = 120,
       
   157     EDestSetName                             = 121,
       
   158     EDestSetMetadata                         = 122,
       
   159     EDestSetProtection                       = 123,
       
   160     EDestSetHidden                           = 124,
       
   161     EDestUpdate                              = 125,
       
   162     EDestDelete                              = 126,
       
   163 
       
   164     //RCmConnectionMethod starts from 200
       
   165     ECMGetConnMethodWithId                   = 200,
       
   166     ECMRefresh                               = 201,
       
   167     ECMGetConnMethodFromDestWithIndex        = 202,
       
   168     ECMGetConnMethodFromDestWithId           = 203,
       
   169     ECMCloseConnMethod                       = 204,
       
   170     ECMIsEqual                               = 205,
       
   171 
       
   172     ECMCreateConnMethod                      = 206,
       
   173     ECMCreateConnMethodWithId                = 207,
       
   174     ECMCreateConnMethodToDest                = 208,
       
   175     ECMCreateConnMethodToDestWithId          = 209,
       
   176     ECMCreateCopyOfExisting                  = 210,
       
   177 
       
   178     ECMGetIntAttribute                       = 211,
       
   179     ECMGetBoolAttribute                      = 212,
       
   180     ECMGetStringAttribute                    = 213,
       
   181     ECMGetString8Attribute                   = 214,
       
   182 
       
   183     ECMSetIntAttribute                       = 215,
       
   184     ECMSetBoolAttribute                      = 216,
       
   185     ECMSetStringAttribute                    = 217,
       
   186     ECMSetString8Attribute                   = 218,
       
   187     ECMDelete                                = 219,
       
   188     ECMUpdate                                = 220
       
   189     };
       
   190 
       
   191 // Panic categories
       
   192 _LIT( KCmmPanicCategoryApi, "CmManager API" );
       
   193 
       
   194 // Panic codes
       
   195 enum TCmmServerPanic
       
   196     {
       
   197     ECreateTrapCleanup = 1,
       
   198     ECreateServer,
       
   199     EBadDescriptor,
       
   200     EBadRequest,
       
   201     EInvalidImportState,
       
   202     EDestNotConnectedToServer = 201
       
   203     };
       
   204 
       
   205 // Status flag values for database records.
       
   206 enum TCmmRecordStatus
       
   207     {
       
   208     ECmmRecordStatusBlank = 0x0001,
       
   209     ECmmRecordStatusLoaded = 0x0002, // Loaded and up-to-date.
       
   210     ECmmRecordStatusExpired = 0x0004, // Loaded but out-of-date. //TODO, should this be cache side only?
       
   211     ECmmRecordStatusModified = 0x0008, // Loaded and modified (Session side only).
       
   212     ECmmRecordStatusUnsaved = 0x0010 // Doesn't yet exist in database (Cache side only).
       
   213     };
       
   214 
       
   215 // Status flag values for connection method instances.
       
   216 enum TCmmConnMethodStatus
       
   217     {
       
   218     ECmmConnMethodStatusNotSaved = 1, // Connection method doesn't yet exist in database (cache side only).
       
   219     ECmmConnMethodStatusValid = 2, // Connection method exists in database and sessions can open handles to it.
       
   220     ECmmConnMethodStatusChanged = 3, // Contents modified, but not saved (session side only).
       
   221     ECmmConnMethodStatusToBeDeleted = 4 // Connection method will be deleted when reference count goes to 0 (cache side only).
       
   222     };
       
   223 
       
   224 // Status flag values for destination instances.
       
   225 enum TCmmDestinationStatus
       
   226     {
       
   227     ECmmDestinationStatusNotSaved = 1, // Destination doesn't yet exist in database (Cache side only).
       
   228     ECmmDestinationStatusValid = 2, // Destination exists in database and sessions can open handles to it.
       
   229     ECmmDestinationStatusChanged = 3, // Contents modified, but not saved (Session side only).
       
   230     ECmmDestinationStatusToBeDeleted = 4 // Destination will be deleted when reference count goes to 0 (cache side only).
       
   231     };
       
   232 
       
   233 // Identifiers for different destination related database records for internal use.
       
   234 enum TCmmDbRecords
       
   235     {
       
   236     ECmmDestNetworkRecord = 1,  //
       
   237     ECmmDestApRecord,           //
       
   238     ECmmDestMetadataRecord,     // CCDSNAPMetadataRecord
       
   239     ECmmDbSnapRecord,           // CCDDataMobilitySelectionPolicyRecord
       
   240     ECmmDbBearerPriorityRecord, //
       
   241     ECmmDbDefConnRecord         //
       
   242     };
       
   243 
       
   244 NONSHARABLE_CLASS( TCmmIpcStructGetConnMethods )
       
   245     {
       
   246 public:
       
   247     TBool iCheckBearerType;
       
   248     TBool iLegacyOnly;
       
   249     TBool iEasyWlan;
       
   250     };
       
   251 
       
   252 NONSHARABLE_CLASS( TCmmIpcStructMoveConnMethod )
       
   253     {
       
   254 public:
       
   255     TInt iSourceDestHandle;
       
   256     TInt iTargetDestHandle;
       
   257     TInt iConnMethodHandle;
       
   258     TInt iIndex;
       
   259     };
       
   260 
       
   261 // Prefix 'Cmm' used to avoid any future problems or name overlapping with
       
   262 // other similar implementations.
       
   263 template <class T>
       
   264 class CmmCleanupResetAndDestroy
       
   265     {
       
   266 public:
       
   267     inline static void PushL( T& aRef );
       
   268 
       
   269 private:
       
   270     static void ResetAndDestroy( TAny *aPtr );
       
   271     };
       
   272 
       
   273 template <class T>
       
   274 inline void CmmCleanupResetAndDestroyPushL( T& aRef );
       
   275 
       
   276 template <class T>
       
   277 inline void CmmCleanupResetAndDestroy<T>::PushL( T& aRef )
       
   278     {
       
   279     CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
       
   280     }
       
   281 
       
   282 template <class T>
       
   283 void CmmCleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
       
   284     {
       
   285     (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
       
   286     }
       
   287 
       
   288 template <class T>
       
   289 inline void CmmCleanupResetAndDestroyPushL( T& aRef )
       
   290     {
       
   291     CmmCleanupResetAndDestroy<T>::PushL( aRef );
       
   292     }
       
   293 
       
   294 #endif // CMMSERVERDEFS_H
       
   295 
       
   296 // End of file