|
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_EAP_RADIUS_SESSION_H_) |
|
22 #define _ABS_EAP_RADIUS_SESSION_H_ |
|
23 |
|
24 #include "eap_header.h" |
|
25 #include "eap_array.h" |
|
26 |
|
27 class eap_am_network_id_c; |
|
28 class eap_buf_chain_wr_c; |
|
29 class eap_configuration_field_c; |
|
30 class eap_variable_data_c; |
|
31 class abs_eap_base_type_c; |
|
32 class abs_eap_state_notification_c; |
|
33 class eap_base_type_c; |
|
34 class eap_rogue_ap_entry_c; |
|
35 class eap_radius_session_c; |
|
36 |
|
37 |
|
38 /// This class defines the interface the eap_core_c class |
|
39 /// will use with the partner class (lower layer). |
|
40 class EAP_EXPORT abs_eap_radius_session_c |
|
41 { |
|
42 private: |
|
43 //-------------------------------------------------- |
|
44 |
|
45 //-------------------------------------------------- |
|
46 protected: |
|
47 //-------------------------------------------------- |
|
48 |
|
49 //-------------------------------------------------- |
|
50 public: |
|
51 //-------------------------------------------------- |
|
52 |
|
53 /** |
|
54 * The destructor of the abs_eap_core class does nothing special. |
|
55 */ |
|
56 virtual ~abs_eap_radius_session_c() |
|
57 { |
|
58 } |
|
59 |
|
60 /** |
|
61 * The constructor of the abs_eap_core class does nothing special. |
|
62 */ |
|
63 abs_eap_radius_session_c() |
|
64 { |
|
65 } |
|
66 |
|
67 /** |
|
68 * The derived class could send packets to partner class with this function. |
|
69 * @see abs_eap_base_type_c::packet_send(). |
|
70 */ |
|
71 virtual eap_status_e packet_send( |
|
72 const eap_am_network_id_c * const network_id, |
|
73 eap_buf_chain_wr_c * const sent_packet, |
|
74 const u32_t header_offset, |
|
75 const u32_t data_length, |
|
76 const u32_t buffer_length, |
|
77 eap_radius_session_c * const session |
|
78 ) = 0; |
|
79 |
|
80 /** |
|
81 * The get_header_offset() function obtains the header offset of EAP-packet. |
|
82 * @see abs_eap_base_type_c::get_header_offset(). |
|
83 */ |
|
84 virtual u32_t get_header_offset( |
|
85 u32_t * const MTU, |
|
86 u32_t * const trailer_length) = 0; |
|
87 |
|
88 /** |
|
89 * The load_module() function function indicates the lower level to |
|
90 * load new module of EAP-type. |
|
91 * @param type is the requested EAP-type. |
|
92 * @param partner is pointer to the caller object. |
|
93 * The partner of the new created EAP-type object is the caller object. |
|
94 * @param eap_type is a pointer to a pointer of EAP-type object. |
|
95 * Adaptation module sets eap_type pointer to created EAP-type object. |
|
96 * @param is_client_when_true parameter indicates whether the network entity should |
|
97 * act as a client (true) or server (false), in terms of EAP-protocol whether |
|
98 * this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
99 * @param receive_network_id includes the addresses (network identity) and packet type. |
|
100 */ |
|
101 virtual eap_status_e load_module( |
|
102 const eap_type_value_e type, |
|
103 const eap_type_value_e /* tunneling_type */, |
|
104 abs_eap_base_type_c * const partner, |
|
105 eap_base_type_c ** const eap_type, |
|
106 const bool is_client_when_true, |
|
107 const eap_am_network_id_c * const receive_network_id) = 0; |
|
108 |
|
109 /** |
|
110 * The unload_module() function unloads the module of a EAP-type. |
|
111 * @param eap_type is the requested EAP-type. |
|
112 */ |
|
113 virtual eap_status_e unload_module(const eap_type_value_e eap_type) = 0; |
|
114 |
|
115 /** |
|
116 * The session calls the restart_authentication() function |
|
117 * when EAP-authentication is needed with another peer. |
|
118 * This is also used when session restarts authentication. |
|
119 * @param receive_network_id includes the addresses (network identity) and packet type. |
|
120 * @param is_client_when_true indicates whether the EAP-type should act as a client or server, |
|
121 * in terms of EAP-protocol whether this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
122 * @param force_clean_restart this selects whether the server removes this session (true) or not (false). |
|
123 * @param from_timer tells whether the timer calls this function (true) or not (false). |
|
124 */ |
|
125 virtual eap_status_e restart_authentication( |
|
126 const eap_am_network_id_c * const receive_network_id, |
|
127 const bool is_client_when_true, |
|
128 const bool force_clean_restart, |
|
129 const bool from_timer = false) = 0; |
|
130 |
|
131 /** |
|
132 * The read_configure() function reads the configuration data identified |
|
133 * by the field string of field_length bytes length. Adaptation module must direct |
|
134 * the query to some persistent store. |
|
135 * @see abs_eap_base_type_c::read_configure(). |
|
136 */ |
|
137 virtual eap_status_e read_configure( |
|
138 const eap_configuration_field_c * const field, |
|
139 eap_variable_data_c * const data) = 0; |
|
140 |
|
141 /** |
|
142 * The write_configure() function writes the configuration data identified |
|
143 * by the field string of field_length bytes length. Adaptation module must direct |
|
144 * the action to some persistent store. |
|
145 * @see abs_eap_base_type_c::write_configure(). |
|
146 */ |
|
147 virtual eap_status_e write_configure( |
|
148 const eap_configuration_field_c * const field, |
|
149 eap_variable_data_c * const data) = 0; |
|
150 |
|
151 /** |
|
152 * This function tells lower layer to remove EAP session object asyncronously. |
|
153 * @param eap_type is pointer to selector that identifies the removed EAP session. |
|
154 */ |
|
155 virtual eap_status_e asynchronous_init_remove_eap_session( |
|
156 const eap_am_network_id_c * const send_network_id) = 0; |
|
157 |
|
158 /** |
|
159 * The set_timer() function initializes timer to be elapsed after time_ms milliseconds. |
|
160 * @param initializer is pointer to object which timer_expired() function will |
|
161 * be called after timer elapses. |
|
162 * @param id is identifier which will be returned in timer_expired() function. |
|
163 * The user selects and interprets the id for this timer. |
|
164 * @param data is pointer to any user selected data which will be returned in timer_expired() function. |
|
165 * @param time_ms is the time of timer in milli seconds. |
|
166 * |
|
167 * Adaptation module internally implements the timer. |
|
168 */ |
|
169 virtual eap_status_e set_timer( |
|
170 abs_eap_base_timer_c * const initializer, |
|
171 const u32_t id, |
|
172 void * const data, |
|
173 const u32_t time_ms) = 0; |
|
174 |
|
175 /** |
|
176 * The cancel_timer() function cancels the timer id initiated by initializer. |
|
177 * @param initializer is pointer to object which set the cancelled timer. |
|
178 * @param id is identifier which will be returned in timer_expired() function. |
|
179 * The user selects and interprets the id for this timer. |
|
180 * |
|
181 * Adaptation module internally implements the timer. |
|
182 */ |
|
183 virtual eap_status_e cancel_timer( |
|
184 abs_eap_base_timer_c * const initializer, |
|
185 const u32_t id) = 0; |
|
186 |
|
187 /** |
|
188 * The cancel_all_timers() function cancels all timers. |
|
189 * User should use this in termination of the stack before |
|
190 * the adaptation module of tools is deleted. |
|
191 * Preferred mode is to cancel each timer directly |
|
192 * using cancel_timer() function. |
|
193 * |
|
194 * Adaptation module internally implements the timer. |
|
195 */ |
|
196 virtual eap_status_e cancel_all_timers() = 0; |
|
197 |
|
198 /** |
|
199 * This function queries the validity of EAP-type. |
|
200 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
201 * @param eap_type is the requested EAP-type. |
|
202 */ |
|
203 virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0; |
|
204 |
|
205 /** |
|
206 * This function queries the list of supported EAP-types. |
|
207 * Lower layer should return eap_status_ok if this call succeeds. |
|
208 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
209 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
210 */ |
|
211 virtual eap_status_e get_eap_type_list( |
|
212 eap_array_c<eap_type_value_e> * const eap_type_list) = 0; |
|
213 |
|
214 virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0; |
|
215 |
|
216 /** |
|
217 * The set_session_timeout() function changes the session timeout timer to be elapsed after session_timeout_ms milliseconds. |
|
218 */ |
|
219 virtual eap_status_e set_session_timeout( |
|
220 const u32_t session_timeout_ms) = 0; |
|
221 |
|
222 //-------------------------------------------------- |
|
223 }; // class abs_eap_radius_session_c |
|
224 |
|
225 #endif //#if !defined(_ABS_EAP_RADIUS_SESSION_H_) |
|
226 |
|
227 //-------------------------------------------------- |
|
228 |
|
229 |
|
230 |
|
231 // End. |