|
1 /* |
|
2 * Copyright (c) 2002 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: A class with static operations that provides implementation |
|
15 * for the WIM callback functions. Used by the WIM server. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CWIMCALLBACK_H |
|
21 #define CWIMCALLBACK_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "Wimi.h" //WIMI definitions |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CWimResponse; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * WIM Callback implementation. |
|
34 * Static callback funtions. |
|
35 * |
|
36 * @since Series60 2.1 |
|
37 */ |
|
38 class CWimCallBack : public CBase |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Respond to InitOK operation |
|
44 * @param aStatus - WIMI status |
|
45 * @return void |
|
46 */ |
|
47 static void InitOkResp( WIMI_STAT aStatus ); |
|
48 |
|
49 /** |
|
50 * Response to CloseDown request |
|
51 * @param aStatus - WIMI status |
|
52 * @return void |
|
53 */ |
|
54 static void CloseDownResp( WIMI_STAT aStatus ); |
|
55 |
|
56 /** |
|
57 * Complete response |
|
58 * @param aTrId - transaction id |
|
59 * @param aStatus - WIMI status |
|
60 * @return void |
|
61 */ |
|
62 static void CompleteResponse( WIMI_TransactId_t aTrId, |
|
63 WIMI_STAT aStatus ); |
|
64 |
|
65 /* ------------ Digital signature ----------------------------------- */ |
|
66 /** |
|
67 * Respond to the digital signature operation. Completes client |
|
68 * request |
|
69 * @since Series60 2.6 |
|
70 * @param aTrId - transaction id |
|
71 * @param aStatus - operation status |
|
72 * @param aSignLen - signature length |
|
73 * @param aSign - signature |
|
74 * @return void |
|
75 */ |
|
76 static void SignResp( WIMI_TransactId_t aTrId, |
|
77 WIMI_STAT aStatus, |
|
78 TUint8 aSignLen, |
|
79 TUint8* aSign ); |
|
80 |
|
81 /** |
|
82 * Write signed text to client's memory area. Called by SignResp(). |
|
83 * @since Series60 2.6 |
|
84 * @param aTrId - transaction id |
|
85 * @param aSignLen - signature length |
|
86 * @param aSign - signature |
|
87 * @return void |
|
88 */ |
|
89 static void SignRespL( CWimResponse* aTrId, |
|
90 TUint8 aSignLen, |
|
91 TUint8* aSign ); |
|
92 |
|
93 /** |
|
94 * Set request status of SignTextHandler. Used when continuing signing |
|
95 * operation if wrong PIN entered. |
|
96 * @since Series60 2.6 |
|
97 * @param aStatus - RequestStatus of SignTextHandler |
|
98 * @return void |
|
99 */ |
|
100 static void SetSignTextRequestStatus( TRequestStatus* aStatus ); |
|
101 |
|
102 /* ------------ Certificate management ------------------------------ */ |
|
103 /** |
|
104 * Respond to the certificate fetch operation |
|
105 * @param aTrId - transaction id |
|
106 * @param aStatus - operation status |
|
107 * @param aCertRef - the reference to certificate that was fetched |
|
108 * @param aCertLen - certificate content length |
|
109 * @param aCert - certificate content |
|
110 * @return void |
|
111 */ |
|
112 static void CertificateResp( WIMI_TransactId_t aTrId, |
|
113 WIMI_STAT aStatus, |
|
114 WIMI_Ref_t* aCertRef, |
|
115 TUint16 aCertLen, |
|
116 TUint8* aCert ); |
|
117 |
|
118 /** |
|
119 * Respond to the certificate delete operation |
|
120 * @since Series60 2.6 |
|
121 * @param aTrId - transaction id |
|
122 * @param aStatus - operation status |
|
123 * @return void |
|
124 */ |
|
125 static void CertificateDeleteResp( WIMI_TransactId_t aTrId, |
|
126 WIMI_STAT aStatus ); |
|
127 |
|
128 /** |
|
129 * Respond to the certificate store operation |
|
130 * @since Series60 2.6 |
|
131 * @param aTrId - transaction id |
|
132 * @param aStatus - operation status |
|
133 * @param aCertRef - the reference to certificate that was stored |
|
134 * @return void |
|
135 */ |
|
136 static void CertificateStoreResp( WIMI_TransactId_t aTrId, |
|
137 WIMI_STAT aStatus, |
|
138 WIMI_Ref_t* aCertRef ); |
|
139 |
|
140 |
|
141 /* ------------ PIN management -------------------------------------- */ |
|
142 /** |
|
143 * Response to VerifyPIN request |
|
144 * @since Series60 2.6 |
|
145 * @param aTrId - transaction id |
|
146 * @param aStatus - operation status |
|
147 * @return void |
|
148 */ |
|
149 static void VerifyPINResp( WIMI_TransactId_t aTrId, WIMI_STAT aStatus ); |
|
150 |
|
151 /** |
|
152 * Response to ChangePIN request |
|
153 * @since Series60 2.6 |
|
154 * @param aTrId - transaction id |
|
155 * @param aStatus - operation status |
|
156 * @return void |
|
157 */ |
|
158 static void ChangePINResp( WIMI_TransactId_t aTrId, WIMI_STAT aStatus ); |
|
159 |
|
160 /** |
|
161 * Response to UnblockPIN request |
|
162 * @since Series60 2.6 |
|
163 * @param aTrId - transaction id |
|
164 * @param aStatus - operation status |
|
165 * @return void |
|
166 */ |
|
167 static void UnblockPINResp( WIMI_TransactId_t aTrId, |
|
168 WIMI_STAT aStatus ); |
|
169 |
|
170 /** |
|
171 * Response to EnablePIN request |
|
172 * @since Series60 2.6 |
|
173 * @param aTrId - transaction id |
|
174 * @param aStatus - operation status |
|
175 * @return void |
|
176 */ |
|
177 static void EnablePINResp( WIMI_TransactId_t aTrId, WIMI_STAT aStatus ); |
|
178 |
|
179 /* ------------ Hardware driver support ----------------------------- */ |
|
180 /** |
|
181 * Respond to CardInserted operation |
|
182 * @param aReader - Reader ID |
|
183 * @param aStatus - Status of operation |
|
184 * @param aWIMRef - Reference to WIMI |
|
185 * @return void |
|
186 */ |
|
187 static void CardInsertedResp( TUint8 aReader, |
|
188 WIMI_STAT aStatus, |
|
189 WIMI_Ref_t* aWIMRef ); |
|
190 |
|
191 /** |
|
192 * Open connection to card |
|
193 * @param aReader - Reader |
|
194 * @return KWimStatusOK/KWimStatusIOError |
|
195 */ |
|
196 static TUint8 Open( TUint8 aReader ); |
|
197 |
|
198 /** |
|
199 * Close connection to the card |
|
200 * @param aReader - Reader |
|
201 * @return KWimStatusOK |
|
202 */ |
|
203 static TUint8 Close( TUint8 aReader ); |
|
204 |
|
205 /** |
|
206 * APDU Request |
|
207 * @param aReader - Reader |
|
208 * @param aApdu - APDU |
|
209 * @param aApduLen - ADDU length |
|
210 * @return void |
|
211 */ |
|
212 static void APDUReq( TUint8 aReader, TUint8* aApdu, TUint16 aApduLen ); |
|
213 |
|
214 /** |
|
215 * Get ATR bytes request |
|
216 * @param aReader - Reader |
|
217 * @return void |
|
218 */ |
|
219 static void GetATRReq( TUint8 aReader ); |
|
220 |
|
221 /** |
|
222 * Get reader list reguest |
|
223 * @return void |
|
224 */ |
|
225 static void GetReaderListReq(); |
|
226 |
|
227 /** |
|
228 * Read content of SIM file. |
|
229 * @param aReaderId - Reader ID |
|
230 * @param aPath - Path to the file to read |
|
231 * @param aOffset - Offset from the beginning of the file |
|
232 * @param aSize - Amount of data to read, aSize=0 means that whole |
|
233 * file must be read |
|
234 * @return void |
|
235 */ |
|
236 static void ReadSimFileReq( TUint8 aReaderId, |
|
237 TUint8* aPath, |
|
238 TUint16 aOffset, |
|
239 TUint16 aSize ); |
|
240 |
|
241 /** |
|
242 * Response for OMA Smart Card Provisioning file request. |
|
243 * @param aTrId - Transaction ID, contains message information |
|
244 * @param aStatus - Operation status |
|
245 * @param aFileLen - Provisioning file length |
|
246 * @param aFile - Provisioning file content |
|
247 * @return void |
|
248 */ |
|
249 static void OmaProvisioningResp( WIMI_TransactId_t aTrId, |
|
250 WIMI_STAT aStatus, |
|
251 TUint16 aFileLen, |
|
252 TUint8 *aFile ); |
|
253 |
|
254 /** |
|
255 * Cancel pin operation |
|
256 * Stop the APDU sending |
|
257 */ |
|
258 static void CancelPinOperation(); |
|
259 |
|
260 /** |
|
261 * Cancel Wim Initialize |
|
262 * Stop the APDU sending |
|
263 */ |
|
264 static void CancelWimInitialize(); |
|
265 |
|
266 /** |
|
267 * This function is called by CWimServer destructor, |
|
268 * to delete the gApdu object. |
|
269 */ |
|
270 static void CWimCallBack::DeletegApdu(); |
|
271 |
|
272 private: |
|
273 |
|
274 /** |
|
275 * Respond to the certificate fetch operation |
|
276 * @param aTrId - transaction id |
|
277 * @param aStatus - operation status |
|
278 * @param aWimiRef - the reference to WIMI |
|
279 * @param aCertLen - certificate content length |
|
280 * @param aCert - certificate content |
|
281 * @return void |
|
282 */ |
|
283 static void CertificateRespL( CWimResponse* aTrId, |
|
284 WIMI_STAT aStatus, |
|
285 WIMI_Ref_t* aWimiRef, |
|
286 TUint16 aCertLen, |
|
287 TUint8* aCert ); |
|
288 |
|
289 /** |
|
290 * Read content of SIM file. Leaving function, |
|
291 * leave is trapped in ReadSimFileReg |
|
292 * @param aReaderId - Reader ID |
|
293 * @param aPath - Path to the file to read |
|
294 * @param aOffset - Offset from the beginning of the file |
|
295 * @param aSize - Amount of data to read, aSize=0 means that whole |
|
296 * file must be read |
|
297 * @return void |
|
298 */ |
|
299 static void DoReadSimFileReqL( TUint8 aReaderId, |
|
300 TUint8* aPath, |
|
301 TUint16 aOffset, |
|
302 TUint16 aSize ); |
|
303 |
|
304 /** |
|
305 * Copy OMA Provisioning file to client memory |
|
306 * @param aTrId - Transaction ID, contains message information |
|
307 * @param aFileLen - Provisioning file length |
|
308 * @param aFile - Provisioning file content |
|
309 * @return void |
|
310 */ |
|
311 static void OmaProvisioningRespL( CWimResponse* aTrId, |
|
312 TUint16 aFileLen, |
|
313 TUint8* aFile ); |
|
314 |
|
315 }; |
|
316 |
|
317 #endif // CWIMCALLBACK_H |
|
318 |
|
319 // End of File |