|
1 /* |
|
2 * Copyright (c) 2007 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: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if !defined(_EAP_AM_TYPE_PROTECTED_SETUP_SYMBIAN_H_) |
|
20 #define _EAP_AM_TYPE_PROTECTED_SETUP_SYMBIAN_H_ |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <EapType.h> |
|
26 #include "eap_tools.h" |
|
27 #include "eap_am_export.h" |
|
28 #include "abs_eap_base_type.h" |
|
29 |
|
30 #include "abs_eap_am_type_simple_config.h" |
|
31 #include "eap_am_type_simple_config.h" |
|
32 |
|
33 #include <ssl.h> |
|
34 #include "simple_config_payloads.h" |
|
35 #include "eapol_key_types.h" |
|
36 #include "eapol_rsna_key_header.h" |
|
37 |
|
38 #include "EapProtectedSetupInterface.h" |
|
39 #include <etelmm.h> |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 class abs_eap_configuration_if_c; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Class that implements the operating system dependent portion of |
|
48 * EAP Protected setup protocol for Symbian OS. |
|
49 */ |
|
50 |
|
51 |
|
52 class EAP_EXPORT eap_am_type_protected_setup_symbian_c |
|
53 : public eap_am_type_simple_config_c |
|
54 { |
|
55 public: |
|
56 |
|
57 //-------------------------------------------------- |
|
58 |
|
59 EAP_FUNC_IMPORT static eap_am_type_protected_setup_symbian_c* NewL( |
|
60 abs_eap_am_tools_c * const tools, |
|
61 abs_eap_base_type_c * const partner, |
|
62 const TIndexType aIndexType, |
|
63 const TInt aIndex, |
|
64 const eap_type_value_e aTunnelingType, |
|
65 const eap_type_value_e eap_type, |
|
66 const bool is_client_when_true, |
|
67 const eap_am_network_id_c * const receive_network_id, |
|
68 abs_eap_configuration_if_c * const configuration_if); |
|
69 |
|
70 // |
|
71 EAP_FUNC_IMPORT ~eap_am_type_protected_setup_symbian_c(); |
|
72 |
|
73 EAP_FUNC_IMPORT void set_is_valid(); |
|
74 |
|
75 /** From the parent eap_am_type_simple_config_c **/ |
|
76 |
|
77 /** Function sets partner object of adaptation module of EAP-SIMPLE_CONFIG. |
|
78 * Partner object is the EAP-SIMPLE_CONFIG object. |
|
79 */ |
|
80 EAP_FUNC_IMPORT void set_am_partner(abs_eap_am_type_simple_config_c * const partner); |
|
81 |
|
82 EAP_FUNC_IMPORT eap_status_e configure(); |
|
83 |
|
84 /** |
|
85 * The shutdown() function is called before the destructor of the |
|
86 * object is executed. During the function call the object |
|
87 * could shutdown the operations, for example cancel timers. |
|
88 * Each derived class must define this function. |
|
89 */ |
|
90 EAP_FUNC_IMPORT eap_status_e shutdown(); |
|
91 |
|
92 EAP_FUNC_IMPORT bool get_is_valid(); |
|
93 |
|
94 /** Client calls this function. |
|
95 * EAP-SIMPLE_CONFIG AM could do finishing operations to databases etc. based on authentication status and type. |
|
96 */ |
|
97 EAP_FUNC_IMPORT eap_status_e reset(); |
|
98 |
|
99 /** Client calls this function. |
|
100 * EAP-SIMPLE_CONFIG AM could make some fast operations here, heavy operations should be done in the reset() function. |
|
101 */ |
|
102 EAP_FUNC_IMPORT eap_status_e authentication_finished( |
|
103 const bool true_when_successfull, |
|
104 const bool true_when_session_resumed); |
|
105 |
|
106 /** Client calls this function. |
|
107 * AM must copy identity to output parameters if call is syncronous. |
|
108 * This function could be completed asyncronously with abs_eap_am_type_simple_config_c::complete_query_eap_identity_query() function call. |
|
109 */ |
|
110 EAP_FUNC_IMPORT eap_status_e query_eap_identity( |
|
111 const eap_am_network_id_c * const receive_network_id, |
|
112 const u8_t eap_identifier, |
|
113 bool * const use_manual_username, |
|
114 eap_variable_data_c * const manual_username, |
|
115 bool *const use_manual_realm, |
|
116 eap_variable_data_c * const manual_realm |
|
117 ); |
|
118 |
|
119 /** |
|
120 * Cancels the outstanding indentity query. |
|
121 */ |
|
122 EAP_FUNC_IMPORT eap_status_e cancel_identity_query(); |
|
123 |
|
124 /** |
|
125 * The type_configure_read() function reads the configuration data identified |
|
126 * by the field string of field_length bytes length. Adaptation module must direct |
|
127 * the query to some persistent store. |
|
128 * @param field is generic configure string idenfying the required configure data. |
|
129 * @param field_length is length of the field string. |
|
130 * @param data is pointer to existing eap_variable_data object. |
|
131 */ |
|
132 EAP_FUNC_IMPORT eap_status_e type_configure_read( |
|
133 const eap_configuration_field_c * const field, |
|
134 eap_variable_data_c * const data); |
|
135 |
|
136 /** |
|
137 * The type_configure_write() function writes the configuration data identified |
|
138 * by the field string of field_length bytes length. Adaptation module must direct |
|
139 * the action to some persistent store. |
|
140 * @param field is generic configure string idenfying the required configure data. |
|
141 * @param field_length is length of the field string. |
|
142 * @param data is pointer to existing eap_variable_data object. |
|
143 */ |
|
144 EAP_FUNC_IMPORT eap_status_e type_configure_write( |
|
145 const eap_configuration_field_c * const field, |
|
146 eap_variable_data_c * const data); |
|
147 |
|
148 /** |
|
149 * The load_module() function function indicates the lower level to |
|
150 * load new module of EAP-type. |
|
151 * @param type is the requested EAP-type. |
|
152 * @param partner is pointer to the caller object. |
|
153 * The partner of the new created EAP-type object is the caller object. |
|
154 * @param eap_type is a pointer to a pointer of EAP-type object. |
|
155 * Adaptation module sets eap_type pointer to created EAP-type object. |
|
156 * @param is_client_when_true parameter indicates whether the network entity should |
|
157 * act as a client (true) or server (false), in terms of EAP-protocol whether |
|
158 * this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
159 */ |
|
160 EAP_FUNC_IMPORT eap_status_e load_module( |
|
161 const eap_type_value_e type, |
|
162 const eap_type_value_e /* tunneling_type */, |
|
163 abs_eap_base_type_c * const partner, |
|
164 eap_base_type_c ** const eap_type, |
|
165 const bool is_client_when_true, |
|
166 const eap_am_network_id_c * const receive_network_id); |
|
167 |
|
168 /** |
|
169 * This is needed by PEAP type. |
|
170 * This function queries the validity of EAP-type. |
|
171 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
172 */ |
|
173 EAP_FUNC_IMPORT eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type); |
|
174 |
|
175 /** |
|
176 * This function queries the list of supported EAP-types. |
|
177 * Lower layer should return eap_status_ok if this call succeeds. |
|
178 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
179 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
180 */ |
|
181 EAP_FUNC_IMPORT eap_status_e get_eap_type_list( |
|
182 eap_array_c<eap_type_value_e> * const eap_type_list); |
|
183 |
|
184 /** |
|
185 * This is needed by PEAP type. |
|
186 * The unload_module() function unloads the module of a EAP-type. |
|
187 * @param type is the requested EAP-type. |
|
188 */ |
|
189 EAP_FUNC_IMPORT eap_status_e unload_module(const eap_type_value_e type); |
|
190 |
|
191 |
|
192 /** From simple_config_am_services_c through the parent eap_am_type_simple_config_c **/ |
|
193 |
|
194 /// This function sets pointer to adaptation module of SIMPLE_CONFIG. See abs_simple_config_am_services_c. |
|
195 EAP_FUNC_IMPORT void set_simple_config_am_partner(abs_simple_config_am_services_c * const simple_config_am_partner); |
|
196 |
|
197 /** |
|
198 * This function queries all network and device parameters. |
|
199 * abs_simple_config_am_services_c::complete_query_network_and_device_parameters() completes this query. |
|
200 */ |
|
201 EAP_FUNC_IMPORT eap_status_e query_network_and_device_parameters( |
|
202 const simple_config_state_e state); |
|
203 |
|
204 /** |
|
205 * This function tells AM to save SIMPLE_CONFIG configuration parameters. |
|
206 * This is always syncronous call. |
|
207 */ |
|
208 EAP_FUNC_IMPORT eap_status_e save_simple_config_session( |
|
209 const simple_config_state_e state, |
|
210 EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array, |
|
211 const eap_variable_data_c * const new_password, |
|
212 const simple_config_Device_Password_ID_e Device_Password_ID, |
|
213 const simple_config_payloads_c * const other_configuration |
|
214 ); |
|
215 |
|
216 /** |
|
217 * This function forwards all payloads received in M2D messages. |
|
218 * Adaptation layer could show this information to user. |
|
219 * This is always syncronous call. |
|
220 */ |
|
221 EAP_FUNC_IMPORT eap_status_e received_registrar_information( |
|
222 EAP_TEMPLATE_CONST eap_array_c<simple_config_payloads_c> * const M2D_payloads); |
|
223 |
|
224 /** |
|
225 * This function cancels query_network_and_device_parameters() query. |
|
226 * After this call AM MUST NOT complete related query. |
|
227 */ |
|
228 EAP_FUNC_IMPORT eap_status_e cancel_query_network_and_device_parameters(); |
|
229 |
|
230 |
|
231 /** Own Public functions **/ |
|
232 |
|
233 EAP_FUNC_IMPORT eap_status_e complete_protected_setup_device_paramsL( |
|
234 const RMobilePhone::TMobilePhoneIdentityV1 &phone_identity, |
|
235 const eap_status_e completion_status); |
|
236 |
|
237 //-------------------------------------------------- |
|
238 |
|
239 protected: |
|
240 |
|
241 //-------------------------------------------------- |
|
242 |
|
243 eap_am_type_protected_setup_symbian_c( |
|
244 abs_eap_am_tools_c * const tools, |
|
245 abs_eap_base_type_c * const partner, |
|
246 const TIndexType aIndexType, |
|
247 const TInt aIndex, |
|
248 const eap_type_value_e aTunnelingType, |
|
249 const eap_type_value_e eap_type, |
|
250 const bool is_client_when_true, |
|
251 const eap_am_network_id_c * const receive_network_id, |
|
252 abs_eap_configuration_if_c * const configuration_if); |
|
253 |
|
254 void ConstructL(); |
|
255 |
|
256 //-------------------------------------------------- |
|
257 |
|
258 private: |
|
259 |
|
260 abs_simple_config_am_services_c * get_simple_config_am_partner(); |
|
261 |
|
262 abs_eap_am_type_simple_config_c * get_am_partner(); |
|
263 |
|
264 void send_error_notification(const eap_status_e error); |
|
265 |
|
266 void read_device_passwordL( |
|
267 eap_config_string field, |
|
268 const u32_t field_length, |
|
269 eap_variable_data_c * const data); |
|
270 |
|
271 void ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii); |
|
272 |
|
273 //-------------------------------------------------- |
|
274 |
|
275 private: |
|
276 |
|
277 //-------------------------------------------------- |
|
278 |
|
279 abs_eap_base_type_c *m_partner; |
|
280 |
|
281 TInt m_index; |
|
282 |
|
283 abs_eap_am_tools_c *m_am_tools; |
|
284 |
|
285 abs_eap_am_type_simple_config_c *m_am_partner; |
|
286 |
|
287 abs_simple_config_am_services_c * m_simple_config_am_partner; |
|
288 |
|
289 abs_eap_configuration_if_c * const m_configuration_if; |
|
290 |
|
291 bool m_device_parameters_valid; |
|
292 simple_config_payloads_c m_network_and_device_parameters; |
|
293 |
|
294 eap_variable_data_c m_UUID_E; |
|
295 |
|
296 simple_config_Device_Password_ID_e m_Device_Password_ID; |
|
297 |
|
298 eap_am_network_id_c m_receive_network_id; |
|
299 |
|
300 u8_t m_eap_identifier; |
|
301 |
|
302 eap_type_value_e m_eap_type; |
|
303 |
|
304 simple_config_state_e m_simple_config_state; |
|
305 |
|
306 bool m_is_valid; |
|
307 bool m_is_client; |
|
308 |
|
309 bool m_shutdown_was_called; |
|
310 |
|
311 eap_variable_data_c m_manual_username; |
|
312 |
|
313 eap_variable_data_c m_manual_realm; |
|
314 |
|
315 /// This flag allows use of manually configured username in EAP-Identity/Response. |
|
316 bool m_use_manual_username; |
|
317 |
|
318 /// This flag allows use of manually configured realm in EAP-Identity/Response. |
|
319 bool m_use_manual_realm; |
|
320 |
|
321 /// This flag prevents double configuration. This can happen when |
|
322 /// this class implements many interfaces. |
|
323 bool m_configured; |
|
324 |
|
325 // This is the connection to the MMETEL interface from here. |
|
326 CEapProtectedSetupInterface* m_prot_setup_if; |
|
327 |
|
328 //----------------------------------------------------------------- |
|
329 |
|
330 }; // class eap_am_type_protected_setup_symbian_c |
|
331 |
|
332 |
|
333 #endif //#if !defined(_EAP_AM_TYPE_PROTECTED_SETUP_SYMBIAN_H_) |
|
334 |
|
335 //-------------------------------------------------- |
|
336 |
|
337 // End of file. |