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