epoc32/include/msvipc.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 msvipc.h
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__MSVIPC_H__)
       
    17 #define __MSVIPC_H__
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #if !defined(__MSVSTD_H__)
       
    24 #include <msvstd.h>
       
    25 #endif
       
    26 
       
    27 
       
    28 //
       
    29 const TInt KMsvNullOperation=0;
       
    30 const TInt KMsvFirstOperation=1;
       
    31 
       
    32 //
       
    33 const TInt KMsvSessionBufferLength=0x1000;
       
    34 const TInt KMsvProgressBufferLength=256;
       
    35 
       
    36 
       
    37 // ***** NOTE!!!!! TMsvPackedChangeNotification::UnpackL() MUST be	****
       
    38 // ***** updated when adding new types								*****
       
    39 /**
       
    40 @internalComponent
       
    41 @released
       
    42 */
       
    43 enum TMsvServerChangeNotificationType 
       
    44 	{
       
    45 	EMsvNullNotification=-1,
       
    46 	EMsvEntriesNoChange=0,
       
    47 	EMsvEntriesCreated=1,
       
    48 	EMsvEntriesChanged=2,
       
    49 	EMsvEntriesDeleted=3,
       
    50 	EMsvEntriesMoved=4,
       
    51 	EMsvMtmGroupInstalled=5,
       
    52 	EMsvMtmGroupDeInstalled=6,
       
    53 	EMsvStoreDeleted=7,  
       
    54 	EMsvCloseSession=8,
       
    55 	EMsvIndexLoaded=9,
       
    56 	EMsvIndexFailedToLoad=10,
       
    57 	EMsvCorruptedIndexRebuilt=11,
       
    58 	EMsvMediaChanged=12, // Note: I assume the following four follow each other in order
       
    59 	EMsvMediaUnavailable=13,
       
    60 	EMsvMediaAvailable=14,
       
    61 	EMsvMediaIncorrect=15,
       
    62 	EMsvCorruptedIndexRebuilding=16
       
    63 	};
       
    64 
       
    65 
       
    66 //**********************************
       
    67 // TMsvPackedEntry
       
    68 //**********************************
       
    69 //
       
    70 // Packs a TMsvEntry and the two associated descriptors into a buffer for
       
    71 // sending across IPC. Also unpacks the data into a TMsvEntry and two heap 
       
    72 // descriptors
       
    73 //
       
    74 //
       
    75 class TMsvEntry;
       
    76 
       
    77 class TMsvPackedEntry
       
    78 /**
       
    79 @internalComponent
       
    80 @released
       
    81 */
       
    82 	{
       
    83 public:
       
    84 	IMPORT_C TMsvPackedEntry(HBufC8*& aBuffer);
       
    85 	IMPORT_C TInt PackEntry(const TMsvEntry& aEntry);
       
    86 	IMPORT_C void UnpackEntry(TMsvEntry& aEntry);
       
    87 private:
       
    88 	HBufC8*& iBuffer;
       
    89 	};
       
    90 
       
    91 
       
    92 //**********************************
       
    93 // TMsvPackedEntryArray
       
    94 //**********************************
       
    95 //
       
    96 // Packs 1+ TMsvEntry's and the associated descriptors into a buffer for
       
    97 // sending across IPC. Also unpacks the data into a TMsvEntry and two heap 
       
    98 // descriptors using indexed access
       
    99 //
       
   100 //
       
   101 
       
   102 class TMsvPackedEntryArray
       
   103 /**
       
   104 @internalComponent
       
   105 @released
       
   106 */
       
   107 	{
       
   108 public:
       
   109 	IMPORT_C TMsvPackedEntryArray(HBufC8*& aBuffer, TInt aCount=0);
       
   110 	IMPORT_C TInt PackEntry(const TMsvEntry& aEntry);
       
   111 	IMPORT_C TInt UnpackEntry(TInt aEntryIndex, TMsvEntry& aEntry);
       
   112 	IMPORT_C void Reset();
       
   113 private:
       
   114 	TInt FindEntryInArray(TInt aIndex);
       
   115 private:
       
   116 	TInt	iIndex;
       
   117 	TInt	iCount;
       
   118 	const TUint8* iPos;
       
   119 	HBufC8*& iBuffer;
       
   120 	};
       
   121 
       
   122 
       
   123 //**********************************
       
   124 // TMsvChildrenDetails
       
   125 //**********************************
       
   126 //
       
   127 // Contains the information about the number of children of an entry and how many
       
   128 // have been sent in the main buffer
       
   129 //
       
   130 
       
   131 class TMsvChildrenDetails
       
   132 /**
       
   133 @internalComponent
       
   134 @released
       
   135 */
       
   136 	{
       
   137 public:
       
   138 	IMPORT_C TMsvChildrenDetails();
       
   139 public:
       
   140 	TMsvId	iParentId;
       
   141 	TInt	iTotalNumberChildren;
       
   142 	TInt	iNumberChildrenInArray;
       
   143 	TInt	iLastEntryInArray;
       
   144 	};
       
   145 
       
   146 
       
   147 //**********************************
       
   148 // TMsvLocalOperationProgress
       
   149 //**********************************
       
   150 //
       
   151 // Contains the information about a local operation
       
   152 //
       
   153 
       
   154 class TMsvLocalOperationProgress
       
   155 /** Encapsulates progress information returned by a local operation. A local operation 
       
   156 is a CMsvOperation-derived object returned by a function that affects only 
       
   157 local entries. For example, such a function would be a CMsvEntry::ChangeL() 
       
   158 call on a local entry. You can check if the operation is local from CMsvOperation::Mtm(): 
       
   159 a local operation returns a value of KUidMsvLocalServiceMtm. 
       
   160 
       
   161 Progress information is obtained, in a packaged format, by calling CMsvOperation::ProgressL(). 
       
   162 Understanding the TMsvLocalOperationProgress structure enables an application 
       
   163 to use that information for a local operation.  
       
   164 @publishedAll
       
   165 @released
       
   166 */
       
   167 	{
       
   168 public:
       
   169 /** Defines the possible values for the type of operation progress report. 
       
   170 @publishedAll
       
   171 @released
       
   172 */
       
   173 	enum TLocalOperation
       
   174 						{	
       
   175 	/** Default value for new TMsvLocalOperationProgress */
       
   176 							ELocalNone=0,
       
   177 	/** Move operation */
       
   178 							ELocalMove,
       
   179 	/** Delete operation */
       
   180 							ELocalDelete,
       
   181 	/** Copy operation */
       
   182 							ELocalCopy,
       
   183 	/** Create operation */
       
   184 							ELocalNew,
       
   185 	/** Change operation */
       
   186 							ELocalChanged
       
   187 							};
       
   188 public:
       
   189 	IMPORT_C TMsvLocalOperationProgress();
       
   190 public:
       
   191 	/** The type of operation on which the progress is reporting */
       
   192 	TLocalOperation iType;
       
   193 	/** The number of entries on which the operation was or will be attempted */
       
   194 	TInt iTotalNumberOfEntries;
       
   195 	/** The number of entries on which the operation has been successful */
       
   196 	TInt iNumberCompleted;	
       
   197 	/** The number of entries on which the operation has failed */
       
   198 	TInt iNumberFailed;	
       
   199 	/** The number of entries on which the operation has yet to be attempted */
       
   200 	TInt iNumberRemaining;	
       
   201 	/** The error code for the latest failed operation */
       
   202 	TInt iError;
       
   203 	/** This contains different information for different operation types:
       
   204 	
       
   205 	1. copying a single entry: ID of the new entry
       
   206 	
       
   207 	2. moving an entry: ID of the entry moved
       
   208 	
       
   209 	3. copying or moving multiple entries: ID of the first entry in the selection */
       
   210 	TMsvId	iId;
       
   211 	};
       
   212 
       
   213 //**********************************
       
   214 // TMsvServerOperationProgress
       
   215 //**********************************
       
   216 /** Encapsulates progress information returned by a non-MTM specific Message Server 
       
   217 operation. 
       
   218 
       
   219 You can check if an operation has this type of progress information by calling 
       
   220 CMsvOperation::Mtm(): a suitable operation returns a value of KUidMsvServerMtm. 
       
   221 
       
   222 Progress information is obtained, in a packaged format, by calling CMsvOperation::ProgressL(). 
       
   223 Understanding the TMsvServerOperationProgress class enables an application 
       
   224 to use that information for a Message Server operation. 
       
   225 
       
   226 @see TMsvLocalOperationProgress 
       
   227 @see CMsvSession::CopyStoreL() 
       
   228 @see CMsvSession::DeleteStoreL()
       
   229 @publishedAll
       
   230 @released
       
   231 */
       
   232 
       
   233 class TMsvServerOperationProgress
       
   234 	{
       
   235 public:
       
   236 
       
   237 	enum TMsvServerOperationType 
       
   238 		{ 
       
   239 		/** No operation in progress. */
       
   240 		EMsvNoOperation = 0, 
       
   241 		/** Change drive operation in progress.
       
   242 	
       
   243 		@see CMsvSession::ChangeDriveL() */
       
   244 		EMsvChangeDriveOperation
       
   245 		
       
   246 		,
       
   247  		/** Copy Store operation in progress.
       
   248  		@see CMsvSession::CopyStoreL() */
       
   249  		EMsvCopyOperation,
       
   250  		
       
   251  		/** Delete Store operation in progress.
       
   252  		@see CMsvSession::DeleteStoreL() */
       
   253  		EMsvDeleteOperation
       
   254  		
       
   255  				
       
   256  		 };
       
   257 	//
       
   258 public:
       
   259 	IMPORT_C TMsvServerOperationProgress();
       
   260 	TMsvServerOperationProgress(TMsvServerOperationType aType);
       
   261 	//
       
   262 public:
       
   263 	/** The type of operation in progress. */
       
   264 	TMsvServerOperationType iOperationType;
       
   265 	};
       
   266 
       
   267 		
       
   268 //**********************************
       
   269 // TMsvIndexProgress
       
   270 //**********************************
       
   271 
       
   272 class TMsvIndexProgress
       
   273 /** Provides details of index loading progress. 
       
   274 
       
   275 @see TMsvIndexLoadProgress 
       
   276 @publishedAll
       
   277 @released
       
   278 */
       
   279 	{
       
   280 public:
       
   281 	IMPORT_C TMsvIndexProgress();
       
   282 	//
       
   283 public:
       
   284 	/** Total number of entries in the index. */
       
   285 	TInt iTotal;
       
   286 	/** Number of entries created so far. */
       
   287 	TInt iCompleted;
       
   288 	/** Number of entries remaining. */
       
   289 	TInt iRemaining;
       
   290 	/** ID of entry last created. */
       
   291 	TMsvId iId;
       
   292 	};
       
   293 
       
   294 
       
   295 //**********************************
       
   296 // TMsvIndexLoadProgress
       
   297 //**********************************
       
   298 
       
   299 class TMsvIndexLoadProgress : public TMsvServerOperationProgress
       
   300 /** Progress information for an operation controlling the Message Server loading 
       
   301 its index. 
       
   302 
       
   303 Such an operation can occur when the Message Server changes drive.
       
   304 
       
   305 @see CMsvOperation
       
   306 @see CMsvSession::ChangeDriveL() 
       
   307 @publishedAll
       
   308 @released
       
   309 */
       
   310 	{
       
   311 public:
       
   312 	/** States for the index loading process. 
       
   313 @publishedAll
       
   314 @released
       
   315 */
       
   316 	enum TIndexState 
       
   317 		{
       
   318 		/** Index loading has not begun. */
       
   319 		EIndexNotLoaded = 0, 
       
   320 		/** Index loading is in progress. */
       
   321 		EIndexLoading, 
       
   322 		/** Index is being built. */
       
   323 		EIndexRebuilding, 
       
   324 		/** Index loading is complete. */
       
   325 		EIndexComplete};
       
   326 	//
       
   327 public:
       
   328 	IMPORT_C TMsvIndexLoadProgress();
       
   329 	//
       
   330 public:
       
   331 	/** Stores any errors that prevented the index being loaded. */
       
   332 	TInt iError;
       
   333 	/** Current state of the index loading process. */
       
   334 	TIndexState iState;
       
   335 	/** Details of the index loading progress. */
       
   336 	TMsvIndexProgress iIndex;
       
   337 	};
       
   338 
       
   339 
       
   340 
       
   341 //**********************************
       
   342 // TMsvCopyProgress
       
   343 //**********************************
       
   344 
       
   345 /** Progress information for the copy operation. 
       
   346 
       
   347 @see CMsvOperation
       
   348 @see CMsvSession::CopyStoreL() 
       
   349 @publishedAll
       
   350 @released
       
   351 */
       
   352 class TMsvCopyProgress : public TMsvServerOperationProgress
       
   353 	{
       
   354 public:
       
   355 /** States for the copy operation. 
       
   356 @publishedAll
       
   357 @released
       
   358 */
       
   359 	enum TCopyState 
       
   360 		{
       
   361 		/** Operation not yet started */
       
   362 		ENotYetStarted = 0,
       
   363 		/** Mail Store is being locked */
       
   364 		ELock, 
       
   365 		/** Initialising Copy operation */
       
   366 		EInitCopy,
       
   367 		/** Mail Store is being copied */
       
   368 		ECopyStore, 
       
   369 		/** Mail Store is being unlocked. */
       
   370 		EUnlock,
       
   371 		/** Operation completed */
       
   372 		ECompleted
       
   373 		};
       
   374 		
       
   375 	/** Stores any errors that the operation encountered. */
       
   376 	TInt iError;
       
   377 	TInt iTotal;      // Total number of items to be copied
       
   378 	TInt iCurrent;    // Current item number being copied
       
   379  	TCopyState iState;
       
   380 	
       
   381 public:
       
   382     IMPORT_C TMsvCopyProgress();
       
   383 	};
       
   384 
       
   385 
       
   386 //**********************************
       
   387 // TMsvDeleteProgress
       
   388 //**********************************
       
   389 
       
   390 /** Progress information for the delete operation.
       
   391  
       
   392 @see CMsvOperation
       
   393 @see CMsvSession::DeleteStoreL() 
       
   394 @publishedAll
       
   395 @released
       
   396 */
       
   397 class TMsvDeleteProgress : public TMsvServerOperationProgress
       
   398 	{
       
   399 public:
       
   400 /** States for the delete operation. 
       
   401 @publishedAll
       
   402 @released
       
   403 */
       
   404 	enum TDeleteState 
       
   405 		{
       
   406 		/** Operation not yet started */
       
   407 		ENotYetStarted = 0,
       
   408 		/** Mail Store is being deleted */
       
   409 		EDeleteStore, 
       
   410 		/** Operation is complete */
       
   411 		ECompleted
       
   412 		};
       
   413 		
       
   414 	/** Stores any errors that the operation encountered. */
       
   415 	TInt iError;
       
   416 	TDeleteState iState;
       
   417 	
       
   418 public:
       
   419     IMPORT_C TMsvDeleteProgress();
       
   420 	};
       
   421 
       
   422 
       
   423 
       
   424 //**********************************
       
   425 // TMsvPackedOperation
       
   426 //**********************************
       
   427 //
       
   428 // Packs an operation, the selection, and some associated parameters (TInt) into the
       
   429 // IPC buffer
       
   430 //
       
   431 //
       
   432 
       
   433 class TMsvPackedOperation
       
   434 /**
       
   435 @internalComponent
       
   436 @released
       
   437 */
       
   438 	{
       
   439 public:
       
   440 	IMPORT_C TMsvPackedOperation(HBufC8*& aBuffer);
       
   441 	IMPORT_C TInt Pack(const CMsvEntrySelection& aSelection, TInt aParameter1=0, TInt aParameter2=0);
       
   442 	IMPORT_C void UnpackL(CMsvEntrySelection& aSelection, TInt& aParameter1, TInt& aParameter2);
       
   443 private:
       
   444 	HBufC8*& iBuffer;
       
   445 	};
       
   446 
       
   447 
       
   448 //**********************************
       
   449 // TMsvPackedChangeNotification
       
   450 //**********************************
       
   451 //
       
   452 // Packs the CMsvEntrySelection of index entries that have been changed, and also 
       
   453 // the integer describing the type of change. There is a limit of KMsvPackedChangeLimit
       
   454 // top the number of entry ids that can be sent at one time
       
   455 //
       
   456 //
       
   457 
       
   458 typedef TBuf8<128> TMsvNotifBuffer;
       
   459 
       
   460 class TMsvPackedChangeNotification
       
   461 /**
       
   462 @internalComponent
       
   463 @released
       
   464 */
       
   465 	{
       
   466 public:
       
   467 	enum {	KMsvChangeNotificationNumberOfTInts=4,
       
   468 			KMsvPackedChangeLimit=28, // 32-KMsvChangeNotificationNumberOfTInts
       
   469 			}; 
       
   470 public:
       
   471 	IMPORT_C TMsvPackedChangeNotification(TMsvNotifBuffer& aBuffer);
       
   472 	inline void Pack(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2);
       
   473 	IMPORT_C void Pack(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2, TInt aStartIndex, TInt aFinishIndex);
       
   474 	IMPORT_C void Pack(TMsvServerChangeNotificationType aChangeType, TMsvId aId, TInt aParameter1, TInt aParameter2);
       
   475 	IMPORT_C void UnpackL(TMsvServerChangeNotificationType& aChangeType, CMsvEntrySelection& aSelection, TInt& aParameter1, TInt& aParameter2);
       
   476 private:
       
   477 	TMsvNotifBuffer& iBuffer;
       
   478 	};
       
   479 
       
   480 //**********************************
       
   481 // TMsvPackedEntryFilter
       
   482 //**********************************
       
   483 
       
   484 class TMsvPackedEntryFilter
       
   485 /**
       
   486 @internalComponent
       
   487 @released
       
   488 */
       
   489 	{
       
   490 public:
       
   491 	TMsvPackedEntryFilter(HBufC8*& aBuffer);
       
   492 	TInt PackFilter(const CMsvEntryFilter& aFilter);
       
   493 	void UnpackFilter(CMsvEntryFilter& aFilter);
       
   494 private:
       
   495 	HBufC8*& iBuffer;
       
   496 	};
       
   497 
       
   498 
       
   499 #include <msvipc.inl>
       
   500 
       
   501 #endif