|
1 /* |
|
2 * Copyright (c) 2003 -2006 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: |
|
15 * Takes care of DRM attachments |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MMSDRM_H |
|
22 #define MMSDRM_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <f32file.h> |
|
28 #include <s32strm.h> |
|
29 |
|
30 #include <badesca.h> |
|
31 #include <caf/importfile.h> |
|
32 #include <caf/supplier.h> |
|
33 #include <caf/supplieroutputfile.h> |
|
34 #include <caf/metadataarray.h> |
|
35 #include <caf/metadata.h> |
|
36 #include <caf/caferr.h> |
|
37 using namespace ContentAccess; |
|
38 |
|
39 // CONSTANTS |
|
40 _LIT8( KMmsDrmImportFile, "application/x-vnd.oma.drm.import" ); // DRM Import file |
|
41 const TInt KMmsImportFileLength = 32; |
|
42 _LIT8( KMmsForwardHeader, "fwd" ); |
|
43 _LIT8( KMmsRingtoneHeader, "ringtone" ); |
|
44 _LIT8( KMmsNoHeader, "no" ); |
|
45 _LIT8( KMmsContentTypeHeader, "Content-type" ); |
|
46 // Temporary definition until the URI is defined in some common include file |
|
47 _LIT8( KMmsHutchContentURI, "flk:flkS60_3_0_Hutchinson_2005"); |
|
48 |
|
49 // MACROS |
|
50 |
|
51 // DATA TYPES |
|
52 |
|
53 // FUNCTION PROTOTYPES |
|
54 |
|
55 // FORWARD DECLARATIONS |
|
56 |
|
57 class CMsvMimeHeaders; |
|
58 class CMsvStore; |
|
59 |
|
60 // CLASS DECLARATION |
|
61 |
|
62 NONSHARABLE_CLASS( CMmsDrmCaf ) : public CBase |
|
63 { |
|
64 public: // Constructors and destructor |
|
65 |
|
66 /** |
|
67 * Two-phased constructor. |
|
68 */ |
|
69 static CMmsDrmCaf* NewL(); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 virtual ~CMmsDrmCaf(); |
|
75 |
|
76 /** |
|
77 * Check if DRM handling is needed. |
|
78 * If DRM handling is needed, a CImportFile is created using Mime content |
|
79 * type and X-type parameters found in aMimeHeaders. |
|
80 * If this function returns ETrue, CMmsDrm is ready to process data |
|
81 * @param aMimeHeaders reference to callers mime headers. |
|
82 * Should contain content-type and X-type headers (copied to metadata) |
|
83 * @return ETrue: registration was successful, and DRM handling will be needed |
|
84 * EFalse: no DRM handling needed, use attachment as is |
|
85 */ |
|
86 TBool RegisterL( const CMsvMimeHeaders& aMimeHeaders ); |
|
87 |
|
88 /** |
|
89 * |
|
90 */ |
|
91 void StartProcessingL( RFile& aStartFile, const TDesC& aAttachmentFilePath, CMsvStore& aStore ); |
|
92 |
|
93 /** |
|
94 * |
|
95 */ |
|
96 TInt WriteData( const TDesC8& aData ); |
|
97 |
|
98 /** |
|
99 * |
|
100 */ |
|
101 void EndProcessingL(); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * C++ constructor. |
|
107 */ |
|
108 CMmsDrmCaf(); |
|
109 |
|
110 /** |
|
111 * |
|
112 */ |
|
113 void ConstructL(); |
|
114 |
|
115 /** |
|
116 * |
|
117 */ |
|
118 void NewFileL(); |
|
119 |
|
120 |
|
121 |
|
122 private: // Data |
|
123 CImportFile* iImportFile; |
|
124 CSupplier* iSupplier; |
|
125 HBufC* iAttachmentFilePath; |
|
126 // This is caller's store. Must not be deleted or closed |
|
127 CMsvStore* iStore; |
|
128 // Open file handle for writing the attachment |
|
129 RFile iAttachmentFile; |
|
130 |
|
131 |
|
132 }; |
|
133 |
|
134 #endif // MMSDRM_H |
|
135 |
|
136 // End of File |