1 /* |
|
2 * Copyright (c) 2003 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: Client side class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <s32file.h> |
|
21 #include "DRMRightsClient.h" |
|
22 #include "DRMClientServer.h" |
|
23 #ifdef _DRM_TESTING |
|
24 #include "logfile.h" |
|
25 #endif |
|
26 |
|
27 // EXTERNAL DATA STRUCTURES |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 #ifdef CLIENT_STARTS_SERVER |
|
30 extern TInt DRMServerStarter(); |
|
31 #endif |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // RDRMRightsClient::RDRMRightsClient |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C RDRMRightsClient::RDRMRightsClient() : |
|
42 iPtr( NULL ) |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // RDRMRightsClient::~RDRMRightsClient |
|
48 // Destructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C RDRMRightsClient::~RDRMRightsClient() |
|
52 { |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // RDRMRightsClient::Connect |
|
57 // Opens connection to the server. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C TInt RDRMRightsClient::Connect() |
|
61 { |
|
62 return KErrNone; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // RDRMRightsClient::Close |
|
67 // Closes the connection to the server. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 EXPORT_C void RDRMRightsClient::Close() |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // RDRMRightsClient::AddRecord |
|
76 // Add a new entry to the rights database. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C TInt RDRMRightsClient::AddRecord( const TDesC8& aCEK, // Content encryption key |
|
80 // The rights object which is to be added |
|
81 const CDRMPermission& aRightsObject, |
|
82 const TDesC8& aCID, // Content-ID |
|
83 TDRMUniqueID& aID ) // Unique ID, out-parameter |
|
84 { |
|
85 return KErrNone; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // RDRMRightsClient::GetDBEntriesL |
|
91 // Get a file name from the server. The file contains the rights objects, |
|
92 // which are then converted to RPointerArray. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void RDRMRightsClient::GetDBEntriesL( const TDesC8& aId, |
|
96 RPointerArray< CDRMPermission >& aRightsList ) |
|
97 { |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // RDRMRightsClient::GetDbEntryL |
|
102 // Get a single RO from the server. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C CDRMPermission* RDRMRightsClient::GetDbEntryL( const TDesC8& aContentID, |
|
106 const TDRMUniqueID& aUniqueID ) |
|
107 { |
|
108 CDRMPermission* object = new (ELeave) CDRMPermission; |
|
109 object->iUniqueID = aUniqueID; |
|
110 return object; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // RDRMRightsClient::DeleteDbEntry |
|
115 // Deletes all rights objects associated with the given UID. |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID ) |
|
119 { |
|
120 return KErrNone; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // RDRMRightsClient::DeleteDbEntry |
|
125 // Delete a single rights object identified by given parameters. |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID, |
|
129 const TDRMUniqueID& aUniqueID ) |
|
130 { |
|
131 return KErrNone; |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // RDRMRightsClient::ExportContentIDList |
|
136 // Overloaded method: requests all content IDs to be put to a file. |
|
137 // Assumes that the given descriptor represents a buffer large enough to |
|
138 // contain the file name. |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 EXPORT_C TInt RDRMRightsClient::ExportContentIDList( TDes& aFileName ) |
|
142 { |
|
143 return KErrNone; |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // RDRMRightsClient::ExportContentIDList |
|
148 // Overloaded method: requests all content IDs to be put to a file, |
|
149 // and then converts the file into RPointerArray. |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 EXPORT_C TInt RDRMRightsClient::ExportContentIDList( RPointerArray< HBufC8 >& aCIDList ) |
|
153 { |
|
154 return KErrNone; |
|
155 } |
|
156 |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // RDRMRightsClient::GetDecryptionKey |
|
160 // Fetches the decryption key from the server. |
|
161 // Uses TR mechanisms. Uses asynchronous C/S call. |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 EXPORT_C TInt RDRMRightsClient::GetDecryptionKey( const TInt aIntent, |
|
165 const TDesC8& aContentID, |
|
166 const TBool aUpdate, |
|
167 TDes8& aKey ) |
|
168 { |
|
169 aKey.Copy(_L("0000000000000000")); |
|
170 return KErrNone; |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // RDRMRightsClient::CheckRights |
|
175 // Checks if appropriate rights exist for a certain content ID. |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C TInt RDRMRightsClient::CheckRights( const TInt aIntent, |
|
179 const TDesC8& aContentID ) |
|
180 { |
|
181 return KErrNone; |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // RDRMRightsClient::Count |
|
186 // Returns the amount of unique content IDs in the database. |
|
187 // If an error occurs, a negative value is returned (Symbian OS / DRM 3 specific |
|
188 // error code). |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 EXPORT_C TInt RDRMRightsClient::Count() |
|
192 { |
|
193 return 1; |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // RDRMRightsClient::DeleteAll |
|
198 // Empties the database. |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C TInt RDRMRightsClient::DeleteAll() |
|
202 { |
|
203 return KErrNone; |
|
204 } |
|
205 |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // RDRMRightsClient::Consume() |
|
209 // Consume the right with specific intent and contentID |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, const TDesC8& aContentID, const TInt aActionIntent ) |
|
213 { |
|
214 return KErrNone; |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // RDRMRightsClient::CalculatePadding |
|
219 // Calculate the padding from a data block and a certain content ID. |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 EXPORT_C TInt RDRMRightsClient::CalculatePadding( |
|
223 const TDesC8& aContentID, |
|
224 const TDesC8& aLastTwoDataBlocks) |
|
225 { |
|
226 return 0; |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // RDRMRightsClient::FileToListL |
|
231 // Converts the given file into an array. |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 void RDRMRightsClient::FileToListL( RFs& aFs, |
|
235 const TDesC& aFileName, |
|
236 RPointerArray< CDRMPermission >& aList ) |
|
237 { |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // RDRMRightsClient::URIFileToArrayL |
|
242 // Converts the given file into an array. |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 void RDRMRightsClient::URIFileToArrayL( RFs& aFs, |
|
246 const TDesC& aFile, |
|
247 RPointerArray< HBufC8 >& aList ) |
|
248 { |
|
249 } |
|
250 |
|
251 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
252 |
|
253 // End of File |
|