|
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: Token and TokenType implementation for TrustSettingsStore |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "WimDummyToken.h" |
|
22 #include "WimTrace.h" |
|
23 |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CWimDummyToken::CWimDummyToken |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CWimDummyToken::CWimDummyToken( MCTTokenType& aTokenType ) |
|
34 : iTokenType( aTokenType ) |
|
35 { |
|
36 _WIMTRACE(_L("WIM | WIMUtil | CWimDummyToken::CWimDummyToken | Begin")); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CWimDummyToken::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CWimDummyToken::ConstructL() |
|
45 { |
|
46 _WIMTRACE(_L("WIM | WIMUtil | CWimDummyToken::ConstructL | Begin")); |
|
47 iCount = -1; // -1 instead of 0 because of different construction method |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CWimDummyToken::NewL |
|
52 // Two-phased constructor. |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CWimDummyToken* CWimDummyToken::NewL( MCTTokenType& aTokenType ) |
|
56 { |
|
57 _WIMTRACE(_L("WIM | WIMUtil | CWimDummyToken::NewL | Begin")); |
|
58 CWimDummyToken* self = new( ELeave ) CWimDummyToken( aTokenType ); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // Destructor |
|
66 CWimDummyToken::~CWimDummyToken() |
|
67 { |
|
68 _WIMTRACE(_L("WIM | WIMUtil | CWimDummyToken::~CWimDummyToken | Begin")); |
|
69 delete iSerialNumber; |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CWimDummyToken::Label() |
|
74 // Get the label from current token |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 const TDesC& CWimDummyToken::Label() |
|
78 { |
|
79 _WIMTRACE ( _L( "CWimDummyToken::Label()" ) ); |
|
80 return KNullDesC; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CWimDummyToken::Information() |
|
85 // Returns the specified information string about the token |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 const TDesC& CWimDummyToken::Information( |
|
89 TTokenInformation aRequiredInformation ) |
|
90 { |
|
91 _WIMTRACE ( _L( "CWimDummyToken::Information()" ) ); |
|
92 |
|
93 switch ( aRequiredInformation ) |
|
94 { |
|
95 case ESerialNo: // Returns the Serialnumber from current token |
|
96 { |
|
97 return *iSerialNumber; |
|
98 } |
|
99 default: // Returns empty string |
|
100 { |
|
101 break; |
|
102 } |
|
103 } |
|
104 |
|
105 return KNullDesC; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // MCTTokenType& CWimDummyToken::TokenType() |
|
110 // Returns the associated token type. |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 MCTTokenType& CWimDummyToken::TokenType() |
|
114 { |
|
115 _WIMTRACE ( _L( "CWimDummyToken::TokenType()" ) ); |
|
116 return iTokenType; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // TCTTokenHandle CWimDummyToken::Handle() |
|
121 // Returns the token's handle. TCTTokenHandle defines a handle to a subclass |
|
122 // of the MCTToken class |
|
123 // WimSecModule()->TokenNumber retrieves the token actually exists. |
|
124 // Values 0..7 are for hardware tokens. Value 255 is for SoftId-token. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 TCTTokenHandle CWimDummyToken::Handle() |
|
128 { |
|
129 _WIMTRACE ( _L( "CWimDummyToken::Handle()" ) ); |
|
130 return TCTTokenHandle( TokenType().Type(), 0 ); |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CWimDummyToken::DoGetInterface() |
|
135 // Returns a valid interface and KErrNone, or interface = NULL and |
|
136 // KErrNotSupported if it isn't supported by this token |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CWimDummyToken::DoGetInterface( |
|
140 TUid /*aRequiredInterface*/, |
|
141 MCTTokenInterface*& /*aReturnedInterface*/, |
|
142 TRequestStatus& /*aStatus*/ ) |
|
143 { |
|
144 _WIMTRACE ( _L( "CWimDummyToken::DoGetInterface()" ) ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CWimDummyToken::DoCancelGetInterface() |
|
149 // Nothing to do |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TBool CWimDummyToken::DoCancelGetInterface() |
|
153 { |
|
154 _WIMTRACE ( _L( "CWimDummyToken::DoCancelGetInterface()" ) ); |
|
155 return EFalse; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CWimDummyToken::ReferenceCount() |
|
160 // Returns a reference to reference counter. |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TInt& CWimDummyToken::ReferenceCount() |
|
164 { |
|
165 _WIMTRACE ( _L( "CWimDummyToken::ReferenceCount()" ) ); |
|
166 return iCount; |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CWimDummyToken::NotifyOnRemoval( TRequestStatus& aStatus ) |
|
171 // Notifies the client when the token has been removed. |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CWimDummyToken::NotifyOnRemoval( TRequestStatus& /*aStatus*/ ) |
|
175 { |
|
176 _WIMTRACE ( _L( "CWimDummyToken::NotifyOnRemoval()" ) ); |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CWimDummyToken::CancelNotify() |
|
181 // Cancels the NotifyOnRemoval request. |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void CWimDummyToken::CancelNotify() |
|
185 { |
|
186 _WIMTRACE ( _L( "CWimDummyToken::CancelNotify()" ) ); |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // CWimDummyToken::SetSerialNumber() |
|
191 // Sets serial number for token |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 void CWimDummyToken::SetSerialNumber( TDesC& aSerialNumber ) |
|
195 { |
|
196 _WIMTRACE ( _L( "CWimDummyToken::SetSerialNumber()" ) ); |
|
197 if ( iSerialNumber ) |
|
198 { |
|
199 delete iSerialNumber; |
|
200 iSerialNumber = NULL; |
|
201 } |
|
202 |
|
203 TRAPD( err, iSerialNumber = HBufC::NewL( aSerialNumber.Length() ) ); |
|
204 if ( err != KErrNone ) |
|
205 { |
|
206 return; |
|
207 } |
|
208 TPtr serialNbr = iSerialNumber->Des(); |
|
209 serialNbr.Copy( aSerialNumber ); |
|
210 } |
|
211 |
|
212 |
|
213 // ============== TokenType ==================================================== |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CWimDummyTokenType::CWimDummyTokenType() |
|
217 // Default constructor |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 CWimDummyTokenType::CWimDummyTokenType() |
|
221 { |
|
222 _WIMTRACE ( _L( "CWimDummyToken::CWimDummyTokenType()" ) ); |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CWimDummyTokenType::ConstructL() |
|
227 // Second phase constructor |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 void CWimDummyTokenType::ConstructL() |
|
231 { |
|
232 _WIMTRACE ( _L( "CWimDummyTokenType::ConstructL()" ) ); |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // CWimDummyTokenType::NewL() |
|
237 // Two-phased constructor. |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 CWimDummyTokenType* CWimDummyTokenType::NewL() |
|
241 { |
|
242 _WIMTRACE ( _L( "CWimDummyToken::NewL()" ) ); |
|
243 CWimDummyTokenType* that = new( ELeave ) CWimDummyTokenType(); |
|
244 CleanupStack::PushL( that ); |
|
245 that->ConstructL(); |
|
246 CleanupStack::Pop(); |
|
247 return that; |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // CWimDummyTokenType::~CWimDummyTokenType() |
|
252 // Destructor. |
|
253 // ----------------------------------------------------------------------------- |
|
254 // |
|
255 CWimDummyTokenType::~CWimDummyTokenType() |
|
256 { |
|
257 _WIMTRACE ( _L( "CWimDummyTokenType::~CWimDummyTokenType()" ) ); |
|
258 |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CWimDummyTokenType::List() |
|
263 // List all the tokens of this type. |
|
264 // ----------------------------------------------------------------------------- |
|
265 // |
|
266 void CWimDummyTokenType::List( |
|
267 RCPointerArray<HBufC>& /*aTokens*/, |
|
268 TRequestStatus& /*aStatus*/ ) |
|
269 { |
|
270 _WIMTRACE ( _L( "CWimDummyToken::List()" ) ); |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CWimDummyTokenType::CancelList() |
|
275 // Cancel a list operation. |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 void CWimDummyTokenType::CancelList() |
|
279 { |
|
280 _WIMTRACE ( _L( "CWimDummyTokenType::CancelList" ) ); |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CTokenTypeImplementation::OpenToken() |
|
285 // Opens new token, which name is specified in aTokenInfo |
|
286 // This is not true asynchronous function. |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 void CWimDummyTokenType::OpenToken( |
|
290 const TDesC& /*aTokenInfo*/, |
|
291 MCTToken*& /*aToken*/, |
|
292 TRequestStatus& /*aStatus*/ ) |
|
293 { |
|
294 _WIMTRACE ( _L( "CWimDummyTokenType::OpenToken with name" ) ); |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CWimDummyTokenType::OpenToken() |
|
299 // Open new token, The handle of the required token is used to get needed |
|
300 // information. Before opening new token we need to compare token numbers. |
|
301 // This is not true asynchronous function. |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 void CWimDummyTokenType::OpenToken( |
|
305 TCTTokenHandle /*aHandle*/, |
|
306 MCTToken*& /*aToken*/, |
|
307 TRequestStatus& /*aStatus*/ ) |
|
308 { |
|
309 _WIMTRACE ( _L( "CWimDummyTokenType::OpenToken with handle" ) ); |
|
310 } |
|
311 // ----------------------------------------------------------------------------- |
|
312 // CWimDummyTokenType::CancelOpenToken() |
|
313 // Cancel an OpenToken operation. |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 void CWimDummyTokenType::CancelOpenToken() |
|
317 { |
|
318 _WIMTRACE ( _L( "CWimDummyTokenType::CancelOpenToken" ) ); |
|
319 } |
|
320 |
|
321 |
|
322 // End of File |