|
1 /* |
|
2 * Copyright (c) 2002-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: Declaration of the DCF file format class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef OMA2DCF_H |
|
21 #define OMA2DCF_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "Oma2Agent.h" |
|
25 #include "DcfCommon.h" |
|
26 |
|
27 // LOCAL CONSTANTS AND MACROS |
|
28 /* constant for variable-length definitions */ |
|
29 #define SRVSEC_ANY_SIZE 1 |
|
30 |
|
31 #define SWAP32( num ) ( (num) = ( (((num) & 0xff000000) >>24) | (((num) & 0x00ff0000) >>8) | \ |
|
32 (((num) & 0x0000ff00) <<8) | (((num) & 0x000000ff) <<24) ) ) |
|
33 |
|
34 // STRUCTURES |
|
35 typedef struct |
|
36 { |
|
37 TUint32 size; |
|
38 TUint32 type; |
|
39 TUint32 versionAndFlags; |
|
40 } tBoxHeaderStr; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 class COma2DcfPartInfo; |
|
44 |
|
45 /** |
|
46 * Encapsulates an OMA DRM 2.0 DCF file |
|
47 * |
|
48 * @lib DrmDcf.lib |
|
49 * @since Series 60 3.0 |
|
50 */ |
|
51 class COma2Dcf : public CDcfCommon |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 IMPORT_C static COma2Dcf* NewL( |
|
59 const RFile& aFile, |
|
60 TInt aPart = 0); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 IMPORT_C virtual ~COma2Dcf(); |
|
66 |
|
67 public: // New functions |
|
68 |
|
69 IMPORT_C void SetTransactionIdL( |
|
70 const TDesC8& aTransactionId); |
|
71 |
|
72 IMPORT_C void SetRightsObjectsL( |
|
73 RPointerArray<HBufC8>& aRoList); |
|
74 |
|
75 IMPORT_C void GetHashL(); |
|
76 |
|
77 IMPORT_C static TBool IsValidDcf( |
|
78 const TDesC8& aDcfFragment); |
|
79 |
|
80 void ReadPartsL(void); |
|
81 |
|
82 void ReadContainerL( |
|
83 TInt aOffset, |
|
84 TInt& aSize); |
|
85 |
|
86 void ReadDiscreteMediaHeaderL( |
|
87 TInt aOffset, |
|
88 TInt& aSize); |
|
89 |
|
90 void ReadContentObjectL( |
|
91 TInt aOffset, |
|
92 TInt& aSize); |
|
93 |
|
94 void ReadCommonHeadersL( |
|
95 TInt aOffset, |
|
96 TInt& aSize); |
|
97 |
|
98 void ReadMutableInfoL( |
|
99 TInt aOffset, |
|
100 TInt& aSize); |
|
101 |
|
102 void ReadExtendedHeadersL( |
|
103 TInt aOffset, |
|
104 TInt aEndOfBox); |
|
105 |
|
106 void ReadBoxSizeAndTypeL( |
|
107 TInt aOffset, |
|
108 TInt& aSize, |
|
109 TUint32& aType, |
|
110 TInt& aHeaderSize); |
|
111 |
|
112 void ParseTextualHeadersL( |
|
113 const TDesC8& aMemoryBlock); |
|
114 |
|
115 void RewriteMutableInfoL( |
|
116 const TDesC8& aTransactionId, |
|
117 RPointerArray<HBufC8>& aRoList); |
|
118 |
|
119 TInt CheckUniqueId( |
|
120 const TDesC& aUniqueId); |
|
121 |
|
122 TInt OpenPart( |
|
123 const TDesC& aUniqueId); |
|
124 |
|
125 TInt OpenPart( |
|
126 TInt aPart); |
|
127 |
|
128 void GetPartIdsL( |
|
129 RPointerArray<HBufC8>& aPartList); |
|
130 |
|
131 private: // New functions |
|
132 /** |
|
133 * VerifyTypeL |
|
134 * @param aType the type value to be verified |
|
135 * @param aRefType the reference type |
|
136 */ |
|
137 void VerifyTypeL( |
|
138 TUint32 aType, |
|
139 TUint32 aRefType); |
|
140 |
|
141 /** |
|
142 * ReadOneTextualHeaderL |
|
143 * @param aBlock header buffer |
|
144 * @param aName Textual header name |
|
145 * @param aBuf Buffer to save value, if not found, it should be NULL, previous data is discarded |
|
146 * @param aError KErrNone if the header was found, otherwise KErrNotFound or other errors |
|
147 * @return Offset of the header in the data block |
|
148 */ |
|
149 TInt ReadOneTextualHeaderL( |
|
150 const TDesC8& aBlock, |
|
151 const TDesC8& aName, |
|
152 HBufC8*& aBuf, |
|
153 TInt& aError); |
|
154 |
|
155 /** |
|
156 * SetHeaderWithParameterL |
|
157 * @param aValue header value |
|
158 * @param aMethod Buffer to save method value, if not found, it should be NULL, previous data is discarded |
|
159 * @param aParameter Buffer to save paramter value, if not found, it should be NULL, previous data is discarded |
|
160 */ |
|
161 void SetHeaderWithParameterL( |
|
162 const TDesC8& aValue, |
|
163 HBufC8*& aMethod, |
|
164 HBufC8*& aParameter); |
|
165 |
|
166 void ReadPartInfoL( |
|
167 COma2DcfPartInfo* aPart, |
|
168 TInt aOffset); |
|
169 |
|
170 void ReadUserDataL( |
|
171 TInt aOffset, |
|
172 TInt& aSize); |
|
173 |
|
174 void ParseUserDataSubBoxesL( |
|
175 const TDesC8& aMemoryBlock); |
|
176 |
|
177 void ReadOneUserDataBoxL( |
|
178 const TDesC8& aBlock, |
|
179 const TDesC8& aName, |
|
180 HBufC8*& aBuf); |
|
181 |
|
182 |
|
183 protected: |
|
184 |
|
185 /** |
|
186 * C++ default constructor. |
|
187 */ |
|
188 COma2Dcf(); |
|
189 |
|
190 /** |
|
191 * Symbian 2nd phase constructor. |
|
192 */ |
|
193 void ConstructL( |
|
194 const RFile& aFile, |
|
195 TInt aPart); |
|
196 public: // Data |
|
197 TEncryptionPadding iEncrytionPadding; |
|
198 TSilentRefresh iSilentRefresh; |
|
199 TPreview iPreview; |
|
200 HBufC8* iPreviewParameter; |
|
201 HBufC8* iSilentParameter; |
|
202 HBufC8* iTextualHeaders; |
|
203 HBufC8* iContentUrl; |
|
204 HBufC8* iContentVersion; |
|
205 HBufC8* iContentLocation; |
|
206 HBufC8* iTransactionTracking; |
|
207 RPointerArray<HBufC8> iRightsObjects; |
|
208 HBufC8* iUserData; |
|
209 HBufC8* iAuthor; |
|
210 HBufC8* iCopyRight; |
|
211 HBufC8* iInfoUri; |
|
212 HBufC8* iGroupId; |
|
213 HBufC8* iGroupKey; |
|
214 TEncryptionMethod iGkEncryptionMethod; |
|
215 RPointerArray<COma2DcfPartInfo> iParts; |
|
216 COma2DcfPartInfo* iMutablePart; |
|
217 |
|
218 // metadataboxes |
|
219 HBufC8* iPerformer; |
|
220 HBufC8* iGenre; |
|
221 HBufC8* iRatingInfo; |
|
222 HBufC8* iClassificationInfo; |
|
223 HBufC8* iKeyword; |
|
224 HBufC8* iLocInfoName; |
|
225 HBufC8* iLocInfoAstronomicalBody; |
|
226 HBufC8* iLocInfoAdditionalNotes; |
|
227 HBufC8* iAlbumTitle; |
|
228 HBufC8* iCoverUri; |
|
229 HBufC8* iLyricsURL; |
|
230 TUint16 iRecordingYear; |
|
231 TUint8 iAlbumTrack; |
|
232 |
|
233 // Set to ETrue if both preview and silent headers are present |
|
234 // and preview rights are to be used, EFalse otherwise |
|
235 TBool iPreviewOverridesSilentRefresh; |
|
236 |
|
237 protected: // Data |
|
238 |
|
239 private: // Data |
|
240 TBool iUserDataLanguageDefined; |
|
241 }; |
|
242 |
|
243 #endif // OMA2DCF_H |
|
244 |
|
245 // End of File |