|
1 /* |
|
2 * Copyright (c) 2007 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: Server definitions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __WMDRMSERVER_H |
|
20 #define __WMDRMSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include "wmdrmclient.h" |
|
25 #include "wmdrmclientserver.h" |
|
26 |
|
27 class CSlotDataCache; |
|
28 class CSlotEnumeratorCache; |
|
29 class CClock; |
|
30 class CWmDrmDataStore; |
|
31 class CWmDrmDb; |
|
32 |
|
33 // Max length of the slot name |
|
34 const TInt KMaxSlotNameSize = KMaxWmDrmStoreNameSize + KMaxWmDrmNamespaceNameSize + 2 * KWmDrmIdSize + 4 * sizeof( TInt ); |
|
35 |
|
36 // Length of the AES key (128 bits) |
|
37 const TInt KAESKeyLength = 16; |
|
38 |
|
39 // Max number of cached enumerators |
|
40 const TInt KDefaultMaxCachedEnumerators = 16; |
|
41 |
|
42 // Max number of cached slots |
|
43 const TInt KDefaultMaxCachedSlots = 16; |
|
44 |
|
45 // Max size of the data in a slot |
|
46 const TInt KMaxSlotSize = 64 * 1024; |
|
47 |
|
48 // Private directory of the WMDRM server |
|
49 _LIT( KPrivateDir, "%c:\\private\\10282F1B\\" ); |
|
50 |
|
51 // Filename for the last-known-good time |
|
52 _LIT( KTimeSaverFile, "%c:\\private\\10282F1B\\clock.dat" ); |
|
53 |
|
54 // Filename for the initial free space |
|
55 _LIT( KInitialFreeSpaceFile, "%c:\\private\\10282F1B\\freespace.dat" ); |
|
56 |
|
57 // Filename for the dummy db file |
|
58 _LIT( KDummyDbFile, "%c:\\private\\10282F1B\\dummydb.dat" ); |
|
59 |
|
60 // Default store, sometimes the porting kit does not pass a store name, |
|
61 // this is used instead. |
|
62 _LIT( KDefaultStore, "hds" ); |
|
63 |
|
64 /* WMDRM Server class, implements slot and namespace access functionality |
|
65 */ |
|
66 class CWmDrmServer : public CServer2 |
|
67 { |
|
68 public: |
|
69 /* Create a server object and pushes it onto the cleanup stack. |
|
70 * |
|
71 * @return Server object |
|
72 */ |
|
73 static CServer2* NewLC(); |
|
74 |
|
75 /* Destructor. |
|
76 */ |
|
77 ~CWmDrmServer(); |
|
78 |
|
79 |
|
80 /* Returns the slot cache object. |
|
81 * |
|
82 * @return Slot cache |
|
83 */ |
|
84 CSlotDataCache* Cache(); |
|
85 |
|
86 /* Returns the enumerator cache object. |
|
87 * |
|
88 * @return Enumerator cache |
|
89 */ |
|
90 CSlotEnumeratorCache* EnumeratorCache(); |
|
91 |
|
92 /* Returns the anti-rollback clock object. |
|
93 * |
|
94 * @return Clock object |
|
95 */ |
|
96 CClock* Clock(); |
|
97 |
|
98 /* Returns a shared file server reference. |
|
99 * |
|
100 * @return Shared file server |
|
101 */ |
|
102 RFs& Fs(); |
|
103 |
|
104 /* Returns the data store object. |
|
105 * |
|
106 * @return Data store object |
|
107 */ |
|
108 CWmDrmDataStore* DataStore(); |
|
109 |
|
110 /* Returns the database object. |
|
111 * |
|
112 * @return Database object |
|
113 */ |
|
114 CWmDrmDb* Db(); |
|
115 |
|
116 /* Flushes and empties the slot and enumerator caches. |
|
117 */ |
|
118 void ResetCacheL(); |
|
119 |
|
120 /* Returns the amount of free space either on the system |
|
121 * drive or the configured drive for WM DRM rights storage |
|
122 * @return Amount of free space on system drive |
|
123 */ |
|
124 TInt64 FreeSpaceL( TBool aConfiguredDrive ); |
|
125 |
|
126 private: |
|
127 |
|
128 /* Private constructor. |
|
129 */ |
|
130 CWmDrmServer(); |
|
131 |
|
132 /* Second phase constructor. |
|
133 */ |
|
134 void ConstructL(); |
|
135 |
|
136 /* Creates a new session. |
|
137 * |
|
138 * @param aVersion Client version |
|
139 * @param aMessage IPC message |
|
140 * @return New session |
|
141 */ |
|
142 CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; |
|
143 |
|
144 // Own: Slot cache |
|
145 CSlotDataCache* iCache; |
|
146 |
|
147 // Own: Enumerator cache |
|
148 CSlotEnumeratorCache* iEnumeratorCache; |
|
149 |
|
150 // Own: Anti-rollback clock |
|
151 CClock* iClock; |
|
152 |
|
153 // Own: File server |
|
154 RFs iFs; |
|
155 |
|
156 // Own: Data store |
|
157 CWmDrmDataStore* iDataStore; |
|
158 |
|
159 // Own: Database |
|
160 CWmDrmDb* iDb; |
|
161 |
|
162 // Drive number for the drive to be used as a storage of WMDRM rights |
|
163 TInt iDriveNumber; |
|
164 |
|
165 // Default system drive number |
|
166 TInt iSystemDriveNumber; |
|
167 |
|
168 // Whether WM DRM rights are configured to be (partly) stored to an internal |
|
169 // drive |
|
170 TBool iWmDrmRightsConfigFound; |
|
171 |
|
172 }; |
|
173 |
|
174 #endif |