|
1 /* |
|
2 * Copyright (c) 2001-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: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #if !defined(_EAPOL_AM_WLAN_AUTHENTICATION_H_) |
|
22 #define _EAPOL_AM_WLAN_AUTHENTICATION_H_ |
|
23 |
|
24 #include "eap_am_export.h" |
|
25 #include "eap_status.h" |
|
26 #include "eap_header.h" |
|
27 #include "eap_array.h" |
|
28 #include "eapol_key_types.h" |
|
29 |
|
30 class abs_eapol_am_wlan_authentication_c; |
|
31 class abs_eap_am_tools_c; |
|
32 class abs_eap_base_type_c; |
|
33 class eap_base_type_c; |
|
34 class eap_am_network_id_c; |
|
35 class eap_type_selection_c; |
|
36 class abs_eapol_wlan_database_reference_if_c; |
|
37 class abs_eap_state_notification_c; |
|
38 |
|
39 #if defined(USE_EAP_SIMPLE_CONFIG) |
|
40 class abs_eap_configuration_if_c; |
|
41 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
|
42 |
|
43 |
|
44 /// This is interface to adaptation module of class eapol_wlan_authentication_c. |
|
45 class EAP_EXPORT eapol_am_wlan_authentication_c |
|
46 { |
|
47 private: |
|
48 //-------------------------------------------------- |
|
49 |
|
50 //-------------------------------------------------- |
|
51 protected: |
|
52 //-------------------------------------------------- |
|
53 |
|
54 //-------------------------------------------------- |
|
55 public: |
|
56 //-------------------------------------------------- |
|
57 |
|
58 // |
|
59 virtual ~eapol_am_wlan_authentication_c(); |
|
60 |
|
61 /// @param tools: Constructor takes parameter tools that is pointer to adaptation of the platform. |
|
62 /// @param is_client_when_true: Second parameter is true when object is client and false when object is server. |
|
63 /// @param wlan_database_reference: third parameter is pointer to interface to read the current database reference. |
|
64 EAP_FUNC_IMPORT static eapol_am_wlan_authentication_c * new_eapol_am_wlan_authentication( |
|
65 abs_eap_am_tools_c * const tools, |
|
66 const bool is_client_when_true, |
|
67 const abs_eapol_wlan_database_reference_if_c * const wlan_database_reference |
|
68 ); |
|
69 |
|
70 /// This is documented in abs_eap_stack_interface_c::get_is_valid(). |
|
71 virtual bool get_is_valid() = 0; |
|
72 |
|
73 /// This is documented in abs_eap_stack_interface_c::configure(). |
|
74 virtual eap_status_e configure() = 0; |
|
75 |
|
76 /// This is documented in abs_eap_stack_interface_c::shutdown(). |
|
77 virtual eap_status_e shutdown() = 0; |
|
78 |
|
79 /// Function sets the parther object of this object. |
|
80 virtual eap_status_e set_am_partner( |
|
81 abs_eapol_am_wlan_authentication_c * am_partner |
|
82 #if defined(USE_EAP_SIMPLE_CONFIG) |
|
83 , abs_eap_configuration_if_c * const configuration_if |
|
84 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
|
85 ) = 0; |
|
86 |
|
87 /// Function resets current EAP-configuration. |
|
88 virtual eap_status_e reset_eap_configuration() = 0; |
|
89 |
|
90 /// Function sets the new WLAN parameters. |
|
91 virtual eap_status_e set_wlan_parameters( |
|
92 const eap_variable_data_c * const SSID, |
|
93 const bool WPA_override_enabled, |
|
94 const eap_variable_data_c * const wpa_preshared_key, |
|
95 const eapol_key_authentication_type_e selected_eapol_key_authentication_type) = 0; |
|
96 |
|
97 /// New association is completed. |
|
98 virtual eap_status_e association( |
|
99 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
|
100 ) = 0; |
|
101 |
|
102 /// Previous connection was disassiciated. |
|
103 virtual eap_status_e disassociation( |
|
104 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
|
105 ) = 0; |
|
106 |
|
107 /** |
|
108 * This function queries the selected and active EAP-types that can be used |
|
109 * in current connection. |
|
110 */ |
|
111 virtual eap_status_e get_selected_eap_types( |
|
112 eap_array_c<eap_type_selection_c> * const selected_eap_types) = 0; |
|
113 |
|
114 /// Function gets the current WLAN configuration, now only the HASH of the WPA(2)-PSK. |
|
115 virtual eap_status_e get_wlan_configuration( |
|
116 eap_variable_data_c * const wpa_preshared_key_hash) = 0; |
|
117 |
|
118 /** |
|
119 * This function indicates finish of the authentication to adatation module. |
|
120 * @param when_true_successfull tells whether authentication was successfull (true) or not (false). |
|
121 * @param eap_type tells the used EAP-type. |
|
122 * @param authentication_type tells the used WLAN authentication type. |
|
123 */ |
|
124 virtual eap_status_e authentication_finished( |
|
125 const bool when_true_successfull, |
|
126 const eap_type_value_e eap_type, |
|
127 const eapol_key_authentication_type_e authentication_type) = 0; |
|
128 |
|
129 /** |
|
130 * The load_module() function function indicates the lower level to |
|
131 * load new module of EAP-type. |
|
132 * @param type is the requested EAP-type. |
|
133 * @param tunneling_type is the EAP-type that tunnels the type. When plain EAP-type is used this parameter is eap_type_none. |
|
134 * @param partner is pointer to the caller object. |
|
135 * The partner of the new created EAP-type object is the caller object. |
|
136 * @param eap_type is a pointer to a pointer of EAP-type object. |
|
137 * Adaptation module sets eap_type pointer to created EAP-type object. |
|
138 * @param is_client_when_true parameter indicates whether the network entity should |
|
139 * act as a client (true) or server (false), in terms of EAP-protocol whether |
|
140 * this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
141 * @param receive_network_id includes the addresses (network identity) and packet type. |
|
142 */ |
|
143 virtual eap_status_e load_module( |
|
144 const eap_type_value_e type, |
|
145 const eap_type_value_e tunneling_type, |
|
146 abs_eap_base_type_c * const partner, |
|
147 eap_base_type_c ** const eap_type, |
|
148 const bool is_client_when_true, |
|
149 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
|
150 ) = 0; |
|
151 |
|
152 /** |
|
153 * The unload_module() function unloads the module of a EAP-type. |
|
154 * @param eap_type is the requested EAP-type. |
|
155 */ |
|
156 virtual eap_status_e unload_module( |
|
157 const eap_type_value_e type) = 0; |
|
158 |
|
159 /** |
|
160 * The read_configure() function reads the configuration data identified |
|
161 * by the field string of field_length bytes length. Adaptation module must direct |
|
162 * the query to some persistent store. |
|
163 * @see abs_eap_base_type_c::read_configure(). |
|
164 */ |
|
165 virtual eap_status_e read_configure( |
|
166 const eap_configuration_field_c * const field, |
|
167 eap_variable_data_c * const data) = 0; |
|
168 |
|
169 /** |
|
170 * The write_configure() function writes the configuration data identified |
|
171 * by the field string of field_length bytes length. Adaptation module must direct |
|
172 * the action to some persistent store. |
|
173 * @see abs_eap_base_type_c::write_configure(). |
|
174 */ |
|
175 virtual eap_status_e write_configure( |
|
176 const eap_configuration_field_c * const field, |
|
177 eap_variable_data_c * const data) = 0; |
|
178 |
|
179 /** |
|
180 * The set_timer() function initializes timer to be elapsed after p_time_ms milliseconds. |
|
181 * @param initializer is pointer to object which timer_expired() function will |
|
182 * be called after timer elapses. |
|
183 * @param id is identifier which will be returned in timer_expired() function. |
|
184 * The user selects and interprets the id for this timer. |
|
185 * @param data is pointer to any user selected data which will be returned in timer_expired() function. |
|
186 * @param p_time_ms is time of timer to elapse in milli seconds. |
|
187 * |
|
188 * Adaptation module internally implements the timer. |
|
189 */ |
|
190 virtual eap_status_e set_timer( |
|
191 abs_eap_base_timer_c * const initializer, |
|
192 const u32_t id, |
|
193 void * const data, |
|
194 const u32_t p_time_ms) = 0; |
|
195 |
|
196 /** |
|
197 * The cancel_timer() function cancels the timer id initiated by initializer. |
|
198 * @param initializer is the object that initialised the timer. |
|
199 * @param id is the identity of the timer. |
|
200 * |
|
201 * Adaptation module internally implements the timer. |
|
202 */ |
|
203 virtual eap_status_e cancel_timer( |
|
204 abs_eap_base_timer_c * const initializer, |
|
205 const u32_t id) = 0; |
|
206 |
|
207 /** |
|
208 * The cancel_all_timers() function cancels all timers. |
|
209 * User should use this in termination of the stack before |
|
210 * the adaptation module of tools is deleted. |
|
211 * Preferred mode is to cancel each timer directly |
|
212 * using cancel_timer() function. |
|
213 * |
|
214 * Adaptation module internally implements the timer. |
|
215 */ |
|
216 virtual eap_status_e cancel_all_timers() = 0; |
|
217 |
|
218 /** |
|
219 * This function queries the validity of EAP-type. |
|
220 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
221 */ |
|
222 virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0; |
|
223 |
|
224 /** |
|
225 * This function queries the list of supported EAP-types. |
|
226 * Lower layer should return eap_status_ok if this call succeeds. |
|
227 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
228 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
229 */ |
|
230 virtual eap_status_e get_eap_type_list( |
|
231 eap_array_c<eap_type_value_e> * const eap_type_list) = 0; |
|
232 |
|
233 /** |
|
234 * This is notification of internal state transition. |
|
235 * This is used for notifications, debugging and protocol testing. |
|
236 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
|
237 * and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully. |
|
238 * These two notifications are sent from EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap). |
|
239 */ |
|
240 virtual void state_notification( |
|
241 const abs_eap_state_notification_c * const state) = 0; |
|
242 |
|
243 //-------------------------------------------------- |
|
244 }; // class eapol_am_wlan_authentication_c |
|
245 |
|
246 #endif //#if !defined(_EAPOL_AM_WLAN_AUTHENTICATION_H_) |
|
247 |
|
248 //-------------------------------------------------- |
|
249 |
|
250 |
|
251 |
|
252 // End. |