|
1 // Copyright (c) 2000-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifdef _DEBUG |
|
17 #undef _NO_SERVER_LOGGING_ |
|
18 #endif |
|
19 |
|
20 #if !defined(__MSVSERV_H__) |
|
21 #define __MSVSERV_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <flogger.h> |
|
25 #include <msvstore.h> |
|
26 #include <msvipc.h> |
|
27 #include <msvids.h> |
|
28 #include "MSVROPS.H" |
|
29 #include "indexcontext.h" |
|
30 #include "MSVOP.H" |
|
31 #include <mtsr.h> |
|
32 #include "CMsvChangeBuffer.h" |
|
33 #include <tnonoperationmtmdata.h> |
|
34 #include "TMsvServerStoreManager.h" |
|
35 #include "msvindexadapter.h" |
|
36 #include "msventryfreepool.h" |
|
37 |
|
38 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
39 #include "msvinifile.h" |
|
40 #include "msvpreferreddrivelist.h" |
|
41 #include "cmsvdiskchangenotifier.h" |
|
42 #else |
|
43 #include "diskchange.h" |
|
44 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
45 |
|
46 |
|
47 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
48 #include "msvmessagedbadapter.h" |
|
49 #include "cmsvconverterwaiter.h" |
|
50 #endif |
|
51 |
|
52 |
|
53 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
54 _LIT(KMsvDbFile, "\\messaging.db"); |
|
55 #else |
|
56 _LIT(KMsvDbFile, "[1000484b]messaging.db"); |
|
57 #endif // #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
58 |
|
59 // Remove these to remove server logging |
|
60 //#define _NO_SERVER_LOGGING_ |
|
61 #define _NO_SERVER_LOGGING_SERIAL_ |
|
62 |
|
63 _LIT(KServerINIFile,"\\private\\1000484b\\msgs.ini"); |
|
64 |
|
65 |
|
66 // Code added for PREQ 557. |
|
67 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
68 const TUint KMsvInvalidDriveId = 999; |
|
69 #endif |
|
70 |
|
71 // forward declarations |
|
72 class CMsvServer; |
|
73 class CMsvServerSession; |
|
74 class CBaseServerMtm; |
|
75 class CMsvBackupHandler; |
|
76 class CMsvMailinitWaiter; |
|
77 |
|
78 class CMSvSearchSortCacheManager; |
|
79 class CMsvSearchSortDeltaCache; |
|
80 class CMsvIndexAdapter; |
|
81 |
|
82 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
83 class CMsvDiskChangeNotifier; |
|
84 class CMsvPreferredDriveList; |
|
85 #endif |
|
86 |
|
87 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
88 class CMsvConverterWaiter; |
|
89 #endif |
|
90 // Client panics |
|
91 /** |
|
92 @internalComponent |
|
93 @released |
|
94 */ |
|
95 enum TMsvClientPanic |
|
96 { |
|
97 EMsvBadRequest=1, |
|
98 EMsvDuplicatedChangeRequest=2, |
|
99 EMsvBadDescriptorWrite=3, |
|
100 EMsvBadDescriptorRead=4, |
|
101 EMsvIncorrectEntry=5, |
|
102 EMsvReleasingUnknownEntry=6, |
|
103 EMsvLockedStoresOnExit=7, |
|
104 EMsvOutstandingOperationsOnExit=8, |
|
105 EMsvReleasingUnknownStore=9, |
|
106 EMsvNoEntriesInDeleteSelection=10, |
|
107 EMsvRemovingNonLocalEntry=11, |
|
108 EMsvProgressBufferExceeds256=12, |
|
109 EMsvNoEntriesInMoveSelection=13, |
|
110 EMsvNoEntriesInCopySelection=14, |
|
111 EMsvNoEntriesInChangeAttributesSelection=15 |
|
112 }; |
|
113 |
|
114 const TInt KMsvMessageDriveStreamVersionNumber = 3; |
|
115 const TUid KUidMsvMessageDriveStream = {0x1000163E}; |
|
116 |
|
117 //********************************** |
|
118 // CMsvMtmOperationQueue |
|
119 //********************************** |
|
120 // |
|
121 // |
|
122 // |
|
123 |
|
124 |
|
125 class CMsvMtmOperationQueue: public CArrayPtrFlat<CMsvMtmOperation> |
|
126 /** |
|
127 @internalComponent |
|
128 @released |
|
129 */ |
|
130 { |
|
131 public: |
|
132 CMsvMtmOperationQueue(TUid aMtmUid, TMsvId aServiceId); |
|
133 ~CMsvMtmOperationQueue(); |
|
134 // |
|
135 inline TUid MtmUid() const; |
|
136 inline TMsvId ServiceId() const; |
|
137 public: |
|
138 CBaseServerMtm* iMtm; |
|
139 private: |
|
140 TUid iMtmUid; |
|
141 TMsvId iServiceId; |
|
142 CArrayFixFlat<TInt> iSessionIdArray; |
|
143 // |
|
144 friend class CMsvServer; |
|
145 }; |
|
146 |
|
147 |
|
148 |
|
149 //********************************** |
|
150 // CMsvTimer |
|
151 //********************************** |
|
152 // |
|
153 // |
|
154 // |
|
155 |
|
156 class CMsvTimer : public CTimer |
|
157 /** |
|
158 @internalComponent |
|
159 @released |
|
160 */ |
|
161 { |
|
162 public: |
|
163 static CMsvTimer* NewL(CMsvServer& aServer, TBool aCloseServer); |
|
164 private: |
|
165 CMsvTimer(CMsvServer& aServer, TBool aCloseServer); |
|
166 void RunL(); |
|
167 private: |
|
168 CMsvServer& iServer; |
|
169 TBool iCloseServer; |
|
170 }; |
|
171 |
|
172 //********************************** |
|
173 // CMsvServer |
|
174 //********************************** |
|
175 // |
|
176 // Main message server object |
|
177 // |
|
178 |
|
179 // This is used for testing |
|
180 /** |
|
181 @internalComponent |
|
182 @released |
|
183 */ |
|
184 enum TMsvFailure |
|
185 { |
|
186 EHeapFailure, |
|
187 EDiskFailure |
|
188 }; |
|
189 |
|
190 class TCapabilitySet; |
|
191 |
|
192 // Commit (and notify) interval for bulk transactions |
|
193 // Kept as a #define so that it will always match the type of |
|
194 // the value to which it is compared. |
|
195 #define KBulkCommitInterval 16 |
|
196 class CMsvServer : public CPolicyServer, public MMsvOperationObserver, public MMsvContextObserver, public MMsvDiskChangeObserver |
|
197 /** |
|
198 @internalComponent |
|
199 @released |
|
200 */ |
|
201 { |
|
202 public: |
|
203 enum {EPriority=950}; |
|
204 |
|
205 public: |
|
206 IMPORT_C TInt ChangeDrive(TInt aDrive, TRequestStatus* aStatus); |
|
207 IMPORT_C TInt CopyStore(const TDriveUnit& aDrive, TRequestStatus* aStatus); |
|
208 IMPORT_C TInt DeleteStore(const TDriveUnit& aDrive, TRequestStatus* aStatus); |
|
209 ~CMsvServer(); |
|
210 // |
|
211 virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
212 // |
|
213 void NotifyChanged(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aSelection, TInt aParameter1=0, TInt aParameter2=0); |
|
214 void NotifyChanged(TMsvServerChangeNotificationType aChangeType, TMsvId aId=KMsvNullIndexEntryId, TInt aParameter1=0, TInt aParameter2=0); |
|
215 void NotifyChanged(TMsvServerChangeNotificationType aChangeType, TUid aMtmTypeUid); |
|
216 void QueueNotifyChanged(TMsvServerChangeNotificationType aChangeType); |
|
217 |
|
218 IMPORT_C static CMsvServer* NewL(); |
|
219 static CMsvServer* NewL(TBool aDebug); |
|
220 inline const CMsvIndexAdapter& IndexAdapter() const; |
|
221 inline CMsvIndexAdapter& IndexAdapter(); |
|
222 |
|
223 // Code added for 557. |
|
224 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
225 void UpdateRepositoryL(); |
|
226 IMPORT_C void CreateIndexL(); |
|
227 void PrepareDriveForDeletionL(TDriveNumber aDrive); |
|
228 void RemoveDriveFromListL(TDriveNumber aDriveNumber); |
|
229 void AddDriveToListL(TDriveNumber aDriveNumber, TUint& aPriority, CMsvServerSession* aCurrentSession = NULL); |
|
230 void UpdateDrivePriorityL(TDriveNumber aDriveNumber, TUint& aNewPriority); |
|
231 void ChangeDriveComplete(TInt aError, TBool aRunMailInit, TDriveNumber aNewDrive); |
|
232 void UpdateDriveStatusL(const TDriveUnit& aDrive, TDriveState aStatus); |
|
233 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
234 static void ResetRepositoryL(); |
|
235 #endif |
|
236 #else |
|
237 static void CurrentConfigL(RFs& aFs, TMsvConfig& aConfig); |
|
238 IMPORT_C void CreateIndexL(TBool aSync = EFalse); |
|
239 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
240 |
|
241 inline RFs& FileSession(); |
|
242 inline TInt SessionId(); |
|
243 inline const CServerMtmDllRegistry& Registry() const; |
|
244 // |
|
245 // operation related |
|
246 void StartOperationL(CMsvMtmOperation& aOperation, TInt aSessionId, const RMessage2& aMessage, TBool aHasCapability); |
|
247 // from MMsvOperationObserver |
|
248 void OperationCompleted(TMsvId aServiceId, TMsvOp aOpId); |
|
249 void OperationCancelled(const CMsvMtmOperation& aOperation); |
|
250 // |
|
251 void ClosingSession(TInt aSessionId); |
|
252 void CheckAndClose(); |
|
253 // |
|
254 TInt FillRegisteredMtmDllArray(TUid aMtmDllTypeUid,CRegisteredMtmDllArray& aRegisteredMtmDllArray); // Fill array with Dlls whose second uid is aMtmDllTypeUid |
|
255 TInt InstallMtmGroup(const TDesC& aFullName,TUid& aMtmTypeUid); |
|
256 TInt DeInstallMtmGroup(const TDesC& aFullName,TUid& aMtmTypeUid); |
|
257 CMtmGroupData* GetMtmGroupDataL(TUid aMtmTypeUid) const; |
|
258 void GetMtmRequiredCapabilitiesL(TUid aMtmTypeUid, TCapabilitySet& aCaps) const; |
|
259 // |
|
260 TInt GetAndMakeFileDirectory(TMsvId aId, TDes& aDirectory); |
|
261 TInt GetFileDirectoryListing(TMsvId aId, TDes& aDirectory, CDir*& aDir); |
|
262 TInt AddEntry(TMsvEntry& aEntry, TSecureId aOwnerId, TBool aAutoAssignId, TBool aBulk=EFalse); |
|
263 TInt ChangeEntry(const TMsvEntry& aEntry, TSecureId aOwnerId, TBool aForcedUpdate, TBool aBulk=EFalse); |
|
264 void RemoveEntry(TMsvId aId); |
|
265 void CloseServer(const RMessage2& aMessage); |
|
266 void AttemptDelayedUpdating(); |
|
267 void StopServiceL(const RMessage2& aMessage); |
|
268 void ServiceActive(const RMessage2& aMessage); |
|
269 const TDesC8& ServiceProgressL(TMsvId aServcieId); |
|
270 inline TInt CheckEntries(const CMsvEntrySelection& aEntries); |
|
271 TInt CheckEntries(const CMsvEntrySelection& aEntries, TInt aStartIndex, TInt aEndIndex); |
|
272 // |
|
273 TInt GetEntryName(TMsvId aId, TDes& aFileName, TBool aFolderRequired); |
|
274 TInt AddEntry(CMsvIndexContext* const& aContext, TMsvEntry& aEntry, TSecureId aOwnerId, TBool aAutoAssignId, TBool aBulk=EFalse); |
|
275 // |
|
276 void SetFailure(TMsvFailure aType, TInt aArg1, TInt aArg2, TInt); |
|
277 TInt OutstandingOperations(); |
|
278 // |
|
279 inline CMsvTimer& Delay() const; |
|
280 inline TBool HasContext() const; |
|
281 inline CMsvIndexContext& Context() const; |
|
282 inline CMsvIndexContext* NewContext() const; |
|
283 inline void DeleteNewContext(); |
|
284 inline TMsvServerChangeNotificationType StartupState() const; |
|
285 |
|
286 |
|
287 void SetStartupState(TMsvServerChangeNotificationType aState); |
|
288 const TDriveUnit &Drive() const; |
|
289 |
|
290 void MailinitFinished(TInt aError, TDriveNumber aDriveNum); |
|
291 |
|
292 MRegisteredMtmDllObserver& MtmObserver() const; |
|
293 // |
|
294 #ifndef _NO_SERVER_LOGGING_ |
|
295 void Log(TRefByValue<const TDesC> aFmt, ...); |
|
296 #endif |
|
297 //Notifies observers of changes to a group of entries |
|
298 //(e.g. during bulk synchronisation of email headers) |
|
299 void NotifyChangedBulkL(); |
|
300 |
|
301 // completes any outstanding bulk transactions |
|
302 void CompleteBulkTransaction(void); |
|
303 // |
|
304 // This function is for the CMsvServerSession class to access the public |
|
305 // methods ConnectAndShareFileSessionL() and CloseFileSession() |
|
306 TMsvServerStoreManager& ServerStoreManager(); |
|
307 |
|
308 void PoliceReadEntryL(const RMessage2& aMsg, TSecureId aOwnerId, const char* aContextText); |
|
309 void PoliceReadEntryL(const RMessage2& aMsg, TMsvId aId, const char* aContextText); |
|
310 void PoliceCreateEntryL(const RMessage2& aMsg, TMsvEntry aEntry, TBool& aIsLocal, const char* aContextText); |
|
311 void PoliceModifyEntryL(const RMessage2& aMsg, TMsvEntry aEntry, TBool& aIsLocal, const char* aContextText); |
|
312 void PoliceModifyEntryL(const RMessage2& aMsg, TMsvId aId, TBool& aIsLocal, const char* aContextText); |
|
313 void PoliceModifyEntryL(const RMessage2& aMsg, TMsvId aId, const char* aContextText); |
|
314 void PoliceMoveEntriesL(const RMessage2& aMsg, const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvId aSource, TBool& aTargetIsLocal, TBool& aSourceIsLocal, const char* aContextText); |
|
315 void PoliceCopyEntriesL(const RMessage2& aMsg, const CMsvEntrySelection& aSelection, TMsvId aTarget, TBool& aTargetIsLocal, const char* aContextText); |
|
316 void PoliceMtmTransferCommandL(const RMessage2& aMsg, TUid aMtm, const char* aContextText); |
|
317 void PoliceStopServiceL(const RMessage2& aMsg, TUid aMtm, const char* aContextText); |
|
318 |
|
319 void PoliceCopyMoveUnderOutboxL(const RMessage2& aMsg, const CMsvEntrySelection& aSelection, const char* aContextText); |
|
320 void PoliceCreateModifyEntryL(const RMessage2& aMsg, CMsvIndexAdapter::TMsvServerEntryInfo aEntryInfo, TBool aCreate, TBool& aIsLocal, const char* aContextText); |
|
321 TBool ProtectedFolder(TMsvId aFolder) const; |
|
322 TBool ProtectedRemoteServices() const; |
|
323 void GetCapsEntryCreateModifyL(const RMessage2& aMsg, TMsvId aFolder, TUid aMtm, TSecureId aOwnerId, TBool aCreateEntry, TBool aLocal, TCapabilitySet& aCaps); |
|
324 void GetCapsForMtmL(TUid aMtm, TCapabilitySet& aCaps); |
|
325 void GetNonOperationMtmDataL(TMsvId aServiceId, TNonOperationMtmDataType aMtmDataType, TPtrC8& aResultBuffer); |
|
326 void PoliceSearchSortQueryReadRequestL(const RMessage2& aMsg, const char* aContextText); |
|
327 void CreateSearchSortCacheL(); |
|
328 |
|
329 |
|
330 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
331 inline const CMsvMessageDBAdapter& MessageDBAdapter() const; |
|
332 inline CMsvMessageDBAdapter& MessageDBAdapter(); |
|
333 #endif |
|
334 |
|
335 private: |
|
336 CMsvServer(TInt aPriority, TBool aDebug); |
|
337 void ConstructL(); |
|
338 |
|
339 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
340 |
|
341 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
342 void DiskRemoved(const TDriveUnit& aDrive, TBool aTestRemoval = EFalse); |
|
343 void DiskInserted(const TDriveUnit& aDrive, TBool aTestInsert = EFalse); |
|
344 void DoDiskInsertedL(const TDriveUnit& aDrive, TBool aTestInsert); |
|
345 void DoDiskRemovedL(const TDriveUnit& aDrive, TBool aTestRemoval); |
|
346 #else |
|
347 void DiskRemoved(const TDriveUnit& aDrive); |
|
348 void DiskInserted(const TDriveUnit& aDrive); |
|
349 void DoDiskInsertedL(const TDriveUnit& aDrive); |
|
350 void DoDiskRemovedL(const TDriveUnit& aDrive); |
|
351 #endif |
|
352 void CreatePreferredDriveListL(); |
|
353 void DiskChanged(const TDriveUnit& aDrive); |
|
354 void RunMailInitExe(TDriveNumber aDriveNum); |
|
355 #else |
|
356 TBool DiskRemoved(const TDriveUnit& aDrive); |
|
357 TBool DiskInserted(const TDriveUnit& aDrive); |
|
358 TBool DiskChanged(const TDriveUnit& aDrive, TUint aUniqueId); |
|
359 static void BuildDefaultIniFileL(TMsvConfig& aConfig); |
|
360 void RunMailInitExe(); |
|
361 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
362 |
|
363 void CreateRegistriesL(); |
|
364 void CreateIndexFromResources(); |
|
365 // |
|
366 void DoNotify(TMsvServerChangeNotificationType aChangeType,TBool aQueue = EFalse); |
|
367 void DoChangeDriveL(TInt aDrive, TRequestStatus* aStatus); |
|
368 // |
|
369 TInt CheckMtmStatus(TMsvId aServiceId, TBool& aRunning); |
|
370 void QueueOperationL(CMsvMtmOperation& aOperation, TInt aSessionId); |
|
371 CBaseServerMtm* LoadMtmL(const CMsvMtmOperation& aOperation); |
|
372 TBool SessionIdInQueue(CMsvMtmOperationQueue& aQueue, TInt aSessionId) const; |
|
373 inline void AddSessionIdToQueueL(CMsvMtmOperationQueue& aQueue, TInt aSessionId); |
|
374 // |
|
375 void StartNextOperation(CMsvMtmOperationQueue* aQueue, TInt aQueueIndex); |
|
376 void DoRemoveEntriesL(TMsvId aId); |
|
377 // |
|
378 CSession2* DoNewSessionL(const RMessage2 &aMessage); |
|
379 // |
|
380 void StartObserverExes(); |
|
381 // |
|
382 TInt GetEntryName(const CMsvIndexContext& aContext, TMsvId aId, TDes& aFileName, TBool aFolderRequired); |
|
383 // |
|
384 void ContextComplete(TInt aError, TBool aRunMailInit); |
|
385 // |
|
386 void SuspendSendingMessagesL(); |
|
387 |
|
388 #ifndef _NO_SERVER_LOGGING_ |
|
389 void CreateLogL(); |
|
390 mutable RFileLogger iLog; |
|
391 #else |
|
392 TInt8 iBCSpacer[sizeof(RFileLogger)]; |
|
393 #endif |
|
394 |
|
395 void DoNotifyChangedBulkL(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aEntriesToNotify); |
|
396 |
|
397 // |
|
398 private: |
|
399 TInt iSessionNumber; |
|
400 RFs iFs; |
|
401 TMsvNotifBuffer iChange; |
|
402 CServerMtmDllRegistry* iServerMtmReg; |
|
403 CMtmRegistryControl* iMtmRegControl; |
|
404 CArrayPtrFlat<CMsvMtmOperationQueue> iMtmOperationQueueArray; |
|
405 #ifdef MSG_SERV_AUTO_CLOSE |
|
406 CMsvTimer* iCloseTimer; |
|
407 #endif |
|
408 CMsvTimer* iDelayTimer; |
|
409 TBool iCloseServer; |
|
410 // |
|
411 CMsvIndexContext* iNewContext; |
|
412 CMsvIndexContext* iContext; |
|
413 |
|
414 TMsvServerChangeNotificationType iStartupState; |
|
415 TFileName iIndexFileName; |
|
416 TDriveUnit iIndexDrive; |
|
417 TInt iLoadError; |
|
418 TBool iDebug; |
|
419 |
|
420 // |
|
421 CMsvBackupHandler* iBackup; |
|
422 TMsvServerStoreManager iServerStoreManager; |
|
423 RArray<TMsvId> iProtectedFolders; |
|
424 TBool iRemoteServicesProtected; |
|
425 CMsvMailinitWaiter* iMailinitWaiter; |
|
426 //variables for bulk creation of entries |
|
427 CMsvEntrySelection* iBulkCreationSelection; |
|
428 CMsvEntrySelection* iBulkChangeSelection; |
|
429 TBuf<2> iSystemDrive; |
|
430 |
|
431 // Reference to freepool object. |
|
432 CMsvEntryFreePool* iFreePoolInstance; |
|
433 |
|
434 // Search Sort Cache Manager |
|
435 CMSvSearchSortCacheManager* iSearchSortCacheManager; |
|
436 |
|
437 // Code added for PREQ 557. |
|
438 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
439 CMsvPreferredDriveList* iDriveList; |
|
440 RPointerArray<CMsvDiskChangeNotifier> iNotifier; |
|
441 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
442 friend class CTestMsvServer; |
|
443 friend class CTestIndexContext; |
|
444 #endif |
|
445 #else |
|
446 CMsvNotifyDiskChange* iNotify; |
|
447 #endif |
|
448 |
|
449 |
|
450 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
451 CMsvMessageDBAdapter* iMessageDBAdapter; |
|
452 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
453 friend class CTestMessageConverterWaiter; |
|
454 #endif |
|
455 #endif |
|
456 |
|
457 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
458 TMsvServerChangeNotificationType iNotification; //record notification sent for test purposes |
|
459 friend class CTestOOMSearchSortCacheManager; |
|
460 friend class CTestSearchSortDBadapter; |
|
461 #endif |
|
462 }; |
|
463 |
|
464 |
|
465 //********************************** |
|
466 // TMtmGroupRefCount |
|
467 //********************************** |
|
468 // |
|
469 // |
|
470 // |
|
471 |
|
472 class TMtmGroupRefCount |
|
473 /** |
|
474 @internalComponent |
|
475 @released |
|
476 */ |
|
477 { |
|
478 public: |
|
479 TMtmGroupRefCount(TUid aMtmTypeUid); |
|
480 public: |
|
481 TUid iMtmTypeUid; |
|
482 TInt iRefCount; |
|
483 }; |
|
484 |
|
485 //********************************** |
|
486 // CMsvOperationData |
|
487 //********************************** |
|
488 // |
|
489 // |
|
490 // |
|
491 |
|
492 class CMsvOperationData : public CBase |
|
493 /** |
|
494 @internalComponent |
|
495 @released |
|
496 */ |
|
497 { |
|
498 public: |
|
499 CMsvOperationData(TMsvOp aOpId); |
|
500 ~CMsvOperationData(); |
|
501 inline TMsvOp OperationId() const; |
|
502 public: |
|
503 HBufC8* iBuffer; |
|
504 private: |
|
505 TMsvOp iOpId; |
|
506 }; |
|
507 |
|
508 //********************************** |
|
509 // CMsvServerSession |
|
510 //********************************** |
|
511 // |
|
512 // |
|
513 // |
|
514 |
|
515 class CMsvServerSession : public CSession2 |
|
516 /** |
|
517 @internalComponent |
|
518 @released |
|
519 */ |
|
520 { |
|
521 public: |
|
522 CMsvServerSession(CMsvServer& aServer); |
|
523 ~CMsvServerSession(); |
|
524 static CMsvServerSession* NewL(CMsvServer& aServer, const RMessage2 &aMessage); |
|
525 virtual void ServiceL(const RMessage2 &aMessage); |
|
526 // callback from server |
|
527 void NotifyChangedL(TMsvNotifBuffer& iChangeBuffer, TBool aQueue = EFalse); |
|
528 void StopOperations(TMsvId aServiceId); |
|
529 // |
|
530 TBool IsInUse(TUid aMtmTypeUid); |
|
531 inline TBool IsAnObserver(); |
|
532 inline TInt SessionId(); |
|
533 inline TInt HaveOutstandingOperations(); |
|
534 inline const TDesC& ProcessName() const; |
|
535 inline TBool ReceiveEntryEvents() const; |
|
536 // |
|
537 private: |
|
538 void DoServiceL(const RMessage2& aMessage); |
|
539 void ConstructL(const RMessage2& aMessage); |
|
540 void QueueSessionEventRequestL(const RMessage2 &aMessage); |
|
541 void CancelSessionEventRequest(const RMessage2 &aMessage); |
|
542 void SendNotificationL(const RMessage2& aMessage); |
|
543 void GetEntryL(const RMessage2 &aMessage); |
|
544 void GetChildrenL(const RMessage2 &aMessage); |
|
545 void GetRemainingChildrenL(const RMessage2 &aMessage); |
|
546 void LockEntryL(const RMessage2 &aMessage); |
|
547 void ReleaseEntryL(const RMessage2 &aMessage); |
|
548 void ReadStoreL(const RMessage2 &aMessage); |
|
549 void LockStoreL(const RMessage2 &aMessage); |
|
550 void ReleaseStoreL(const RMessage2 &aMessage); |
|
551 void DecStoreReaderCountL(const RMessage2 &aMessage); |
|
552 |
|
553 void CancelOperationL(const RMessage2 &aMessage); |
|
554 void OperationCompletionL(const RMessage2 &aMessage); |
|
555 void OperationProgressL(const RMessage2 &aMessage); |
|
556 void OperationSystemProgressL(const RMessage2 &aMessage); |
|
557 void OperationMtmL(const RMessage2 &aMessage); |
|
558 // |
|
559 void ChangeEntryL(const RMessage2 &aMessage); |
|
560 void DoChangeLocalEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId); |
|
561 void DoChangeRemoteEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage); |
|
562 // |
|
563 void CreateEntryL(const RMessage2 &aMessage); |
|
564 void DoCreateLocalEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage, TSecureId aOwnerId); |
|
565 void DoCreateRemoteEntryL(const TMsvEntry& aEntry, TMsvOp aOpId, const RMessage2 &aMessage); |
|
566 // |
|
567 void MakeEntryFileDirectoryL(const RMessage2 &aMessage); |
|
568 // |
|
569 void TransferCommandL(const RMessage2 &aMessage); |
|
570 // |
|
571 void MoveEntriesL(const RMessage2 &aMessage); |
|
572 void DoMoveLocalEntriesL(CMsvEntrySelection*& aSelection, TMsvId aTarget, TMsvOp aOpId, const RMessage2 &aMessage); |
|
573 void DoMoveRemoteEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, TMsvId aTarget, const RMessage2 &aMessage, TBool aSourceLocal, TBool aTargetLocal, TBool aHasCapability); |
|
574 // |
|
575 void DeleteEntriesL(const RMessage2 &aMessage); |
|
576 void DoDeleteLocalEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage); |
|
577 void DoDeleteRemoteEntriesL(CMsvEntrySelection*& aSelection, TMsvOp aOpId, const RMessage2 &aMessage); |
|
578 // |
|
579 void CopyEntriesL(const RMessage2 &aMessage); |
|
580 void DoCopyLocalEntriesL( CMsvEntrySelection*& aSelection, TMsvId aTarget, TMsvOp aOpId, const RMessage2 &aMessage); |
|
581 void DoCopyRemoteEntriesL(CMsvEntrySelection*& aSelection, TMsvId aTarget, TMsvOp aOpId, const RMessage2 &aMessage, TBool aSourceLocal, TBool aTargetLocal, TBool aHasCapability); |
|
582 // |
|
583 void CopyOperationDataL(const RMessage2 &aMessage); |
|
584 void CopyCommandDataL(const RMessage2 &aMessage); |
|
585 HBufC8* RecoverOperationData(TMsvOp aOpId); |
|
586 // |
|
587 void PackEntryAndWriteBufferL(const RMessage2 &aMessage, TInt aParam, const TMsvEntry& aEntry); |
|
588 // |
|
589 void WriteBufferL(const RMessage2 &aMessage, TInt aParam); |
|
590 void WriteL(const RMessage2 &aMessage, TInt aParam, const TDesC8& aDes); |
|
591 // |
|
592 inline void ReadMainBufferL(const RMessage2 &aMessage, TInt aParam); |
|
593 void ReadBufferL(const RMessage2 &aMessage, TInt aParam, HBufC8*& aBuffer); |
|
594 void ReadL (const RMessage2 &aMessage, TInt aParam, TDes8& aDes); |
|
595 // |
|
596 void FillRegisteredMtmDllArray(const RMessage2 &aMessage); |
|
597 void DoFillRegisteredMtmDllArrayL(const RMessage2 &aMessage); |
|
598 void MtmGroupL(const RMessage2 &aMessage, TBool aInstall); |
|
599 void UseMtmGroup(const RMessage2 &aMessage); |
|
600 void ReleaseMtmGroup(const RMessage2 &aMessage); |
|
601 void GetMtmGroupDataL(const RMessage2 &aMessage); |
|
602 void GetMtmRequiredCapabilitiesL(const RMessage2& aMessage); |
|
603 // |
|
604 void ServiceProgressL(const RMessage2 &aMessage); |
|
605 // |
|
606 void RemoveEntry(const RMessage2& aMessage); |
|
607 void MessageFolderL(const RMessage2 &aMessage); |
|
608 void ChangeAttributesL(const RMessage2& aMessage); |
|
609 void GetChildIdsL(const RMessage2& aMessage); |
|
610 void CopyStoreL(const RMessage2 &aMessage); |
|
611 void DeleteStoreL(const RMessage2 &aMessage); |
|
612 void OutstandingOperationsL(const RMessage2& aMessage); |
|
613 void GetNotifySequenceL(const RMessage2& aMessage); |
|
614 // |
|
615 void SetReceiveEntryEvents(const RMessage2 &aMessage); |
|
616 // |
|
617 void PanicClient(const RMessage2 &aMessage, TMsvClientPanic aPanic) const; |
|
618 void ChangeDriveL(const RMessage2 &aMessage); |
|
619 void CreateAttachmentForWriteL(const RMessage2 &aMessage); |
|
620 void ReplaceAttachmentForWriteL(const RMessage2 &aMessage); |
|
621 void OpenAttachmentL(const RMessage2 &aMessage); |
|
622 void OpenAttachmentForWriteL(const RMessage2 &aMessage); |
|
623 void DeleteAttachmentL(const RMessage2 &aMessage); |
|
624 void RenameAttachmentL(const RMessage2 &aMessage); |
|
625 void FileExistsL(const RMessage2 &aMessage); |
|
626 void GetAttachmentFilePathL(const RMessage2& aMessage); |
|
627 void OpenFileStoreForReadL(const RMessage2 &aMessage); |
|
628 void OpenTempStoreFileL(const RMessage2 &aMessage); |
|
629 void ReplaceFileStoreL(const RMessage2 &aMessage); |
|
630 void DeleteFileStoreL(const RMessage2 &aMessage); |
|
631 void FileStoreExistsL(const RMessage2 &aMessage) const; |
|
632 void ConnectAndShareFileSessionLC(RFs& aFs ); |
|
633 void UpdateOwnerIdL(TMsvId aId, TSecureId aOwnerId); |
|
634 void BodyTextFilePathL(const RMessage2 &aMessage); |
|
635 void OpenPlainTextFileL(const RMessage2 &aMessage); |
|
636 void CreatePlainTextFileL(const RMessage2 &aMessage); |
|
637 void DeletePlainTextFileL(const RMessage2& aMessage); |
|
638 void ReplacePlainTextFileL(const RMessage2 &aMessage); |
|
639 void GetNonOperationMtmDataL(const RMessage2 &aMessage); |
|
640 |
|
641 // Code added for PREQ 1667. |
|
642 void SearchSortOnHeaderAndBodytMsgL(const RMessage2 &aMessage); |
|
643 void SendSearchSortIndexEntryResultL(const RMessage2 &aMessage); |
|
644 void SearchSortOnIndexEntryL(const RMessage2& aMessage); |
|
645 void SendResultOrIdsToSearchL(const RMessage2& aMessage); |
|
646 void GetSearchSortResultCountL(const RMessage2& aMessage); |
|
647 void GetResultInIteratorL(const RMessage2& aMessage); |
|
648 void GetNextEntryInIteratorL(const RMessage2& aMessage); |
|
649 void GetQueryIDL(const RMessage2& aMessage); |
|
650 void QueryUnMarkedL(const RMessage2& aMessage); |
|
651 void UpdateSearchSortCacheWithSortFiledL(const RMessage2& aMessage); |
|
652 void GetResultForQueryIDL(const RMessage2& aMessage); |
|
653 void GetSearchSortProgressInfoL(const RMessage2& aMessage); |
|
654 void SearchSortOperationCancelL(const RMessage2& aMessage); |
|
655 void UpdateSearchSortResultsAndSortByEntryL(const RMessage2& aMessage); |
|
656 void CopyQueryDataL(const RMessage2& aMessage); |
|
657 |
|
658 // Code added for PREQ 557. API for preferred drive list. |
|
659 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
660 void GetChildrenAllL(const RMessage2 &aMessage); |
|
661 void GetChildIdsAllL(const RMessage2& aMessage); |
|
662 void MessageDrive(const RMessage2 &aMessage); |
|
663 void CurrentDriveInfoL(const RMessage2 &aMessage); |
|
664 void DriveListL(const RMessage2 &aMessage); |
|
665 void AvailableDriveListL(const RMessage2 &aMessage); |
|
666 void AddDriveL(const RMessage2 &aMessage); |
|
667 void RemoveDriveL(const RMessage2 &aMessage); |
|
668 void UpdateDrivePriorityL(const RMessage2 &aMessage); |
|
669 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
670 void ResetRepositoryL(const RMessage2 &aMessage); |
|
671 void PrintCache(const RMessage2 &aMessage); |
|
672 #endif |
|
673 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
674 |
|
675 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
676 void CreateHeaderTableL(const RMessage2 &aMessage); |
|
677 void DoesStoreExistsL(const RMessage2 &aMessage); |
|
678 void LastErrorMessageL(const RMessage2 &aMessage); |
|
679 |
|
680 void CreateBodyEntryL(const RMessage2 &aMessage); |
|
681 void LoadBodyEntryL(const RMessage2 &aMessage); |
|
682 void UpdateBodyEntryL(const RMessage2 &aMessage); |
|
683 void DeleteBodyEntryL(const RMessage2 &aMessage); |
|
684 |
|
685 void CreateHeaderEntryL(const RMessage2 &aMessage); |
|
686 void LoadHeaderEntryL(const RMessage2 &aMessage); |
|
687 void DeleteHeaderEntryL(const RMessage2 &aMessage); |
|
688 void UpdateHeaderEntryL(const RMessage2 &aMessage); |
|
689 void DoesAnyStoreExists(const RMessage2 &aMessage); |
|
690 void DoesHeaderTableExist(const RMessage2 aMessage); |
|
691 // Converter API's |
|
692 void GetConvertibleDriveListL(const RMessage2 &aMessage); |
|
693 void ConvertMessageStoreL(const RMessage2 &aMessage); |
|
694 void CancelConversionRequestL(const RMessage2 &aMessage); |
|
695 void GetConversionStatus(const RMessage2 &aMessage); |
|
696 TBool FoundUnSupportedDrives(); |
|
697 #endif // #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
698 |
|
699 |
|
700 private: |
|
701 TInt iSessionId; |
|
702 CMsvServer& iMsvServer; |
|
703 RMessage2 iQueuedMessage; |
|
704 TBool iRequestQueued; |
|
705 TBool iObserverOnly; |
|
706 HBufC8* iBuffer; |
|
707 CMsvChangeBuffer* iChangeBuffer; |
|
708 CArrayPtrFlat<CMsvServerOperation> iOperations; |
|
709 CArrayFixFlat<TMtmGroupRefCount> iMtmGroupRefCountArray; |
|
710 CArrayPtrFlat<CMsvOperationData> iOperationDataArray; |
|
711 TMsvChildrenDetails iChildrenDetails; |
|
712 CArrayPtrSeg<const TMsvEntry>* iChildrenSelection; |
|
713 CMsvEntrySelection* iChildrenSelectionIds; |
|
714 CMsvEntrySelection iLockedStores; |
|
715 TName iProcessName; |
|
716 TBool iReceiveEntryEvents; |
|
717 |
|
718 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
719 TPtrC iLastDBErrorMessage; |
|
720 CMsvConverterWaiter* iConverterWaiter; |
|
721 #endif |
|
722 }; |
|
723 |
|
724 #include "MSVSERV.INL" |
|
725 |
|
726 #endif |