|
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: Declaration of the WMDRM Server Session class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __WMDRMSESSION_H |
|
20 #define __WMDRMSESSION_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include "wmdrmserver.h" |
|
25 |
|
26 class CSlot; |
|
27 class CEnumerator; |
|
28 |
|
29 /* Session class for the WMDRM server, implements slot and namespace |
|
30 * access functionality. |
|
31 */ |
|
32 class CWmDrmSession : public CSession2 |
|
33 { |
|
34 public: |
|
35 CWmDrmSession(); |
|
36 |
|
37 /* Initialize a store via a given store name. If the store creation |
|
38 * flag is set, the store is created when missing, otherwise an |
|
39 * error is returned. |
|
40 * |
|
41 * @param aMessage IPC message (store name, store creation flag) |
|
42 * @return KErrArgument for incorrect input data, KErrNotFound if |
|
43 * the store is missing and the store creation flag is not |
|
44 * set, KErrDiskFull if system drive doesn't have enough |
|
45 * free space, KErrNone if successful |
|
46 */ |
|
47 TInt InitStoreL( const RMessage2& aMessage ); |
|
48 |
|
49 /* Removes a named store with all its contents. |
|
50 * |
|
51 * @param aMessage IPC message (store name) |
|
52 * @return KErrArgument for incorrect input data, CFileMan error |
|
53 * codes, KErrNone if successful |
|
54 */ |
|
55 TInt RemoveStoreL( const RMessage2& aMessage ); |
|
56 |
|
57 /* Initialize a namespace via a given namespace name. If the |
|
58 * namespace creation flag is set, the namespace is created when missing, |
|
59 * otherwise an error is returned. |
|
60 * |
|
61 * @param aMessage IPC message (namespace name, namespace creation flag) |
|
62 * @return KErrArgument for incorrect input data, KErrNotFound if |
|
63 * the namespace is missing and the namespace creation flag is not |
|
64 * set, KErrDiskFull if system drive doesn't have enough free |
|
65 * space, KErrNone if successful |
|
66 */ |
|
67 TInt InitNamespaceL( const RMessage2& aMessage ); |
|
68 |
|
69 /* Removes a namespace will all its contents. |
|
70 * |
|
71 * @param aMessage IPC message (store name, namespace name) |
|
72 * @return KErrArgument for incorrect input data, CFileMan error |
|
73 * codes, KErrNone if successful |
|
74 */ |
|
75 TInt RemoveNamespaceL( const RMessage2& aMessage ); |
|
76 |
|
77 |
|
78 /* Opens a slot via its full name (store, namespace, slot hash and key ID). |
|
79 * |
|
80 * @param aMessage IPC message (all slot name components) |
|
81 * @return KErrArgument for incorrect input data, KErrNotFound if the slot |
|
82 * does not exist, KErrNone if successful |
|
83 */ |
|
84 TInt SlotOpenL( const RMessage2& aMessage ); |
|
85 |
|
86 /* Creates a slot via a full slot name and a given initial size. |
|
87 * |
|
88 * @param aMessage IPC message (all slot name components) |
|
89 * @return KErrArgument for incorrect input data, KErrDiskFull if system |
|
90 * drive doesn't have enough free space, KErrNone if successful |
|
91 */ |
|
92 TInt SlotCreateL( const RMessage2& aMessage ); |
|
93 |
|
94 /* Seeks within an opened slot. |
|
95 * |
|
96 * @param aMessage IPC message (seek starting point, seek offset) |
|
97 * @return KErrArgument for incorrect input data, KErrNotReady if the |
|
98 * slot is not open, KErrNone if successful |
|
99 */ |
|
100 TInt SlotSeekL( const RMessage2& aMessage ); |
|
101 |
|
102 /* Read data from an opened slot. |
|
103 * |
|
104 * @param aMessage IPC message (data buffer) |
|
105 * @return KErrNotReady if the slot is not open, KErrNone if successful |
|
106 */ |
|
107 TInt SlotReadL( const RMessage2& aMessage ); |
|
108 |
|
109 /* Write data to an opened slot. |
|
110 * |
|
111 * @param aMessage IPC message (data buffer) |
|
112 * @return KErrNotReady if the slot is not open, KErrDiskFull if system |
|
113 * drive doesn't have enough free space, KErrNone if successful |
|
114 */ |
|
115 TInt SlotWriteL( const RMessage2& aMessage ); |
|
116 |
|
117 /* Changes the size of a slot, truncating it if necessary |
|
118 * |
|
119 * @param aMessage IPC message (new size) |
|
120 * @return KErrNotReady if the slot is not open, KErrNone if successful |
|
121 */ |
|
122 TInt SlotResizeL( const RMessage2& aMessage ); |
|
123 |
|
124 /* Removes a slot via its full name. |
|
125 * |
|
126 * @param aMessage IPC message (all slot name components) |
|
127 * @return KErrArgument for incorrect input data, KErrNone if successful |
|
128 */ |
|
129 TInt SlotDeleteL( const RMessage2& aMessage ); |
|
130 |
|
131 /* Closes an opened slot. |
|
132 * |
|
133 * @param aMessage IPC message (not used) |
|
134 * @return KErrNotReady if the slot is not open, otherwise KErrNone |
|
135 */ |
|
136 TInt SlotCloseL( const RMessage2& aMessage ); |
|
137 |
|
138 |
|
139 /* Initiate enumeration over a namespace or slot. |
|
140 * |
|
141 * @param aMessage IPC message (namespace and/or slot information) |
|
142 * @return KErrArgument for incorrect input data, KErrNone if successful |
|
143 */ |
|
144 TInt EnumerateStartL( const RMessage2& aMessage ); |
|
145 |
|
146 /* Reload the current slot information to the current |
|
147 * enumerator. |
|
148 * |
|
149 * @param aMessage IPC message (not used) |
|
150 * @return KErrNotReady if the enumeration has not started, |
|
151 * otherwise KErrNone |
|
152 */ |
|
153 TInt EnumerateReloadL( const RMessage2& aMessage ); |
|
154 |
|
155 /* Moves the enumerator to the next slot and updates the slot |
|
156 * information. |
|
157 * |
|
158 * @param aMessage IPC message (not used) |
|
159 * @return KErrNotReady if the enumeration has not started, KErrNotFound |
|
160 * if the enumerator has reached the end, otherwise KErrNone |
|
161 */ |
|
162 TInt EnumerateNextL( const RMessage2& aMessage ); |
|
163 |
|
164 /* Delete the currently enumerated slot. |
|
165 * |
|
166 * @param aMessage IPC message (full slot information) |
|
167 * @return KErrNotReady if the enumeration has not started, |
|
168 * otherwise KErrNone |
|
169 */ |
|
170 TInt EnumerateDeleteL( const RMessage2& aMessage ); |
|
171 |
|
172 /* End the current enumeration. |
|
173 * |
|
174 * @param aMessage IPC message (not used) |
|
175 * @return KErrNotReady if the enumeration has not started, |
|
176 * otherwise KErrNone |
|
177 */ |
|
178 TInt EnumerateEndL( const RMessage2& aMessage ); |
|
179 |
|
180 |
|
181 /* Empties the slot and enumerator caches. |
|
182 * |
|
183 * @param aMessage IPC message (not used) |
|
184 * @return KErrNone |
|
185 */ |
|
186 TInt EmptyCacheL( const RMessage2& aMessage ); |
|
187 |
|
188 /* Log server statistics. |
|
189 * |
|
190 * @param aMessage IPC message (not used) |
|
191 * @return KErrNone |
|
192 */ |
|
193 TInt LogStats( const RMessage2& aMessage ); |
|
194 |
|
195 /* Check whether the current time is anti-rollback secure |
|
196 * |
|
197 * @param aMessage IPC message (not used) |
|
198 * @return KErrNone if the time is secure. |
|
199 */ |
|
200 TInt TimeValid( const RMessage2& aMessage ); |
|
201 |
|
202 /* Sets the current device time as secure |
|
203 * |
|
204 * @param aMessage IPC message (not used) |
|
205 */ |
|
206 void SetTimeAsValidL( const RMessage2& aMessage ); |
|
207 |
|
208 |
|
209 /* Deletes rights from the stores |
|
210 * |
|
211 * @param aMessage IPC message (not used) |
|
212 */ |
|
213 TInt DeleteRightsL( const RMessage2& aMessage ); |
|
214 |
|
215 /* Gets store state |
|
216 * |
|
217 * @param aMessage IPC message (store state) |
|
218 */ |
|
219 void StoreStateL( const RMessage2& aMessage ); |
|
220 |
|
221 /* Gets the drm time and validity |
|
222 * |
|
223 * @param aMessage IPC message (time, validity) |
|
224 */ |
|
225 void GetTimeL( const RMessage2& aMessage ); |
|
226 |
|
227 private: |
|
228 /* Desctructor. |
|
229 */ |
|
230 ~CWmDrmSession(); |
|
231 |
|
232 /* Returns a reference to the associated server object |
|
233 * |
|
234 * @return Reference to the server |
|
235 */ |
|
236 inline CWmDrmServer& Server(); |
|
237 |
|
238 /* Service dispatch function |
|
239 * |
|
240 * @param aMessage IPC message |
|
241 */ |
|
242 void ServiceL(const RMessage2& aMessage); |
|
243 |
|
244 /* Service error handler function |
|
245 * |
|
246 * @param aMessage IPC message |
|
247 * @param aError Error code |
|
248 */ |
|
249 void ServiceError(const RMessage2& aMessage, TInt aError); |
|
250 |
|
251 // Own: reference to the currently opened slot |
|
252 CSlot* iSlot; |
|
253 |
|
254 // Own: reference to the currently active enumerator |
|
255 CEnumerator* iEnumerator; |
|
256 }; |
|
257 |
|
258 #endif |