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