|
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: % |
|
20 */ |
|
21 |
|
22 #if !defined(_EAP_SESSION_CORE_BASE_H_) |
|
23 #define _EAP_SESSION_CORE_BASE_H_ |
|
24 |
|
25 #include "eap_tools.h" |
|
26 #include "eap_am_export.h" |
|
27 #include "abs_eap_core.h" |
|
28 #include "eap_core_map.h" |
|
29 #include "eap_database_reference_if.h" |
|
30 #include "eapol_key_types.h" |
|
31 |
|
32 class abs_eap_session_core_c; |
|
33 |
|
34 /// A eap_session_core_base_c class implements mapping of EAP authentication sessions. |
|
35 /// Network identity separates parallel EAP authentication sessions. |
|
36 class EAP_EXPORT eap_session_core_base_c |
|
37 : public eap_database_reference_if_c |
|
38 { |
|
39 private: |
|
40 //-------------------------------------------------- |
|
41 |
|
42 |
|
43 //-------------------------------------------------- |
|
44 protected: |
|
45 //-------------------------------------------------- |
|
46 |
|
47 //-------------------------------------------------- |
|
48 public: |
|
49 //-------------------------------------------------- |
|
50 |
|
51 /** |
|
52 * The destructor of the eap_core class does nothing special. |
|
53 */ |
|
54 EAP_FUNC_IMPORT virtual ~eap_session_core_base_c(); |
|
55 |
|
56 /** |
|
57 * The constructor initializes member attributes using parameters passed to it. |
|
58 * @param tools is pointer to the tools class. @see abs_eap_am_tools_c. |
|
59 * @param partner is back pointer to object which created this object. |
|
60 * @param is_client_when_true indicates whether the network entity should act |
|
61 * as a client (true) or server (false), in terms of EAP-protocol |
|
62 * whether this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
63 */ |
|
64 EAP_FUNC_IMPORT eap_session_core_base_c(); |
|
65 |
|
66 /** |
|
67 * This function must reset the state of object to same as |
|
68 * state was after the configure() function call. |
|
69 * If object reset succeeds this function must return eap_status_ok. |
|
70 * If object reset fails this function must return corresponding error status. |
|
71 * @return This function returns the status of reset operation. |
|
72 */ |
|
73 virtual eap_status_e reset() = 0; |
|
74 |
|
75 // This is documented in abs_eap_stack_interface_c::packet_process(). |
|
76 virtual eap_status_e packet_process( |
|
77 const eap_am_network_id_c * const receive_network_id, |
|
78 eap_general_header_base_c * const packet_data, |
|
79 const u32_t packet_length) = 0; |
|
80 |
|
81 /** |
|
82 * The adaptation module calls the eap_acknowledge() function after |
|
83 * any Network Protocol packet is received. This is used as a success indication. |
|
84 * This is described in RFC 2284 "PPP Extensible Authentication Protocol (EAP)". |
|
85 * @param connection_handle separates the context of the acknowledged session. |
|
86 * Mostly there is only one session in the client. |
|
87 * The server does not need eap_acknowledge() function because |
|
88 * server (EAP-authenticator) sends the EAP-success message. |
|
89 */ |
|
90 virtual eap_status_e eap_acknowledge( |
|
91 const eap_am_network_id_c * const receive_network_id) = 0; |
|
92 |
|
93 #if defined(USE_EAP_CORE_SERVER) |
|
94 /** |
|
95 * The EAP Core calls the send_eap_identity_request() function |
|
96 * when EAP-authentication is needed with another peer. |
|
97 * @param network_id includes the addresses (network identity) and packet type. |
|
98 */ |
|
99 virtual eap_status_e send_eap_identity_request( |
|
100 const eap_am_network_id_c * const network_id) = 0; |
|
101 #endif //#if defined(USE_EAP_CORE_SERVER) |
|
102 |
|
103 // This is documented in abs_eap_stack_interface_c::configure(). |
|
104 virtual eap_status_e configure() = 0; |
|
105 |
|
106 // This is documented in abs_eap_stack_interface_c::shutdown(). |
|
107 virtual eap_status_e shutdown() = 0; |
|
108 |
|
109 // This is documented in abs_eap_stack_interface_c::get_is_valid(). |
|
110 virtual bool get_is_valid() = 0; |
|
111 |
|
112 /** |
|
113 * This function cancels all EAP-sessions. |
|
114 * If this succeeds this function must return eap_status_ok. |
|
115 * If this fails this function must return corresponding error status. |
|
116 * @return This function returns the status of operation. |
|
117 */ |
|
118 virtual eap_status_e cancel_all_eap_sessions() = 0; |
|
119 |
|
120 /** |
|
121 * This function creates EAP session object synchronously. |
|
122 * @param receive_network_id identifies the removed EAP session. |
|
123 */ |
|
124 virtual eap_status_e create_eap_session( |
|
125 const eap_am_network_id_c * const receive_network_id) = 0; |
|
126 |
|
127 /** |
|
128 * This function removes EAP session object synchronously. |
|
129 * @param receive_network_id identifies the removed EAP session. |
|
130 */ |
|
131 virtual eap_status_e remove_eap_session( |
|
132 const bool complete_to_lower_layer, |
|
133 const eap_am_network_id_c * const receive_network_id) = 0; |
|
134 |
|
135 virtual eap_status_e get_802_11_authentication_mode( |
|
136 const eap_am_network_id_c * const receive_network_id, |
|
137 const eapol_key_authentication_type_e authentication_type, |
|
138 const eap_variable_data_c * const SSID, |
|
139 const eap_variable_data_c * const preshared_key) = 0; |
|
140 |
|
141 //-------------------------------------------------- |
|
142 |
|
143 EAP_FUNC_IMPORT static eap_session_core_base_c * new_eap_session_core_c( |
|
144 abs_eap_am_tools_c * const tools, |
|
145 abs_eap_session_core_c * const partner, |
|
146 const bool is_client_when_true, |
|
147 const u32_t MTU); |
|
148 |
|
149 //-------------------------------------------------- |
|
150 }; // class eap_session_core_base_c |
|
151 |
|
152 eap_session_core_base_c * new_eap_core_client_message_if_c( |
|
153 abs_eap_am_tools_c * const tools, |
|
154 abs_eap_session_core_c * const partner, |
|
155 const bool is_client_when_true, |
|
156 const u32_t MTU); |
|
157 |
|
158 //-------------------------------------------------- |
|
159 |
|
160 #endif //#if !defined(_EAP_SESSION_CORE_BASE_H_) |
|
161 |
|
162 //-------------------------------------------------- |
|
163 |
|
164 |
|
165 |
|
166 // End. |