|
1 /* |
|
2 * Copyright (c) 2005-2006 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: handler to EAPOL callbacks. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_EAPOL_HANDLER_H |
|
20 #define CORE_EAPOL_HANDLER_H |
|
21 |
|
22 #include "abs_wlan_eapol_callback_interface.h" |
|
23 #include "abs_wlan_eapol_callback.h" |
|
24 #include "am_platform_libraries.h" |
|
25 #include "core_types.h" |
|
26 |
|
27 class core_server_c; |
|
28 class abs_core_driverif_c; |
|
29 class abs_core_server_callback_c; |
|
30 class abs_core_protected_setup_handler_c; |
|
31 class network_id_c; |
|
32 |
|
33 /** |
|
34 * This class acts as handler to EAPOL callbacks. |
|
35 * |
|
36 * @since S60 v3.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( core_eapol_handler_c ) : |
|
39 public abs_wlan_eapol_callback_interface_c, |
|
40 public abs_wlan_eapol_callback_c |
|
41 { |
|
42 |
|
43 public: |
|
44 |
|
45 /** |
|
46 * constructor |
|
47 * |
|
48 * @since S60 v3.1 |
|
49 * @param server pointer to core_server |
|
50 * @param drivers pointer to lower adaptation |
|
51 * @param adaptation pointer to upper adaptation |
|
52 */ |
|
53 core_eapol_handler_c( |
|
54 core_server_c* server, |
|
55 abs_core_driverif_c* drivers, |
|
56 abs_core_server_callback_c* adaptation ); |
|
57 |
|
58 /** |
|
59 * destructor |
|
60 */ |
|
61 virtual ~core_eapol_handler_c(); |
|
62 |
|
63 /** |
|
64 * eapol_handler |
|
65 * @since S60 v3.1 |
|
66 * @return handler for EAPOL callbacks. |
|
67 */ |
|
68 abs_wlan_eapol_callback_interface_c* eapol_handler(); |
|
69 |
|
70 /** |
|
71 * Function to convert core_error_e to interface status |
|
72 * @since S60 v3.2 |
|
73 * @param core_error |
|
74 * @return interface status |
|
75 */ |
|
76 static u32_t convert_core_error_to_if_status( |
|
77 core_error_e core_error ); |
|
78 |
|
79 /** |
|
80 * Direct the callbacks from EAPOL to the given handler. |
|
81 * |
|
82 * @since S60 v3.1 |
|
83 * @param New handler of EAPOL callbacks. |
|
84 */ |
|
85 void set_eapol_handler( |
|
86 abs_wlan_eapol_callback_interface_c* handler ); |
|
87 |
|
88 /** |
|
89 * Direct the Protected Setup events to the given handler. |
|
90 * |
|
91 * @since S60 v3.2 |
|
92 * @param New handler of Protected Setup events. |
|
93 */ |
|
94 void set_protected_setup_handler( |
|
95 abs_core_protected_setup_handler_c* handler ); |
|
96 |
|
97 // from base class abs_wlan_eapol_callback_interface_c |
|
98 |
|
99 /** |
|
100 * packet_send sends a frame given by EAPOL |
|
101 * |
|
102 * @since S60 v3.1 |
|
103 * @param send_network_id |
|
104 * @param packet_data contains the data of the frame |
|
105 * @param packet_data_length contains the length of the data |
|
106 * @param send_unencrypted Whether the frame must be sent unencrypted. |
|
107 * @return status value |
|
108 */ |
|
109 core_error_e packet_send( |
|
110 network_id_c * send_network_id, |
|
111 u8_t * packet_data, |
|
112 u32_t packet_data_length, |
|
113 bool_t send_unencrypted ); |
|
114 |
|
115 /** |
|
116 * associate |
|
117 * |
|
118 * @since S60 v3.1 |
|
119 * @param authentication_mode |
|
120 * @return status value |
|
121 */ |
|
122 core_error_e associate( |
|
123 wlan_eapol_if_eapol_key_authentication_mode_e authentication_mode ); |
|
124 |
|
125 /** |
|
126 * disassociate |
|
127 * |
|
128 * @since S60 v3.1 |
|
129 * @param receive_network_id |
|
130 * @param self_disassociation |
|
131 * @return status value |
|
132 */ |
|
133 core_error_e disassociate( |
|
134 network_id_c * receive_network_id, |
|
135 const bool_t self_disassociation ); |
|
136 |
|
137 /** |
|
138 * packet_data_session_key |
|
139 * |
|
140 * @since S60 v3.1 |
|
141 * @param send_network_id |
|
142 * @param key |
|
143 * @return status value |
|
144 */ |
|
145 core_error_e packet_data_session_key( |
|
146 network_id_c * send_network_id, |
|
147 session_key_c * key ); |
|
148 |
|
149 /** |
|
150 * state_notification |
|
151 * |
|
152 * @since S60 v3.1 |
|
153 * @param state |
|
154 */ |
|
155 void state_notification( |
|
156 state_notification_c * state ); |
|
157 |
|
158 /** |
|
159 * reassociate |
|
160 * |
|
161 * @since S60 v3.1 |
|
162 * @param send_network_id |
|
163 * @param authentication_type |
|
164 * @param PMKID |
|
165 * @param PMKID_length |
|
166 * @return status value |
|
167 */ |
|
168 virtual core_error_e reassociate( |
|
169 network_id_c * send_network_id, |
|
170 const wlan_eapol_if_eapol_key_authentication_type_e authentication_type, |
|
171 u8_t * PMKID, |
|
172 u32_t PMKID_length ); |
|
173 |
|
174 /** |
|
175 * From abs_wlan_eapol_callback_interface_c |
|
176 */ |
|
177 virtual core_error_e complete_check_pmksa_cache( |
|
178 core_type_list_c<network_id_c> & network_id_list ); |
|
179 |
|
180 /** |
|
181 * From abs_wlan_eapol_callback_interface_c |
|
182 */ |
|
183 virtual core_error_e complete_start_wpx_fast_roam_reassociation( |
|
184 network_id_c * receive_network_id, |
|
185 u8_t * reassociation_request_ie, |
|
186 u32_t reassociation_request_ie_length ); |
|
187 |
|
188 /** |
|
189 * From abs_wlan_eapol_callback_interface_c |
|
190 */ |
|
191 virtual core_error_e new_protected_setup_credentials( |
|
192 core_type_list_c< protected_setup_credential_c > & credential_list ); |
|
193 |
|
194 /** |
|
195 * From abs_wlan_eapol_callback_interface_c |
|
196 */ |
|
197 virtual void handle_error( |
|
198 wlan_eapol_if_error_e errorcode, |
|
199 wlan_eapol_if_message_type_function_e function ); |
|
200 |
|
201 |
|
202 // from base class abs_wlan_eapol_callback_c |
|
203 |
|
204 /** |
|
205 * Callback interface to partner. |
|
206 * |
|
207 * @since S60 v3.2 |
|
208 * @param data Pointer to the data to be sent. |
|
209 * @param length Length of the data to be sent. |
|
210 * @return Return value is specified in interface specification. |
|
211 */ |
|
212 u32_t send_data( |
|
213 const void * const data, |
|
214 const u32_t length ); |
|
215 |
|
216 private: |
|
217 |
|
218 /** |
|
219 * Handle a authentication state notification. |
|
220 * |
|
221 * @param state Current EAPOL authentication state. |
|
222 * @param bssid The BSSID the notification is about. |
|
223 */ |
|
224 void handle_wlan_authentication_state( |
|
225 u32_t state, |
|
226 const core_mac_address_s& bssid ); |
|
227 |
|
228 /** |
|
229 * Convert an EAPOL state notification to a core error code. |
|
230 * |
|
231 * @param state State notification to be converted. |
|
232 * @return Core error code. |
|
233 */ |
|
234 core_error_e eapol_wlan_authentication_state_to_error( |
|
235 u32_t state ) const; |
|
236 |
|
237 /** |
|
238 * Check whether the given EAPOL state notification is an error. |
|
239 */ |
|
240 bool_t is_eapol_wlan_authentication_state_failure( |
|
241 u32_t state ) const; |
|
242 |
|
243 /** |
|
244 * Check whether the given EAPOL state notification is a success. |
|
245 */ |
|
246 bool_t is_eapol_wlan_authentication_state_success( |
|
247 u32_t state ) const; |
|
248 |
|
249 |
|
250 private: // data |
|
251 |
|
252 /** Handle to the core server. */ |
|
253 core_server_c* server_m; |
|
254 |
|
255 /** Handle to adaptation interface. */ |
|
256 abs_core_driverif_c* drivers_m; |
|
257 |
|
258 /** Handle to WLM. */ |
|
259 abs_core_server_callback_c* adaptation_m; |
|
260 |
|
261 /** The actual handler of EAPOL callbacks. */ |
|
262 abs_wlan_eapol_callback_interface_c* handler_m; |
|
263 |
|
264 /** Handler for protected setup indications. */ |
|
265 abs_core_protected_setup_handler_c* protected_setup_handler_m; |
|
266 |
|
267 }; |
|
268 |
|
269 #endif // CORE_EAPOL_HANDLER_H |