49 * @since S60Rel2.5 |
49 * @since S60Rel2.5 |
50 */ |
50 */ |
51 NONSHARABLE_CLASS( CDRMRightsServer ) : public CServer2, public MWatcherObserver |
51 NONSHARABLE_CLASS( CDRMRightsServer ) : public CServer2, public MWatcherObserver |
52 { |
52 { |
53 public: // Constructors and destructor |
53 public: // Constructors and destructor |
54 |
54 |
55 /** |
55 /** |
56 * Two-phased constructor. |
56 * Two-phased constructor. |
57 * @since S60Rel2.5 |
57 * @since S60Rel2.5 |
58 * @return Pointer to newly created server instance. |
58 * @return Pointer to newly created server instance. |
59 */ |
59 */ |
60 static CDRMRightsServer* NewL(); |
60 static CDRMRightsServer* NewL(); |
61 |
61 |
62 /** |
62 /** |
63 * Destructor. |
63 * Destructor. |
64 * @since S60Rel2.5 |
64 * @since S60Rel2.5 |
65 */ |
65 */ |
66 ~CDRMRightsServer(); |
66 ~CDRMRightsServer(); |
67 |
67 |
68 public: // New functions |
68 public: // New functions |
69 |
69 |
70 /** |
70 /** |
71 * This method returns a handle to DRM Notifier. |
71 * This method returns a handle to DRM Notifier. |
72 * @since S60Rel2.6 |
72 * @since S60Rel2.6 |
73 * @return Handle to DRM Notifier. |
73 * @return Handle to DRM Notifier. |
74 */ |
74 */ |
75 CDRMNotifier& Notifier(); |
75 CDRMNotifier& Notifier(); |
76 |
76 |
77 /** |
77 /** |
78 * This method starts the ROAP storage server |
78 * This method starts the ROAP storage server |
79 * |
79 * |
80 * @since S60Rel3.0 |
80 * @since S60Rel3.0 |
81 */ |
81 */ |
82 void StartRoapStorageL(); |
82 void StartRoapStorageL(); |
83 |
83 |
84 /** |
84 /** |
85 * This method returns the handle to the rights database. |
85 * This method returns the handle to the rights database. |
86 * |
86 * |
87 * @since S60Rel2.6 |
87 * @since S60Rel2.6 |
88 * @return Handle to the rights database. |
88 * @return Handle to the rights database. |
89 */ |
89 */ |
90 CDRMRightsDB& Database(); |
90 CDRMRightsDB& Database(); |
91 |
91 |
92 RFs& FileServerSession(); |
92 RFs& FileServerSession(); |
93 |
93 |
94 /** |
94 /** |
95 * This method returns the handle to the metering database. |
95 * This method returns the handle to the metering database. |
96 * |
96 * |
97 * @since S60 3.2 |
97 * @since S60 3.2 |
98 * @return Handle to the metering database. |
98 * @return Handle to the metering database. |
99 */ |
99 */ |
100 RDrmMeteringDb& MeteringDatabase(); |
100 RDrmMeteringDb& MeteringDatabase(); |
101 |
101 |
102 RDRMReplayCache& ReplayCache(); |
102 RDRMReplayCache& ReplayCache(); |
103 |
103 |
104 /** |
104 /** |
105 * List of the contents which may have rights objects on the way |
105 * List of the contents which may have rights objects on the way |
106 * |
106 * |
115 * @since S60Rel2.5 |
115 * @since S60Rel2.5 |
116 * @param aTime Out-parameter where the time is stored. |
116 * @param aTime Out-parameter where the time is stored. |
117 * @return Truth value: Is the time a secure time or not. |
117 * @return Truth value: Is the time a secure time or not. |
118 */ |
118 */ |
119 TBool GetSecureTime( TTime& aTime ) const; |
119 TBool GetSecureTime( TTime& aTime ) const; |
120 |
120 |
121 /** |
121 /** |
122 * |
122 * |
123 */ |
123 */ |
124 const TDesC& GetIMEIL(); |
124 const TDesC& GetIMEIL(); |
125 |
125 |
126 /** |
126 /** |
127 * |
127 * |
128 */ |
128 */ |
129 const CDRMPointerArray<HBufC8>& GetIMSIL(); |
129 const CDRMPointerArray<HBufC8>& GetIMSIL(); |
130 |
130 |
131 /** |
131 /** |
132 * This function is used to handle backup restore events for |
132 * This function is used to handle backup restore events for |
133 * the DRM system |
133 * the DRM system |
134 */ |
134 */ |
135 void HandleBackupEventL( TInt aBackupEvent ); |
135 void HandleBackupEventL( TInt aBackupEvent ); |
136 |
136 |
137 /** |
137 /** |
138 * Checks if a content ID is in the list of currently consumed contents |
138 * Checks if a content ID is in the list of currently consumed contents |
139 * with count constraints |
139 * with count constraints |
140 * |
140 * |
141 * @since 3.0 |
141 * @since 3.0 |
142 * @param aContentId content ID to search for |
142 * @param aContentId content ID to search for |
143 * @return ETrue if the content ID is in the list |
143 * @return ETrue if the content ID is in the list |
144 */ |
144 */ |
145 TBool HasActiveCountConstraint( const TDesC8& aContentId ); |
145 TBool HasActiveCountConstraint( const TDesC8& aContentId ); |
146 |
146 |
147 /** |
147 /** |
148 * Removes a content ID from the list of currently consumed contents |
148 * Removes a content ID from the list of currently consumed contents |
149 * with count constraints |
149 * with count constraints |
150 * |
150 * |
151 * @since 3.0 |
151 * @since 3.0 |
152 * @param aContentId content ID to remove |
152 * @param aContentId content ID to remove |
153 */ |
153 */ |
154 void RemoveActiveCountConstraint( const TDesC8& aContentId ); |
154 void RemoveActiveCountConstraint( const TDesC8& aContentId ); |
155 |
155 |
156 /** |
156 /** |
157 * Adds a content ID to the list of currently consumed contents |
157 * Adds a content ID to the list of currently consumed contents |
158 * with count constraints |
158 * with count constraints |
159 * |
159 * |
160 * @since 3.0 |
160 * @since 3.0 |
161 * @param aContentId content ID to add |
161 * @param aContentId content ID to add |
162 */ |
162 */ |
163 void AddActiveCountConstraintL( const TDesC8& aContentId ); |
163 void AddActiveCountConstraintL( const TDesC8& aContentId ); |
164 |
164 |
165 /** |
165 /** |
166 * Import rights objects on startup |
166 * Import rights objects on startup |
167 * |
167 * |
168 * @since 3.0 |
168 * @since 3.0 |
169 * @param aImportDir Directory to import from |
169 * @param aImportDir Directory to import from |
170 */ |
170 */ |
171 void ImportRightsObjectsL( const TDesC& aImportDir ); |
171 void ImportRightsObjectsL( const TDesC& aImportDir ); |
172 |
172 |
173 /** |
173 /** |
174 * Stop watching the DCF repository server and the rights DB |
174 * Stop watching the DCF repository server and the rights DB |
175 * @since 3.1 |
175 * @since 3.1 |
176 */ |
176 */ |
177 void StopWatchingL(); |
177 void StopWatchingL(); |
178 |
178 |
179 public: // Functions from base classes |
179 public: // Functions from base classes |
180 |
180 |
181 //class MBackupOperationObserver |
181 //class MBackupOperationObserver |
182 |
182 |
183 /** |
183 /** |
184 * HandleNotifyL |
184 * HandleNotifyL |
185 * @since S60Rel2.5 |
185 * @since S60Rel2.5 |
186 * @param aBackupOperationAttributes Event related attributes. |
186 * @param aBackupOperationAttributes Event related attributes. |
187 */ |
187 */ |
188 void HandleNotifyL(const TUid aUid, const TDesC& aKey, |
188 void HandleNotifyL(const TUid aUid, const TDesC& aKey, |
189 const TDesC& aValue); |
189 const TDesC& aValue); |
190 |
190 |
191 //class MWatcherObserver |
191 //class MWatcherObserver |
192 |
192 |
193 /** |
193 /** |
194 * Called when the RDB has been modified |
194 * Called when the RDB has been modified |
195 * |
195 * |
196 * @since S60 3.0 |
196 * @since S60 3.0 |
197 * @param aObject Changed directory |
197 * @param aObject Changed directory |
198 */ |
198 */ |
199 void WatchedObjectChangedL( const TDesC& aObject ); |
199 void WatchedObjectChangedL( const TDesC& aObject ); |
200 |
200 |
201 protected: // New functions |
201 protected: // New functions |
202 |
202 |
203 protected: // Functions from base classes |
203 protected: // Functions from base classes |
204 |
204 |
205 //class CServer |
205 //class CServer |
206 /** |
206 /** |
207 * RunError. |
207 * RunError. |
208 * @since S60Rel2.5 |
208 * @since S60Rel2.5 |
209 * @param aError Error code from RunL function. |
209 * @param aError Error code from RunL function. |
210 * @return An error is returned if RunError() cannot process the |
210 * @return An error is returned if RunError() cannot process the |
211 * error. |
211 * error. |
212 */ |
212 */ |
213 TInt RunError( TInt aError ); |
213 TInt RunError( TInt aError ); |
214 |
214 |
215 private: |
215 private: |
216 /** |
216 /** |
217 * C++ default constructor. |
217 * C++ default constructor. |
218 * @since S60Rel2.5 |
218 * @since S60Rel2.5 |
219 */ |
219 */ |
220 CDRMRightsServer(); |
220 CDRMRightsServer(); |
221 |
221 |
222 /** |
222 /** |
223 * By default Symbian 2nd phase constructor is private. |
223 * By default Symbian 2nd phase constructor is private. |
224 * @since S60Rel2.5 |
224 * @since S60Rel2.5 |
225 */ |
225 */ |
226 void ConstructL(); |
226 void ConstructL(); |
227 |
227 |
228 /** |
228 /** |
229 * This method fetches the database key and stores |
229 * This method fetches the database key and stores |
230 * it to the given descriptor. |
230 * it to the given descriptor. |
231 * @since S60Rel2.5 |
231 * @since S60Rel2.5 |
232 * @param aKey Descriptor where the key is stored. |
232 * @param aKey Descriptor where the key is stored. |
233 */ |
233 */ |
234 void GetDbKeyL( TDRMKey& aKey ); |
234 void GetDbKeyL( TDRMKey& aKey ); |
235 |
235 |
236 /** |
236 /** |
237 * This method generates the actual key from key seed. |
237 * This method generates the actual key from key seed. |
238 * @since S60Rel2.5 |
238 * @since S60Rel2.5 |
239 * @param aKeySeed Key seed. |
239 * @param aKeySeed Key seed. |
240 * @param aKey The key produced. |
240 * @param aKey The key produced. |
241 */ |
241 */ |
242 void GenerateKeyL( HBufC*& aKeySeed, |
242 void GenerateKeyL( HBufC*& aKeySeed, |
243 TDRMKey& aKey ) const; |
243 TDRMKey& aKey ) const; |
244 |
244 |
245 |
245 |
246 void StartThreadL( const TDesC& aThreadName, |
246 void StartThreadL( const TDesC& aThreadName, |
247 TThreadFunction aFunc, |
247 TThreadFunction aFunc, |
248 RSemaphore& aSemaphore ); |
248 RSemaphore& aSemaphore ); |
249 |
249 |
250 |
250 |
251 void AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone = NULL); |
251 void AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone = NULL); |
252 static void Release(TAny* aIndividualConstraintExtension); |
252 static void Release(TAny* aIndividualConstraintExtension); |
253 |
253 |
254 private: // Functions from base classes |
254 private: // Functions from base classes |
255 // Class CServer |
255 // Class CServer |
256 /** |
256 /** |
257 * NewSessionL |
257 * NewSessionL |
258 * @since S60Rel2.5 |
258 * @since S60Rel2.5 |
259 */ |
259 */ |
260 CSession2* NewSessionL( const TVersion& aVersion, |
260 CSession2* NewSessionL( const TVersion& aVersion, |
261 const RMessage2& aMessage) const; |
261 const RMessage2& aMessage) const; |
262 |
262 |
263 public: // Data |
263 public: // Data |
264 |
264 |
265 protected: // Data |
265 protected: // Data |
266 |
266 |
267 private: // Data |
267 private: // Data |
268 CDRMRightsDB* iDb; |
268 CDRMRightsDB* iDb; |
269 |
269 |
270 CDRMNotifier* iNotifier; |
270 CDRMNotifier* iNotifier; |
271 |
271 |
272 RFs iFs; |
272 RFs iFs; |
273 RDRMReplayCache iCache; |
273 RDRMReplayCache iCache; |
274 RDrmMeteringDb iMeteringDb; |
274 RDrmMeteringDb iMeteringDb; |
275 RDRMClockClient iClock; |
275 RDRMClockClient iClock; |
276 RPointerArray<CDRMXOma>* iXOmaHeaders; |
276 RPointerArray<CDRMXOma>* iXOmaHeaders; |
277 RPointerArray<HBufC8> iActiveCountConstraints; |
277 RPointerArray<HBufC8> iActiveCountConstraints; |
278 |
278 |
279 HBufC* iIMEI; |
279 HBufC* iIMEI; |
280 |
280 |
281 // Backup Observer |
281 // Backup Observer |
282 CDRMBackupObserver* iBackupObserver; |
282 CDRMBackupObserver* iBackupObserver; |
283 |
283 |
284 // BackupHandler |
284 // BackupHandler |
285 CDRMBackup* iBackupHandler; |
285 CDRMBackup* iBackupHandler; |
286 |
286 |
287 // Backup client |
287 // Backup client |
288 conn::CActiveBackupClient* iActiveBackupClient; |
288 conn::CActiveBackupClient* iActiveBackupClient; |
289 |
289 |
290 // RDB Watcher |
290 // RDB Watcher |
291 CDbWatcher* iDbWatcher; |
291 CDbWatcher* iDbWatcher; |
292 |
292 |
293 // Peer process watcher |
293 // Peer process watcher |
294 CProcWatcher* iProcWatcher; |
294 CProcWatcher* iProcWatcher; |
295 |
295 |
296 // Watching causes a restart |
296 // Watching causes a restart |
297 TBool iArmed; |
297 TBool iArmed; |
298 |
298 |
299 CDRMPointerArray<HBufC8>* iIMSI; |
299 CDRMPointerArray<HBufC8>* iIMSI; |
300 TBool iGetImsi; |
300 TBool iGetImsi; |
301 |
301 |
302 public: // Friend classes |
302 public: // Friend classes |
303 |
303 |
304 protected: // Friend classes |
304 protected: // Friend classes |
305 |
305 |
306 private: // Friend classes |
306 private: // Friend classes |
307 |
307 |
308 }; |
308 }; |
309 |
309 |
310 #endif // CDRMRIGHTSSERVER_H |
310 #endif // CDRMRIGHTSSERVER_H |
311 |
311 |
312 // End of File |
312 // End of File |