|
1 /* |
|
2 * Copyright (c) 2004 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: Datatype for the Common Rights Database Data |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DRMCOMMONDATA_H |
|
20 #define DRMCOMMONDATA_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // MACROS |
|
29 |
|
30 // DATA TYPES |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class RReadStream; |
|
34 class RWriteStream; |
|
35 |
|
36 // TYPE DEFINITIONS |
|
37 |
|
38 // FUNCTION PROTOTYPES |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * CDRMCommonData implements a datatype for the common data for a single |
|
44 * content identifier |
|
45 * |
|
46 * @lib RightsServer.dll |
|
47 * @since 3.0 |
|
48 */ |
|
49 |
|
50 class CDRMCommonData : public CBase |
|
51 { |
|
52 |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * NewLC |
|
57 * |
|
58 * Creates an instance of the CDRMCommonData class and returns a pointer |
|
59 * to it. The function leaves the object into the cleanup stack |
|
60 * |
|
61 * @since 3.0 |
|
62 * @param aContentID : Content Identifier |
|
63 * @param aContentHash : Content Hash |
|
64 * @param aRightsIssuer : Rights Issuer for this content |
|
65 * @return Functional CDRMCommonData object, Function leaves if an error |
|
66 * occurs. |
|
67 */ |
|
68 static CDRMCommonData* NewLC( const TDesC8& aContentID, |
|
69 const TDesC8& aContentHash, |
|
70 const TDesC8& aRightsIssuer, |
|
71 const TDesC& aContentName, |
|
72 const TDesC8& aAuthenticationSeed ); |
|
73 |
|
74 /** |
|
75 * NewL |
|
76 * |
|
77 * Creates an instance of the CDRMCommonData class and returns a pointer |
|
78 * to it. |
|
79 * |
|
80 * @since 3.0 |
|
81 * @param aContentID : Content Identifier |
|
82 * @param aContentHash : Content Hash |
|
83 * @param aRightsIssuer : Rights Issuer for this content |
|
84 * @return Functional CDRMCommonData object, Function leaves if an error |
|
85 * occurs. |
|
86 */ |
|
87 static CDRMCommonData* NewL( const TDesC8& aContentID, |
|
88 const TDesC8& aContentHash, |
|
89 const TDesC8& aRightsIssuer, |
|
90 const TDesC& aContentName, |
|
91 const TDesC8& aAuthenticationSeed ); |
|
92 |
|
93 /** |
|
94 * NewLC |
|
95 * |
|
96 * Creates an empty instance of the CDRMCommonData class and returns a pointer |
|
97 * to it. The function leaves the object into the cleanup stack |
|
98 * |
|
99 * @since 3.0 |
|
100 * @return Functional CDRMCommonData object, Function leaves if an error |
|
101 * occurs. |
|
102 */ |
|
103 static CDRMCommonData* NewLC(); |
|
104 |
|
105 /** |
|
106 * NewL |
|
107 * |
|
108 * Creates an empty instance of the CDRMCommonData class and returns a pointer |
|
109 * to it. |
|
110 * |
|
111 * @since 3.0 |
|
112 * @return Functional CDRMCommonData object, Function leaves if an error |
|
113 * occurs. |
|
114 */ |
|
115 static CDRMCommonData* NewL(); |
|
116 |
|
117 |
|
118 /** |
|
119 * Destructor |
|
120 */ |
|
121 virtual ~CDRMCommonData(); |
|
122 |
|
123 |
|
124 /** |
|
125 * ContentID |
|
126 * |
|
127 * Returns a constant HBufC8 pointer to the content id |
|
128 * |
|
129 * @since 3.0 |
|
130 * @return a pointer to the content id or null |
|
131 */ |
|
132 const TDesC8& ContentID() const; |
|
133 |
|
134 /** |
|
135 * ContentHash |
|
136 * |
|
137 * Returns a constant HBufC8 pointer to the content hash |
|
138 * |
|
139 * @since 3.0 |
|
140 * @return a pointer to the content hash or null |
|
141 */ |
|
142 const TDesC8& ContentHash() const; |
|
143 |
|
144 /** |
|
145 * RightsIssuer |
|
146 * |
|
147 * Returns a constant HBufC8 pointer to the rights issuer |
|
148 * |
|
149 * @since 3.0 |
|
150 * @return a pointer to the rights issuer or null |
|
151 */ |
|
152 const TDesC8& RightsIssuer() const; |
|
153 |
|
154 /** |
|
155 * CotentName |
|
156 * |
|
157 * Return a constant HBufC pointer to the content name |
|
158 * |
|
159 * @since 3.0 |
|
160 * @return a pointer to the content name or null |
|
161 */ |
|
162 const TDesC& ContentName() const; |
|
163 |
|
164 /** |
|
165 * AuthenticationSeed |
|
166 * |
|
167 * Returns a constant HBufC8 pointer to the authentication seed |
|
168 * |
|
169 * @since 3.0 |
|
170 * @return a pointer to the authentication seed or null |
|
171 */ |
|
172 const TDesC8& AuthenticationSeed() const; |
|
173 |
|
174 /** |
|
175 * SetContentIDL |
|
176 * |
|
177 * Sets the content id, deletes the previous one if one |
|
178 * exits |
|
179 * |
|
180 * @since 3.0 |
|
181 * @param aContentID : Content Identifier |
|
182 * @return The function leaves with Symbian OS error code if an |
|
183 * error occurs |
|
184 */ |
|
185 void SetContentIDL( const TDesC8& aContentID ); |
|
186 |
|
187 /** |
|
188 * SetContentHashL |
|
189 * |
|
190 * Sets the content hash, deletes the previous one if one |
|
191 * exits |
|
192 * |
|
193 * @since 3.0 |
|
194 * @param aContentHash : Content Hash |
|
195 * @return The function leaves with Symbian OS error code if an |
|
196 * error occurs |
|
197 */ |
|
198 void SetContentHashL( const TDesC8& aContentHash ); |
|
199 |
|
200 /** |
|
201 * SetRightsIssuerL |
|
202 * |
|
203 * Sets the rights issuer, deletes the previous one if one |
|
204 * exits |
|
205 * |
|
206 * @since 3.0 |
|
207 * @param aRightsIssuer : Rights Issuer for this content |
|
208 * @return The function leaves with Symbian OS error code if an |
|
209 * error occurs |
|
210 */ |
|
211 void SetRightsIssuerL( const TDesC8& aRightsIssuer ); |
|
212 |
|
213 |
|
214 /** |
|
215 * SetContentNameL |
|
216 * |
|
217 * Sets the content name, deletes the previous one if it exists |
|
218 * |
|
219 * @since 3.0 |
|
220 * @param aContentName : The name that is given to the content |
|
221 * @return The function leaves with Symbian OS error code if an |
|
222 * error occurs |
|
223 */ |
|
224 void SetContentNameL( const TDesC& aContentName ); |
|
225 |
|
226 /** |
|
227 * SetAuthenticationSeedL |
|
228 * |
|
229 * Sets the authentication seed, deletes the previous one if one |
|
230 * exits |
|
231 * |
|
232 * @since 3.0 |
|
233 * @param aAuthenticationSeed : Rights Issuer for this content |
|
234 * @return The function leaves with Symbian OS error code if an |
|
235 * error occurs |
|
236 */ |
|
237 void SetAuthenticationSeedL( const TDesC8& aAuthenticationSeed ); |
|
238 |
|
239 |
|
240 /** |
|
241 * ExternalizeL |
|
242 * |
|
243 * Writes the data of the object into the stream |
|
244 * |
|
245 * @since 3.0 |
|
246 * @param aStream : the output stream to write to |
|
247 * @return The function leaves with Symbian OS error code if an |
|
248 * error occurs |
|
249 */ |
|
250 void ExternalizeL( RWriteStream& aStream ) const; |
|
251 |
|
252 /** |
|
253 * InternalizeL |
|
254 * |
|
255 * Reads the data of the object from the stream |
|
256 * |
|
257 * @since 3.0 |
|
258 * @param aStream : the output stream to write to |
|
259 * @return The function leaves with Symbian OS error code if an |
|
260 * error occurs |
|
261 */ |
|
262 void InternalizeL( RReadStream& aStream ); |
|
263 |
|
264 |
|
265 /** |
|
266 * Size |
|
267 * |
|
268 * Returns the size of the externalized object |
|
269 * |
|
270 * @since 3.0 |
|
271 * @return the amount of bytes the externalize object occupies |
|
272 */ |
|
273 TInt Size() const; |
|
274 |
|
275 private: |
|
276 /** |
|
277 * Default Constructor - First phase. |
|
278 */ |
|
279 CDRMCommonData(); |
|
280 |
|
281 /** |
|
282 * ConstructL |
|
283 * |
|
284 * Second phase constructor |
|
285 * |
|
286 * @since 3.0 |
|
287 * @param aContentID : Content Identifier |
|
288 * @param aContentHash : Content Hash |
|
289 * @param aRightsIssuer : Rights Issuer for this content |
|
290 * @return Functional CDRMCommonData object, Function leaves if an error |
|
291 * occurs. |
|
292 */ |
|
293 void ConstructL( const TDesC8& aContentID, |
|
294 const TDesC8& aContentHash, |
|
295 const TDesC8& aRightsIssuer, |
|
296 const TDesC& aContentName, |
|
297 const TDesC8& aAuthenticationSeed ); |
|
298 |
|
299 /** |
|
300 * Assignment operator - Prevented |
|
301 */ |
|
302 CDRMCommonData& operator =( const CDRMCommonData& ); |
|
303 |
|
304 /** |
|
305 * Copy constructor - Prevented |
|
306 */ |
|
307 CDRMCommonData( const CDRMCommonData& ); |
|
308 |
|
309 |
|
310 private: // Internal Data |
|
311 |
|
312 // Content identifier of the content |
|
313 HBufC8* iContentID; |
|
314 |
|
315 // Hash of the content DCF |
|
316 HBufC8* iContentHash; |
|
317 |
|
318 // Issuer of the rights |
|
319 HBufC8* iRightsIssuer; |
|
320 |
|
321 // Content name |
|
322 HBufC* iContentName; |
|
323 |
|
324 // Authentication seed |
|
325 HBufC8* iAuthenticationSeed; |
|
326 }; |
|
327 |
|
328 #endif // DRMCOMMONDATA_H |
|
329 |
|
330 // End of File |