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