|
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(_ABS_SIMPLE_CONFIG_BASE_RECORD_H_) |
|
22 #define _ABS_SIMPLE_CONFIG_BASE_RECORD_H_ |
|
23 |
|
24 #include "eap_header.h" |
|
25 #include "simple_config_types.h" |
|
26 |
|
27 class eap_buf_chain_wr_c; |
|
28 class eap_variable_data_c; |
|
29 class abs_eap_state_notification_c; |
|
30 class abs_eap_base_timer_c; |
|
31 class abs_eap_base_type_c; |
|
32 class eap_base_type_c; |
|
33 class eap_network_id_selector_c; |
|
34 class eap_am_network_id_c; |
|
35 class eap_rogue_ap_entry_c; |
|
36 class eap_master_session_key_c; |
|
37 |
|
38 |
|
39 /// The class is the interface to partner class of the simple_config_base_record_c class. |
|
40 /// This declares the pure virtual member functions simple_config_base_record_c class could call. |
|
41 class EAP_EXPORT abs_simple_config_base_record_c |
|
42 { |
|
43 private: |
|
44 //-------------------------------------------------- |
|
45 |
|
46 //-------------------------------------------------- |
|
47 protected: |
|
48 //-------------------------------------------------- |
|
49 |
|
50 //-------------------------------------------------- |
|
51 public: |
|
52 //-------------------------------------------------- |
|
53 |
|
54 /** |
|
55 * The destructor of the abs_simple_config_base_record_c class does nothing special. |
|
56 */ |
|
57 virtual ~abs_simple_config_base_record_c() |
|
58 { |
|
59 } |
|
60 |
|
61 /** |
|
62 * The constructor of the abs_simple_config_base_record_c class does nothing special. |
|
63 */ |
|
64 abs_simple_config_base_record_c() |
|
65 { |
|
66 } |
|
67 |
|
68 /** |
|
69 * The derived class could send packets to partner class with this function. |
|
70 * @param sent_packet includes the buffer for the whole packet and initialized |
|
71 * SIMPLE_CONFIG-packet in correct offset. |
|
72 * @param message_type is the type of the SIMPLE_CONFIG message indicated by the higher layer. |
|
73 */ |
|
74 virtual eap_status_e simple_config_packet_send( |
|
75 eap_buf_chain_wr_c * const sent_packet, |
|
76 const simple_config_Message_Type_e message_type) = 0; |
|
77 |
|
78 /** |
|
79 * The get_header_offset() function obtains the header offset of SIMPLE_CONFIG-packet. |
|
80 * @param MTU_length is pointer to variable to store the maximum transfer unit (MTU). |
|
81 * MTU is the maximum SIMPLE_CONFIG-packet length in bytes |
|
82 * @param trailer_length is pointer to the variable to store length |
|
83 * of trailer needed by lower levels. |
|
84 * @return Function returns the offset of SIMPLE_CONFIG-header. |
|
85 * |
|
86 * The needed buffer length is ((offset) + (SIMPLE_CONFIG-packet length) + (trailer)) bytes. |
|
87 * Each layer adds the length of the header to offset. |
|
88 * Each layer removes the length of the header and trailer from MTU. |
|
89 * |
|
90 * Now some ascii graphics follows. |
|
91 * @code |
|
92 * |<-------------------------buffer length----------------------------------------->| |
|
93 * | | |
|
94 * | +-----+---------------------------------+ | |
|
95 * | | SIMPLE_CONFIG | data | | |
|
96 * | +-----+---------------------------------+ | |
|
97 * |<----offset--------------->|<----MTU------------------------------>|<--trailer-->| |
|
98 * | | | | |
|
99 * | | | | |
|
100 * | +-----+---------------------------------------+ | |
|
101 * | | EAP | data | | |
|
102 * | +-----+---------------------------------------+ | |
|
103 * |<----offset--------->|<----MTU------------------------------------>|<--trailer-->| |
|
104 * | | | | |
|
105 * | +-------+---------------------------------------------+ | |
|
106 * | | EAPOL | data | | |
|
107 * | +-------+---------------------------------------------+ | |
|
108 * |<--offset--->|<----MTU-------------------------------------------->|<--trailer-->| |
|
109 * | | | | |
|
110 * +-------------+-----------------------------------------------------+-------------+ |
|
111 * | ETHERNET | data | trailer | |
|
112 * +-------------+-----------------------------------------------------+-------------+ |
|
113 * |<----MTU------------------------------------------------------------------------>| |
|
114 * @endcode |
|
115 * |
|
116 */ |
|
117 virtual u32_t get_header_offset( |
|
118 u32_t * const MTU_length, |
|
119 u32_t * const trailer_length) = 0; |
|
120 |
|
121 /** |
|
122 * This function restarts authentication to send_network_id. |
|
123 * @param receive_network_id is network identity of source. |
|
124 * @param is_client_when_true indicates whether this object should act as a client (true) |
|
125 * or server (false), in terms of EAP-protocol whether this network entity is EAP-supplicant (true) |
|
126 * or EAP-authenticator (false). |
|
127 * @param force_clean_restart causes authentication restart even the current authentication is on going. |
|
128 * @param from_timer indicates whether this was called from timer (true). |
|
129 */ |
|
130 virtual eap_status_e restart_authentication( |
|
131 const eap_am_network_id_c * const receive_network_id, |
|
132 const bool is_client_when_true, |
|
133 const bool force_clean_restart, |
|
134 const bool from_timer) = 0; |
|
135 |
|
136 /** |
|
137 * The read_configure() function reads the configuration data identified |
|
138 * by the field string of field_length bytes length. Adaptation module must direct |
|
139 * the query 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-type should store it's parameters to an own database. The own database should be accessed |
|
145 * through adaptation module of EAP-type. See eap_am_type_simple_config_simulator_c::type_configure_read. |
|
146 */ |
|
147 virtual eap_status_e read_configure( |
|
148 const eap_configuration_field_c * const field, |
|
149 eap_variable_data_c * const data) = 0; |
|
150 |
|
151 /** |
|
152 * The write_configure() function writes the configuration data identified |
|
153 * by the field string of field_length bytes length. Adaptation module must direct |
|
154 * the action to some persistent store. |
|
155 * @param field is generic configure string idenfying the required configure data. |
|
156 * @param field_length is length of the field string. |
|
157 * @param data is pointer to existing eap_variable_data object. |
|
158 * |
|
159 * EAP-type should store it's parameters to an own database. The own database should be accessed |
|
160 * through adaptation module of EAP-type. See eap_am_type_simple_config_simulator_c::type_configure_write. |
|
161 */ |
|
162 virtual eap_status_e write_configure( |
|
163 const eap_configuration_field_c * const field, |
|
164 eap_variable_data_c * const data) = 0; |
|
165 |
|
166 /** |
|
167 * This is notification of internal state transition. |
|
168 * This is used for notifications, debugging and protocol testing. |
|
169 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
|
170 * and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully. EAP-type MUST send these |
|
171 * two notifications to lower layer. |
|
172 * These two notifications are sent using EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap). |
|
173 * See also eap_state_notification_c. |
|
174 */ |
|
175 virtual void state_notification( |
|
176 const abs_eap_state_notification_c * const state) = 0; |
|
177 |
|
178 /** |
|
179 * The set_timer() function initializes timer to be elapsed after p_time_ms milliseconds. |
|
180 * @param initializer is pointer to object which timer_expired() function will |
|
181 * be called after timer elapses. |
|
182 * @param id is identifier which will be returned in timer_expired() function. |
|
183 * The user selects and interprets the id for this timer. |
|
184 * @param data is pointer to any user selected data which will be returned in timer_expired() function. |
|
185 * |
|
186 * Adaptation module internally implements the timer. |
|
187 */ |
|
188 virtual eap_status_e set_timer( |
|
189 abs_eap_base_timer_c * const initializer, |
|
190 const u32_t id, |
|
191 void * const data, |
|
192 const u32_t p_time_ms) = 0; |
|
193 |
|
194 /** |
|
195 * The cancel_timer() function cancels the timer id initiated by initializer. |
|
196 * |
|
197 * Adaptation module internally implements the timer. |
|
198 */ |
|
199 virtual eap_status_e cancel_timer( |
|
200 abs_eap_base_timer_c * const initializer, |
|
201 const u32_t id) = 0; |
|
202 |
|
203 /** |
|
204 * The cancel_all_timers() function cancels all timers. |
|
205 * User should use this in termination of the stack before |
|
206 * the adaptation module of tools is deleted. |
|
207 * Preferred mode is to cancel each timer directly |
|
208 * using cancel_timer() function. |
|
209 * |
|
210 * Adaptation module internally implements the timer. |
|
211 */ |
|
212 virtual eap_status_e cancel_all_timers() = 0; |
|
213 |
|
214 /** |
|
215 * This is needed by PEAP type. |
|
216 * The load_module() function function indicates the lower level to |
|
217 * load new module of EAP-type. |
|
218 * @param type is the requested EAP-type. |
|
219 * @param partner is pointer to the caller object. |
|
220 * The partner of the new created EAP-type object is the caller object. |
|
221 * @param eap_type is a pointer to a pointer of EAP-type object. |
|
222 * Adaptation module sets eap_type pointer to created EAP-type object. |
|
223 * @param is_client_when_true parameter indicates whether the network entity should |
|
224 * act as a client (true) or server (false), in terms of EAP-protocol whether |
|
225 * this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
226 */ |
|
227 virtual eap_status_e load_module( |
|
228 const eap_type_value_e type, |
|
229 const eap_type_value_e /* tunneling_type */, |
|
230 abs_eap_base_type_c * const partner, |
|
231 eap_base_type_c ** const eap_type, |
|
232 const bool is_client_when_true, |
|
233 const eap_am_network_id_c * const receive_network_id) = 0; |
|
234 |
|
235 /** |
|
236 * This is needed by PEAP type. |
|
237 * The unload_module() function unloads the module of a EAP-type. |
|
238 * @param type is the requested EAP-type. |
|
239 */ |
|
240 virtual eap_status_e unload_module(const eap_type_value_e type) = 0; |
|
241 |
|
242 /** |
|
243 * Note this function is just an example. Parameters will change later. |
|
244 * The packet_data_crypto_keys() function gives the generated keys to lower level. |
|
245 * After EAP-authentication has generated the keys it calls this function |
|
246 * to offer the keys to lower level. |
|
247 * @param master_session_key is pointer to the first byte of the master session key. |
|
248 * @param master_session_length is count of bytes in the master session key. |
|
249 */ |
|
250 virtual eap_status_e packet_data_crypto_keys( |
|
251 const eap_am_network_id_c * const send_network_id, |
|
252 const eap_master_session_key_c * const master_session_key |
|
253 ) = 0; |
|
254 |
|
255 /** |
|
256 * This is needed by PEAP type. |
|
257 * This function queries the validity of EAP-type. |
|
258 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
259 */ |
|
260 virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0; |
|
261 |
|
262 /** |
|
263 * This function queries the list of supported EAP-types. |
|
264 * Lower layer should return eap_status_ok if this call succeeds. |
|
265 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
266 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
267 */ |
|
268 virtual eap_status_e get_eap_type_list( |
|
269 eap_array_c<eap_type_value_e> * const eap_type_list) = 0; |
|
270 |
|
271 /** |
|
272 * The set_session_timeout() function changes the session timeout timer to be elapsed after session_timeout_ms milliseconds. |
|
273 */ |
|
274 virtual eap_status_e set_session_timeout( |
|
275 const u32_t session_timeout_ms) = 0; |
|
276 |
|
277 virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0; |
|
278 |
|
279 //-------------------------------------------------- |
|
280 }; // class abs_simple_config_base_record_c |
|
281 |
|
282 #endif //#if !defined(_ABS_SIMPLE_CONFIG_BASE_RECORD_H_) |
|
283 |
|
284 //-------------------------------------------------- |
|
285 |
|
286 |
|
287 |
|
288 // End. |