|
1 /* |
|
2 * Copyright (c) 2002-2009 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 the License "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 * CFSCertAppsServer class implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 */ |
|
26 |
|
27 #ifndef __CFSCERTAPPSSERVER_H__ |
|
28 #define __CFSCERTAPPSSERVER_H__ |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <f32file.h> |
|
32 #include <s32file.h> |
|
33 #include <mctcertapps.h> |
|
34 |
|
35 class CFSCertAppsToken; |
|
36 class CCertAppsSession; |
|
37 class CCertAppsConduit; |
|
38 |
|
39 class CFSCertAppsServer : public CBase |
|
40 { |
|
41 public: |
|
42 static CFSCertAppsServer* NewL(); |
|
43 virtual ~CFSCertAppsServer(); |
|
44 CCertAppsSession* CreateSessionL(); |
|
45 |
|
46 public: |
|
47 void AddL(const TCertificateAppInfo& aClient); |
|
48 void RemoveL(const TUid& aUid); |
|
49 TInt ApplicationCountL() const; |
|
50 void ApplicationsL(RArray<TCertificateAppInfo>& aAppArray) const; |
|
51 void ApplicationL(const TUid& aUid, TCertificateAppInfo& aInfo) const; |
|
52 |
|
53 private: |
|
54 CFSCertAppsServer(); |
|
55 void ConstructL(); |
|
56 |
|
57 /// Finds an application and returns NULL if not found - if aIndex is not |
|
58 /// null then index is copied there |
|
59 const TCertificateAppInfo* FindApplication(const TUid& aUid, TInt* aIndex = NULL) const; |
|
60 |
|
61 /// Configures the object from the file store. Will create a new store |
|
62 /// if one does not exist |
|
63 void OpenStoreL(); |
|
64 /// Opens a Composite store present under ROM drive. |
|
65 void OpenCompositeStoreL(const TDesC& aFilename); |
|
66 /// Attempt to load the cert apps from the given file |
|
67 void ReadStoreContentsL(const TDesC& aFilename); |
|
68 /// Create a new empty store |
|
69 void CreateStoreL(const TDesC& aFilename); |
|
70 /// aggregate the store files |
|
71 void AggregateStoreFileL(const TDesC& aFile); |
|
72 /// aggregate certificate client entries. |
|
73 void MergeCertificateEntryListL(const RArray<TCertificateAppInfo>& aSourceList); |
|
74 /// finds if an uid exists in the entry list |
|
75 TBool FindUid(const TUid& aUid); |
|
76 // TCleanup items used when creating a store or replacing a stream |
|
77 static void DeleteStoreFile(TAny* aThis); |
|
78 static void RevertStore(TAny* aStore); |
|
79 |
|
80 /// Replaces the store - called by both Add and Remove. |
|
81 /// Leaves if failed. ExcludedIndex is the index into the |
|
82 /// array to be excluded. -1 if none are excluded |
|
83 void ReplaceAndCommitL(TInt aExcludedIndex = -1); |
|
84 |
|
85 /// Externalizes the array into a stream - commits it if successful |
|
86 void WriteClientArrayL(RWriteStream& stream, TInt aExcludedIndex = -1) const; |
|
87 |
|
88 private: |
|
89 /// The conduit object used for marshalling/unmarshalling client communications |
|
90 CCertAppsConduit* iConduit; |
|
91 RFs iFs; |
|
92 /// The store where the client are stored |
|
93 CPermanentFileStore* iStore; |
|
94 TStreamId iId; |
|
95 /// A cache of the contents of the store |
|
96 RArray<TCertificateAppInfo> iClients; |
|
97 /// Used to distinguish variant specific feature from the default. |
|
98 TUint8 iPatchableConst; |
|
99 }; |
|
100 |
|
101 #endif // __CFSCERTAPPSSERVER_H__ |