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