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: 23 %
|
|
20 |
*/
|
|
21 |
|
|
22 |
#if !defined(_EAP_CORE_CLIENT_MESSAGE_IF_H_)
|
|
23 |
#define _EAP_CORE_CLIENT_MESSAGE_IF_H_
|
|
24 |
|
|
25 |
#include "eap_tools.h"
|
|
26 |
#include "eap_am_export.h"
|
49
|
27 |
// Start: added by script change_export_macros.sh.
|
|
28 |
#if defined(EAP_NO_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H)
|
|
29 |
#define EAP_CLASS_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_NONSHARABLE
|
|
30 |
#define EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
31 |
#define EAP_C_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
32 |
#define EAP_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
33 |
#define EAP_C_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
34 |
#elif defined(EAP_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H)
|
|
35 |
#define EAP_CLASS_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_EXPORT
|
|
36 |
#define EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_FUNC_EXPORT
|
|
37 |
#define EAP_C_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_C_FUNC_EXPORT
|
|
38 |
#define EAP_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_FUNC_EXPORT
|
|
39 |
#define EAP_C_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_C_FUNC_EXPORT
|
|
40 |
#else
|
|
41 |
#define EAP_CLASS_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_IMPORT
|
|
42 |
#define EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_FUNC_IMPORT
|
|
43 |
#define EAP_C_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_C_FUNC_IMPORT
|
|
44 |
#define EAP_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
45 |
#define EAP_C_FUNC_EXPORT_EAP_CORE_CLIENT_MESSAGE_IF_H
|
|
46 |
#endif
|
|
47 |
// End: added by script change_export_macros.sh.
|
26
|
48 |
#include "eap_session_core_base.h"
|
|
49 |
#include "abs_eap_session_core.h"
|
|
50 |
#include "eap_core_map.h"
|
|
51 |
#include "abs_eap_stack_interface.h"
|
|
52 |
#include "abs_eap_am_message_if.h"
|
|
53 |
#include "eap_am_message_if.h"
|
|
54 |
#include "eap_process_tlv_message_data.h"
|
|
55 |
#include "eap_database_reference_if.h"
|
|
56 |
|
|
57 |
class eap_tlv_header_c;
|
|
58 |
|
|
59 |
|
|
60 |
/// A eap_core_client_message_if_c class implements mapping of EAP authentication sessions.
|
|
61 |
/// Network identity separates parallel EAP authentication sessions.
|
49
|
62 |
class EAP_CLASS_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_core_client_message_if_c
|
26
|
63 |
: public abs_eap_am_message_if_c
|
|
64 |
, public eap_session_core_base_c
|
|
65 |
, public abs_eap_base_timer_c
|
|
66 |
, public abs_eap_stack_interface_c
|
|
67 |
{
|
|
68 |
private:
|
|
69 |
//--------------------------------------------------
|
|
70 |
|
|
71 |
/// This is pointer to the tools class.
|
|
72 |
abs_eap_am_tools_c * const m_am_tools;
|
|
73 |
|
|
74 |
/// eap_core_client_message_if_c deletes m_server_if in destructor.
|
|
75 |
eap_am_message_if_c * m_server_if;
|
|
76 |
|
|
77 |
/// This is back pointer to object which created this object.
|
|
78 |
/// Packets are sent to the partner.
|
|
79 |
abs_eap_session_core_c * const m_partner;
|
|
80 |
|
|
81 |
eap_status_e m_error_code;
|
|
82 |
|
|
83 |
eap_tlv_message_type_function_e m_error_function;
|
|
84 |
|
|
85 |
/// This is offset in bytes of the EAP header.
|
|
86 |
u32_t m_eap_header_offset;
|
|
87 |
|
|
88 |
/// This is maximum transfer unit in bytes.
|
|
89 |
u32_t m_MTU;
|
|
90 |
|
|
91 |
/// This is length of the trailer in bytes.
|
|
92 |
u32_t m_trailer_length;
|
|
93 |
|
|
94 |
/// This indicates whether this object is client (true) or server (false).
|
|
95 |
/// In terms of EAP-protocol whether this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
96 |
bool m_is_client;
|
|
97 |
|
|
98 |
/// This indicates whether this object was generated successfully.
|
|
99 |
bool m_is_valid;
|
|
100 |
|
|
101 |
bool m_shutdown_was_called;
|
|
102 |
|
|
103 |
// This is documented in abs_eap_stack_interface_c::set_is_valid().
|
|
104 |
void set_is_valid();
|
|
105 |
|
|
106 |
eap_status_e process_message(eap_process_tlv_message_data_c * const message);
|
|
107 |
|
|
108 |
eap_status_e process_error_message(
|
|
109 |
const eap_status_e error_code,
|
|
110 |
const eap_tlv_message_type_function_e function);
|
|
111 |
|
|
112 |
eap_status_e process_message_type_error(
|
|
113 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
114 |
|
|
115 |
eap_status_e packet_send(
|
|
116 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
117 |
|
|
118 |
eap_status_e state_notification(
|
|
119 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
120 |
|
|
121 |
eap_status_e packet_data_crypto_keys(
|
|
122 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
123 |
|
|
124 |
eap_status_e restart_authentication(
|
|
125 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
126 |
|
|
127 |
eap_status_e new_protected_setup_credentials(
|
|
128 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
129 |
|
|
130 |
eap_status_e complete_get_802_11_authentication_mode(
|
|
131 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
132 |
|
|
133 |
eap_status_e complete_remove_eap_session(
|
|
134 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
135 |
|
|
136 |
eap_status_e eap_mtu(
|
|
137 |
const u32_t MTU);
|
|
138 |
|
|
139 |
//--------------------------------------------------
|
|
140 |
protected:
|
|
141 |
//--------------------------------------------------
|
|
142 |
|
|
143 |
//--------------------------------------------------
|
|
144 |
public:
|
|
145 |
//--------------------------------------------------
|
|
146 |
|
|
147 |
/**
|
|
148 |
* The destructor of the eap_core class does nothing special.
|
|
149 |
*/
|
49
|
150 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H virtual ~eap_core_client_message_if_c();
|
26
|
151 |
|
|
152 |
/**
|
|
153 |
* The constructor initializes member attributes using parameters passed to it.
|
|
154 |
* @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
|
|
155 |
* @param partner is back pointer to object which created this object.
|
|
156 |
* @param is_client_when_true indicates whether the network entity should act
|
|
157 |
* as a client (true) or server (false), in terms of EAP-protocol
|
|
158 |
* whether this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
159 |
*/
|
49
|
160 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_core_client_message_if_c(
|
26
|
161 |
abs_eap_am_tools_c * const tools,
|
|
162 |
eap_am_message_if_c * const server,
|
|
163 |
abs_eap_session_core_c * const partner,
|
|
164 |
const bool is_client_when_true);
|
|
165 |
|
|
166 |
void set_partner(abs_eap_am_message_if_c * const client);
|
|
167 |
|
|
168 |
/**
|
|
169 |
* This function must reset the state of object to same as
|
|
170 |
* state was after the configure() function call.
|
|
171 |
* If object reset succeeds this function must return eap_status_ok.
|
|
172 |
* If object reset fails this function must return corresponding error status.
|
|
173 |
* @return This function returns the status of reset operation.
|
|
174 |
*/
|
49
|
175 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e reset();
|
26
|
176 |
|
|
177 |
/**
|
|
178 |
* This function cancels all EAP-sessions.
|
|
179 |
* If this succeeds this function must return eap_status_ok.
|
|
180 |
* If this fails this function must return corresponding error status.
|
|
181 |
* @return This function returns the status of operation.
|
|
182 |
*/
|
49
|
183 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e cancel_all_eap_sessions();
|
26
|
184 |
|
|
185 |
// This is documented in abs_eap_stack_interface_c::packet_process().
|
49
|
186 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e packet_process(
|
26
|
187 |
const eap_am_network_id_c * const receive_network_id,
|
|
188 |
eap_general_header_base_c * const packet_data,
|
|
189 |
const u32_t packet_length);
|
|
190 |
|
|
191 |
/**
|
|
192 |
* The adaptation module calls the eap_acknowledge() function after
|
|
193 |
* any Network Protocol packet is received. This is used as a success indication.
|
|
194 |
* This is described in RFC 2284 "PPP Extensible Authentication Protocol (EAP)".
|
|
195 |
* @param connection_handle separates the context of the acknowledged session.
|
|
196 |
* Mostly there is only one session in the client.
|
|
197 |
* The server does not need eap_acknowledge() function because
|
|
198 |
* server (EAP-authenticator) sends the EAP-success message.
|
|
199 |
*/
|
49
|
200 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e eap_acknowledge(
|
26
|
201 |
const eap_am_network_id_c * const receive_network_id);
|
|
202 |
|
|
203 |
#if defined(USE_EAP_CORE_SERVER)
|
|
204 |
/**
|
|
205 |
* The EAP Core calls the send_eap_identity_request() function
|
|
206 |
* when EAP-authentication is needed with another peer.
|
|
207 |
* @param network_id includes the addresses (network identity) and packet type.
|
|
208 |
*/
|
49
|
209 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e send_eap_identity_request(
|
26
|
210 |
const eap_am_network_id_c * const network_id);
|
|
211 |
#endif //#if defined(USE_EAP_CORE_SERVER)
|
|
212 |
|
|
213 |
// This is documented in abs_eap_stack_interface_c::configure().
|
49
|
214 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e configure();
|
26
|
215 |
|
|
216 |
// This is documented in abs_eap_stack_interface_c::shutdown().
|
49
|
217 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e shutdown();
|
26
|
218 |
|
|
219 |
// This is documented in abs_eap_stack_interface_c::get_is_valid().
|
49
|
220 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H bool get_is_valid();
|
26
|
221 |
|
|
222 |
/**
|
|
223 |
* This function creates EAP session object synchronously.
|
|
224 |
* @param receive_network_id identifies the removed EAP session.
|
|
225 |
*/
|
49
|
226 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e create_eap_session(
|
26
|
227 |
const eap_am_network_id_c * const receive_network_id);
|
|
228 |
|
|
229 |
/**
|
|
230 |
* This function removes EAP session object synchronously.
|
|
231 |
* @param receive_network_id identifies the removed EAP session.
|
|
232 |
*/
|
49
|
233 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e remove_eap_session(
|
26
|
234 |
const bool complete_to_lower_layer,
|
|
235 |
const eap_am_network_id_c * const receive_network_id);
|
|
236 |
|
|
237 |
// See abs_eap_base_timer_c::timer_expired().
|
49
|
238 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e timer_expired(
|
26
|
239 |
const u32_t id, void *data);
|
|
240 |
|
|
241 |
// See abs_eap_base_timer_c::timer_delete_data().
|
49
|
242 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e timer_delete_data(
|
26
|
243 |
const u32_t id, void *data);
|
|
244 |
|
|
245 |
// See abs_eap_am_message_if_c::send_data().
|
49
|
246 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e send_data(const void * const data, const u32_t length);
|
26
|
247 |
|
|
248 |
|
49
|
249 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e set_eap_database_reference_values(
|
26
|
250 |
const eap_variable_data_c * const reference);
|
|
251 |
|
49
|
252 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e get_802_11_authentication_mode(
|
26
|
253 |
const eap_am_network_id_c * const receive_network_id,
|
|
254 |
const eapol_key_authentication_type_e authentication_type,
|
|
255 |
const eap_variable_data_c * const SSID,
|
|
256 |
const eap_variable_data_c * const preshared_key);
|
|
257 |
|
49
|
258 |
EAP_FUNC_VISIBILITY_EAP_CORE_CLIENT_MESSAGE_IF_H eap_status_e complete_get_802_11_authentication_mode(
|
26
|
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);
|
|
262 |
|
|
263 |
//--------------------------------------------------
|
|
264 |
}; // class eap_core_client_message_if_c
|
|
265 |
|
|
266 |
//--------------------------------------------------
|
|
267 |
|
|
268 |
#endif //#if !defined(_EAP_CORE_CLIENT_MESSAGE_IF_H_)
|
|
269 |
|
|
270 |
//--------------------------------------------------
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
// End.
|