26
|
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 |
* %version: 7 %
|
|
20 |
*/
|
|
21 |
|
|
22 |
#if !defined(_ABS_EAP_SESSION_CORE_H_)
|
|
23 |
#define _ABS_EAP_SESSION_CORE_H_
|
|
24 |
|
|
25 |
#include "eap_header.h"
|
|
26 |
#include "eap_array.h"
|
|
27 |
#if defined(USE_EAP_SIMPLE_CONFIG)
|
|
28 |
#include "abs_eap_configuration_if.h"
|
|
29 |
#endif // #if defined(USE_EAP_SIMPLE_CONFIG)
|
|
30 |
#include "eapol_key_types.h"
|
49
|
31 |
#include "eap_am_export.h"
|
|
32 |
// Start: added by script change_export_macros.sh.
|
|
33 |
#if defined(EAP_NO_EXPORT_ABS_EAP_SESSION_CORE_H)
|
|
34 |
#define EAP_CLASS_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_NONSHARABLE
|
|
35 |
#define EAP_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H
|
|
36 |
#define EAP_C_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H
|
|
37 |
#define EAP_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H
|
|
38 |
#define EAP_C_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H
|
|
39 |
#elif defined(EAP_EXPORT_ABS_EAP_SESSION_CORE_H)
|
|
40 |
#define EAP_CLASS_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_EXPORT
|
|
41 |
#define EAP_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_FUNC_EXPORT
|
|
42 |
#define EAP_C_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_C_FUNC_EXPORT
|
|
43 |
#define EAP_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H EAP_FUNC_EXPORT
|
|
44 |
#define EAP_C_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H EAP_C_FUNC_EXPORT
|
|
45 |
#else
|
|
46 |
#define EAP_CLASS_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_IMPORT
|
|
47 |
#define EAP_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_FUNC_IMPORT
|
|
48 |
#define EAP_C_FUNC_VISIBILITY_ABS_EAP_SESSION_CORE_H EAP_C_FUNC_IMPORT
|
|
49 |
#define EAP_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H
|
|
50 |
#define EAP_C_FUNC_EXPORT_ABS_EAP_SESSION_CORE_H
|
|
51 |
#endif
|
|
52 |
// End: added by script change_export_macros.sh.
|
|
53 |
|
26
|
54 |
|
|
55 |
class eap_am_network_id_c;
|
|
56 |
class eap_buf_chain_wr_c;
|
|
57 |
class eap_configuration_field_c;
|
|
58 |
class eap_variable_data_c;
|
|
59 |
class abs_eap_base_type_c;
|
|
60 |
class abs_eap_state_notification_c;
|
|
61 |
class eap_base_type_c;
|
|
62 |
class eap_rogue_ap_entry_c;
|
|
63 |
class eap_master_session_key_c;
|
|
64 |
|
|
65 |
|
|
66 |
/// This class defines the interface the eap_core_c class
|
|
67 |
/// will use with the partner class (lower layer).
|
49
|
68 |
class EAP_CLASS_VISIBILITY_ABS_EAP_SESSION_CORE_H abs_eap_session_core_c
|
26
|
69 |
#if defined(USE_EAP_SIMPLE_CONFIG)
|
|
70 |
: public abs_eap_configuration_if_c
|
|
71 |
#endif // #if defined(USE_EAP_SIMPLE_CONFIG)
|
|
72 |
{
|
|
73 |
private:
|
|
74 |
//--------------------------------------------------
|
|
75 |
|
|
76 |
//--------------------------------------------------
|
|
77 |
protected:
|
|
78 |
//--------------------------------------------------
|
|
79 |
|
|
80 |
//--------------------------------------------------
|
|
81 |
public:
|
|
82 |
//--------------------------------------------------
|
|
83 |
|
|
84 |
/**
|
|
85 |
* The destructor of the abs_eap_core class does nothing special.
|
|
86 |
*/
|
|
87 |
virtual ~abs_eap_session_core_c()
|
|
88 |
{
|
|
89 |
}
|
|
90 |
|
|
91 |
/**
|
|
92 |
* The constructor of the abs_eap_core class does nothing special.
|
|
93 |
*/
|
|
94 |
abs_eap_session_core_c()
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
/**
|
|
99 |
* The derived class could send packets to partner class with this function.
|
|
100 |
* @see abs_eap_base_type_c::packet_send().
|
|
101 |
*/
|
|
102 |
virtual eap_status_e packet_send(
|
|
103 |
const eap_am_network_id_c * const network_id,
|
|
104 |
eap_buf_chain_wr_c * const sent_packet,
|
|
105 |
const u32_t header_offset,
|
|
106 |
const u32_t data_length,
|
|
107 |
const u32_t buffer_length) = 0;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* The get_header_offset() function obtains the header offset of EAP-packet.
|
|
111 |
* @see abs_eap_base_type_c::get_header_offset().
|
|
112 |
*/
|
|
113 |
virtual u32_t get_header_offset(
|
|
114 |
u32_t * const MTU,
|
|
115 |
u32_t * const trailer_length) = 0;
|
|
116 |
|
|
117 |
/**
|
|
118 |
* The load_module() function function indicates the lower level to
|
|
119 |
* load new module of EAP-type.
|
|
120 |
* @param type is the requested EAP-type.
|
|
121 |
* @param partner is pointer to the caller object.
|
|
122 |
* The partner of the new created EAP-type object is the caller object.
|
|
123 |
* @param eap_type is a pointer to a pointer of EAP-type object.
|
|
124 |
* Adaptation module sets eap_type pointer to created EAP-type object.
|
|
125 |
* @param is_client_when_true parameter indicates whether the network entity should
|
|
126 |
* act as a client (true) or server (false), in terms of EAP-protocol whether
|
|
127 |
* this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
128 |
* @param receive_network_id includes the addresses (network identity) and packet type.
|
|
129 |
*/
|
|
130 |
virtual eap_status_e load_module(
|
|
131 |
const eap_type_value_e type,
|
|
132 |
const eap_type_value_e /* tunneling_type */,
|
|
133 |
abs_eap_base_type_c * const partner,
|
|
134 |
eap_base_type_c ** const eap_type,
|
|
135 |
const bool is_client_when_true,
|
|
136 |
const eap_am_network_id_c * const receive_network_id) = 0;
|
|
137 |
|
|
138 |
/**
|
|
139 |
* The unload_module() function unloads the module of a EAP-type.
|
|
140 |
* @param eap_type is the requested EAP-type.
|
|
141 |
*/
|
|
142 |
virtual eap_status_e unload_module(const eap_type_value_e eap_type) = 0;
|
|
143 |
|
|
144 |
/**
|
|
145 |
* The session calls the restart_authentication() function
|
|
146 |
* when EAP-authentication is needed with another peer.
|
|
147 |
* This is also used when session restarts authentication.
|
|
148 |
* @param receive_network_id includes the addresses (network identity) and packet type.
|
|
149 |
* @param is_client_when_true indicates whether the EAP-type should act as a client or server,
|
|
150 |
* in terms of EAP-protocol whether this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
151 |
* @param force_clean_restart this selects whether the server removes this session (true) or not (false).
|
|
152 |
* @param from_timer tells whether the timer calls this function (true) or not (false).
|
|
153 |
*/
|
|
154 |
virtual eap_status_e restart_authentication(
|
|
155 |
const eap_am_network_id_c * const receive_network_id,
|
|
156 |
const bool is_client_when_true,
|
|
157 |
const bool force_clean_restart,
|
|
158 |
const bool from_timer = false) = 0;
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Note this function is just an example. Parameters will change later.
|
|
162 |
* The packet_data_crypto_keys() function gives the generated keys to lower level.
|
|
163 |
* After EAP-authentication has generated the keys it calls this function
|
|
164 |
* to offer the keys to lower level.
|
|
165 |
* @see abs_eap_base_type_c::packet_data_crypto_keys().
|
|
166 |
*/
|
|
167 |
virtual eap_status_e packet_data_crypto_keys(
|
|
168 |
const eap_am_network_id_c * const send_network_id,
|
|
169 |
const eap_master_session_key_c * const master_session_key
|
|
170 |
) = 0;
|
|
171 |
|
|
172 |
/**
|
|
173 |
* The read_configure() function reads the configuration data identified
|
|
174 |
* by the field string of field_length bytes length. Adaptation module must direct
|
|
175 |
* the query to some persistent store.
|
|
176 |
* @see abs_eap_base_type_c::read_configure().
|
|
177 |
*/
|
|
178 |
virtual eap_status_e read_configure(
|
|
179 |
const eap_configuration_field_c * const field,
|
|
180 |
eap_variable_data_c * const data) = 0;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* The write_configure() function writes the configuration data identified
|
|
184 |
* by the field string of field_length bytes length. Adaptation module must direct
|
|
185 |
* the action to some persistent store.
|
|
186 |
* @see abs_eap_base_type_c::write_configure().
|
|
187 |
*/
|
|
188 |
virtual eap_status_e write_configure(
|
|
189 |
const eap_configuration_field_c * const field,
|
|
190 |
eap_variable_data_c * const data) = 0;
|
|
191 |
|
|
192 |
/**
|
|
193 |
* This is notification of internal state transition.
|
|
194 |
* This is used for notifications, debugging and protocol testing.
|
|
195 |
* The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully
|
|
196 |
* and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully.
|
|
197 |
* These two notifications are sent from EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap).
|
|
198 |
* These two notifications tells the end state of authentication session. These are the only
|
|
199 |
* reliable indications of the final status of authentication session.
|
|
200 |
* You MUST NOT make decision based on the return value of abs_eap_stack_interface_c::packet_process().
|
|
201 |
*/
|
|
202 |
virtual void state_notification(
|
|
203 |
const abs_eap_state_notification_c * const state) = 0;
|
|
204 |
|
|
205 |
/**
|
|
206 |
* The set_timer() function initializes timer to be elapsed after time_ms milliseconds.
|
|
207 |
* @param initializer is pointer to object which timer_expired() function will
|
|
208 |
* be called after timer elapses.
|
|
209 |
* @param id is identifier which will be returned in timer_expired() function.
|
|
210 |
* The user selects and interprets the id for this timer.
|
|
211 |
* @param data is pointer to any user selected data which will be returned in timer_expired() function.
|
|
212 |
* @param time_ms is the time of timer in milli seconds.
|
|
213 |
*
|
|
214 |
* Adaptation module internally implements the timer.
|
|
215 |
*/
|
|
216 |
virtual eap_status_e set_timer(
|
|
217 |
abs_eap_base_timer_c * const initializer,
|
|
218 |
const u32_t id,
|
|
219 |
void * const data,
|
|
220 |
const u32_t time_ms) = 0;
|
|
221 |
|
|
222 |
/**
|
|
223 |
* The cancel_timer() function cancels the timer id initiated by initializer.
|
|
224 |
* @param initializer is pointer to object which set the cancelled timer.
|
|
225 |
* @param id is identifier which will be returned in timer_expired() function.
|
|
226 |
* The user selects and interprets the id for this timer.
|
|
227 |
*
|
|
228 |
* Adaptation module internally implements the timer.
|
|
229 |
*/
|
|
230 |
virtual eap_status_e cancel_timer(
|
|
231 |
abs_eap_base_timer_c * const initializer,
|
|
232 |
const u32_t id) = 0;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* This function queries the validity of EAP-type.
|
|
236 |
* Lower layer should return eap_status_ok if this EAP-type is supported.
|
|
237 |
* @param eap_type is the requested EAP-type.
|
|
238 |
*/
|
|
239 |
virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* This function queries the list of supported EAP-types.
|
|
243 |
* Lower layer should return eap_status_ok if this call succeeds.
|
|
244 |
* @param eap_type_list will include the list of supported EAP-types. Each value in list
|
|
245 |
* is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values.
|
|
246 |
*/
|
|
247 |
virtual eap_status_e get_eap_type_list(
|
|
248 |
eap_array_c<eap_type_value_e> * const eap_type_list) = 0;
|
|
249 |
|
|
250 |
virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0;
|
|
251 |
|
|
252 |
/**
|
|
253 |
* The set_session_timeout() function changes the session timeout timer to be elapsed after session_timeout_ms milliseconds.
|
|
254 |
*/
|
|
255 |
virtual eap_status_e set_session_timeout(
|
|
256 |
const u32_t session_timeout_ms) = 0;
|
|
257 |
|
|
258 |
virtual eap_status_e complete_get_802_11_authentication_mode(
|
|
259 |
const eap_status_e completion_status,
|
|
260 |
const eap_am_network_id_c * const receive_network_id,
|
|
261 |
const eapol_key_802_11_authentication_mode_e mode) = 0;
|
|
262 |
|
|
263 |
virtual eap_status_e complete_remove_eap_session(
|
|
264 |
const bool complete_to_lower_layer,
|
|
265 |
const eap_am_network_id_c * const receive_network_id) = 0;
|
|
266 |
|
|
267 |
//--------------------------------------------------
|
|
268 |
}; // class abs_eap_session_core_c
|
|
269 |
|
|
270 |
#endif //#if !defined(_ABS_EAP_SESSION_CORE_H_)
|
|
271 |
|
|
272 |
//--------------------------------------------------
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
// End.
|