|
1 /* |
|
2 * Copyright (c) 2008-2009 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: HTTP plugin framework interface for WMDRM DLA |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_WMDRMDLAHTTPMETERINGPLUGINFW_H |
|
20 #define C_WMDRMDLAHTTPMETERINGPLUGINFW_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <wmdrmdlatypes.h> |
|
25 #include <wmdrmdlacancelobserver.h> |
|
26 |
|
27 class CWmDrmDlaHttpPluginIf; |
|
28 class CWmDrmDlaUiNotifier; |
|
29 |
|
30 /** |
|
31 * Implementation class for WMDRM DLA HTTP Metering FW |
|
32 * @since S60 v9.1 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CWmDrmDlaHttpMeteringPluginFw ) |
|
35 : public CActive, public MWmDrmDlaCancelObserver |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 static CWmDrmDlaHttpMeteringPluginFw* NewL(); |
|
41 static CWmDrmDlaHttpMeteringPluginFw* NewLC(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CWmDrmDlaHttpMeteringPluginFw(); |
|
47 |
|
48 /** |
|
49 * Handles metering certificate OTA |
|
50 * |
|
51 * @param aCertificate metering certificate |
|
52 * @param aStatus Request status. On completion contains the error code. |
|
53 */ |
|
54 void ProcessMeteringCertificate( const TDesC8& aCertificate, |
|
55 TRequestStatus& aStatus ); |
|
56 |
|
57 /* |
|
58 * Cancels metering |
|
59 */ |
|
60 void CancelMetering(); |
|
61 |
|
62 /** |
|
63 * Sets the IAP to be used in the HTTP transactions |
|
64 * |
|
65 * @param aIapId Internet Access Point id |
|
66 */ |
|
67 void SetIapId( TInt aIapId ); |
|
68 |
|
69 protected: |
|
70 |
|
71 // from base class CActive |
|
72 |
|
73 /** |
|
74 * From CActive Cancels async request. |
|
75 */ |
|
76 void DoCancel(); |
|
77 |
|
78 /** |
|
79 * From CActive Called when async request completes. |
|
80 */ |
|
81 void RunL(); |
|
82 |
|
83 /** |
|
84 * From CActive Called if RunL leaves. |
|
85 */ |
|
86 TInt RunError( TInt aError ); |
|
87 |
|
88 public: // from MWmDrmDlaCancelObserver |
|
89 |
|
90 void UserCancellation(); |
|
91 |
|
92 private: |
|
93 |
|
94 CWmDrmDlaHttpMeteringPluginFw(); |
|
95 void ConstructL(); |
|
96 |
|
97 void CompleteSelf(); |
|
98 void CompleteClientRequest( TInt aError ); |
|
99 void Reset(); |
|
100 |
|
101 void ResolvingHttpPluginHandlerL(); |
|
102 void RetrievingMeteringChallenge(); |
|
103 void ProcessingMeteringChallenge(); |
|
104 void RetrievingMeteringResponse(); |
|
105 void ProcessingMeteringResponse(); |
|
106 void MeteringFinished(); |
|
107 |
|
108 void ResolveHttpPluginWithCertificateL( const TDesC8& aCertificate ); |
|
109 void HandleErrorL( TInt aError ); |
|
110 |
|
111 static TInt AsyncCancel( TAny* aPtr ); |
|
112 |
|
113 private: // data |
|
114 |
|
115 enum THttpMeteringPluginFwState |
|
116 { |
|
117 EIdle = 0, |
|
118 EResolvingHttpPlugin, |
|
119 ERetrievingMeteringChallenge, |
|
120 EProcessingMeteringChallenge, |
|
121 ERetrievingMeteringResponse, |
|
122 EProcessingMeteringResponse, |
|
123 EMeteringFinished |
|
124 }; |
|
125 |
|
126 THttpMeteringPluginFwState iState; |
|
127 CWmDrmDlaHttpPluginIf* iHttpPlugin; |
|
128 CWmDrmDlaUiNotifier* iUiNotifier; |
|
129 CIdle* iIdle; |
|
130 TInt iIapId; |
|
131 |
|
132 HBufC8* iMeteringChallenge; |
|
133 HBufC* iMeteringUrl; |
|
134 HBufC8* iMeteringResponse; |
|
135 TUint32 iPartialMetering; |
|
136 |
|
137 //Not owned |
|
138 const TDesC8* iCertificate; |
|
139 TRequestStatus* iClientStatus; |
|
140 |
|
141 }; |
|
142 |
|
143 |
|
144 #endif // C_WMDRMDLAHTTPMETERINGPLUGINFW_H |