1 /* |
|
2 * Copyright (c) 2008 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 the License "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: Provide synch/asynch services used by the caller to show |
|
15 * EAP-TTLS-PAP related notes. |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 10 % |
|
21 */ |
|
22 |
|
23 #ifndef EAPTTLSPAPACTIVE_H |
|
24 #define EAPTTLSPAPACTIVE_H |
|
25 |
|
26 |
|
27 // INCLUDES |
|
28 #include <utf.h> |
|
29 #include <e32base.h> |
|
30 #include <EapTtlsPapNotifierStruct.h> |
|
31 #include <e32des16.h> |
|
32 #include "EapTtlsPapDbInfoStruct.h" |
|
33 #include "eap_status.h" |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class eap_am_type_tls_peap_symbian_c; |
|
37 class eap_variable_data_c; |
|
38 class eap_am_tools_symbian_c; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 /** |
|
42 * CEapTtlsPapActive class. |
|
43 * |
|
44 * Class provides synch/asynch services used by the caller. |
|
45 * These services includes: |
|
46 * - query for TTLS-PAP user name and password. |
|
47 */ |
|
48 NONSHARABLE_CLASS( CEapTtlsPapActive ) |
|
49 : public CActive |
|
50 { |
|
51 |
|
52 public: |
|
53 /** |
|
54 * State defines the type of service called. |
|
55 */ |
|
56 enum TEapTtlsPapActiveState |
|
57 { |
|
58 EEapTtlsPapActiveQueryUserNameAndPassword, /* 0 */ |
|
59 EEapTtlsPapActiveShowAuthQueryDialog, /* 1 */ |
|
60 EEapTtlsPapActiveShowPapChallengeMsgDialog, /* 2 */ |
|
61 EEapTtlsPapActiveShowPapChallengeReplyQueryDialog, /* 3 */ |
|
62 // ... |
|
63 EEapTtlsPapActiveStatesNumber /* 4 */ // keep always as last element |
|
64 }; |
|
65 |
|
66 public: // Constructors and destructor |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * |
|
71 * @param aCaller Pointer AO owner. |
|
72 */ |
|
73 static CEapTtlsPapActive* NewL( |
|
74 eap_am_type_tls_peap_symbian_c* aCaller, |
|
75 eap_am_tools_symbian_c* aAmTools ); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 ~CEapTtlsPapActive(); |
|
81 |
|
82 |
|
83 public: // new |
|
84 |
|
85 /** |
|
86 * Start active object. |
|
87 * |
|
88 * @param aState State defines the type of service requested, see TEapTtlsPapActiveState. |
|
89 * @return TBool ETrue - successful start, EFalse - starting failed. |
|
90 */ |
|
91 TBool Start( TEapTtlsPapActiveState aState ); |
|
92 |
|
93 /** |
|
94 * Allocate server challenge. |
|
95 * |
|
96 * Note, utf8->unicode conversion is needed. |
|
97 * |
|
98 * @param aSrvChallenge Reference to server challenge. |
|
99 */ |
|
100 eap_status_e UpdateSrvChallenge( const eap_variable_data_c& aSrvChallengeUtf8 ); |
|
101 |
|
102 protected: // from CActive |
|
103 |
|
104 /** |
|
105 * DoCancel from CActive |
|
106 */ |
|
107 virtual void DoCancel(); |
|
108 |
|
109 /** |
|
110 * RunL from CActive |
|
111 */ |
|
112 virtual void RunL(); |
|
113 |
|
114 private: // new, for AO |
|
115 |
|
116 /** |
|
117 * Complete query-user-name-and-password request. |
|
118 */ |
|
119 void CompleteQueryUserNameAndPassword(); |
|
120 |
|
121 /** |
|
122 * Complete query-user-name-and-password request |
|
123 * with null server challenge. |
|
124 */ |
|
125 void CompleteWithSrvChallengeNull(); |
|
126 |
|
127 /** |
|
128 * Complete query-user-name-and-password request |
|
129 * with not null server challenge. |
|
130 */ |
|
131 void CompleteWithSrvChallengeNotNull(); |
|
132 |
|
133 /** |
|
134 * Display authentication query dialog. |
|
135 * |
|
136 * Note! The call is asynchronous, i.e., return is done immediately. |
|
137 */ |
|
138 void StartAuthenticationQueryDialog(); |
|
139 |
|
140 /** |
|
141 * Complete start-authentication-query-dialog request. |
|
142 * |
|
143 * If user accepts query, the caller is notified with EEapTtlsPapNotifierUserActionOk |
|
144 * value. If user cancells the query, EEapTtlsPapNotifierUserActionCancel |
|
145 * is given to the caller. |
|
146 */ |
|
147 void CompleteAuthenticationQueryDialog(); |
|
148 |
|
149 /** |
|
150 * Send server challenge data size to UI side. |
|
151 * |
|
152 * Note! The call is asynchronous, i.e., return is done immediately. |
|
153 */ |
|
154 void StartSrvChallengeSize(); |
|
155 |
|
156 /** |
|
157 * Complete start-srv-challenge-size request. |
|
158 */ |
|
159 void CompleteSrvChallengeSize(); |
|
160 |
|
161 /** |
|
162 * Display PAP challenge message dialog. |
|
163 * |
|
164 * Note! The call is asynchronous, i.e., return is done immediately. |
|
165 */ |
|
166 void StartPapChallengeMsgDialog(); |
|
167 |
|
168 /** |
|
169 * Complete start-pap-challenge-msg-dialog request. |
|
170 */ |
|
171 void CompletePapChallengeMsgDialog(); |
|
172 |
|
173 /** |
|
174 * Display PAP challenge user reply query dialog. |
|
175 * |
|
176 * Note! The call is asynchronous, i.e., return is done immediately. |
|
177 */ |
|
178 void StartPapChallengeReplyQueryDialog(); |
|
179 |
|
180 /** |
|
181 * Complete start-pap-challenge-user-reply-query-dialog request. |
|
182 */ |
|
183 void CompletePapChallengeReplyQueryDialog(); |
|
184 |
|
185 private: // new, other |
|
186 |
|
187 /** |
|
188 * Take current time. |
|
189 * |
|
190 * @return Current time, number of microseconds since midnight, |
|
191 * January 1st, 0 AD nominal Gregorian. |
|
192 */ |
|
193 TInt64 GetCurrentTime(); |
|
194 |
|
195 /** |
|
196 * Cleans allocated memories and restores the initial object state. |
|
197 */ |
|
198 void Clean(); |
|
199 |
|
200 private: // private constructors |
|
201 |
|
202 /** |
|
203 * C++ default constructor. |
|
204 * |
|
205 * @param aCaller Pointer to AO owner. |
|
206 */ |
|
207 CEapTtlsPapActive( |
|
208 eap_am_type_tls_peap_symbian_c* aCaller, |
|
209 eap_am_tools_symbian_c* aAmTools ); |
|
210 |
|
211 /** |
|
212 * By default Symbian 2nd phase constructor is private. |
|
213 */ |
|
214 void ConstructL(); |
|
215 |
|
216 private: // data |
|
217 |
|
218 /** |
|
219 * Object of this class implements functionality |
|
220 * of platform adaptation of Symbian. |
|
221 * |
|
222 * Not owned. |
|
223 */ |
|
224 eap_am_tools_symbian_c* iAmTools; |
|
225 |
|
226 /** |
|
227 * User / owner of this AO. |
|
228 * |
|
229 * Not owned. |
|
230 */ |
|
231 eap_am_type_tls_peap_symbian_c* iCaller ; |
|
232 |
|
233 /** |
|
234 * State defines the type of the requested service. |
|
235 */ |
|
236 TEapTtlsPapActiveState iActiveState; |
|
237 |
|
238 /** |
|
239 * Notifier. It acts as a service provider. |
|
240 */ |
|
241 RNotifier iNotifier; |
|
242 |
|
243 /** |
|
244 * Data sent from AO to notifier plugin. |
|
245 * |
|
246 * If user name exists in database, it is sent to notifier. |
|
247 * Also could be used later, if server challenge is sent to UI |
|
248 * for displaying. |
|
249 */ |
|
250 TPapUiNotifierInfo* iNotifierDataToUser; |
|
251 |
|
252 /** |
|
253 * Packaged data sent from AO to notifier plugin. |
|
254 */ |
|
255 TPckg<TPapUiNotifierInfo>* iNotifierDataPckgToUser; |
|
256 |
|
257 /** |
|
258 * Data from notifier plugin to AO. |
|
259 * Structure includes UI dialog id, user action value, |
|
260 * notifier buffer. |
|
261 */ |
|
262 TPapUiNotifierInfo* iNotifierDataFromUser; |
|
263 |
|
264 /** |
|
265 * Packaged data from notifier plugin to AO. |
|
266 */ |
|
267 TPckg<TPapUiNotifierInfo>* iNotifierDataPckgFromUser; |
|
268 |
|
269 /** |
|
270 * Stores user action. Possible values are |
|
271 * EPapNotifierUserActionOk and EPapNotifierUserActionCancel. |
|
272 */ |
|
273 EPapNotifierUserAction iUserAction; |
|
274 |
|
275 /** |
|
276 * Server challenge in unicode format. |
|
277 */ |
|
278 HBufC16* iSrvChallengeUnicode; |
|
279 |
|
280 /** |
|
281 * A pointer to the request status object. |
|
282 */ |
|
283 TRequestStatus* iRequestStatus; |
|
284 |
|
285 /** |
|
286 * Structure contains database data for TTLS-PAP. |
|
287 */ |
|
288 TTtlsPapDbInfo iTtlsPapDbInfo; |
|
289 |
|
290 /** |
|
291 * Flag is needed to read database only once. |
|
292 * ETrue - initialized, EFalse - not initialized. |
|
293 */ |
|
294 TBool iIsTtlsPapDbInfoInitialized; |
|
295 |
|
296 /* |
|
297 * Boolean flag to make sure that if objects are deleted in cancel, |
|
298 * we don't use them anymore. |
|
299 */ |
|
300 TBool iCancelCalled; |
|
301 |
|
302 }; |
|
303 |
|
304 |
|
305 #endif // EAPTTLSPAPACTIVE_H |
|
306 |
|
307 // End of File |
|