|
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_ETHERNET_CORE_H_) |
|
22 #define _ABS_ETHERNET_CORE_H_ |
|
23 |
|
24 #include "eap_header.h" |
|
25 #include "eap_array.h" |
|
26 #include "eapol_key_state.h" |
|
27 |
|
28 |
|
29 class abs_eapol_core_c; |
|
30 class eap_am_network_id_c; |
|
31 class eap_buf_chain_wr_c; |
|
32 class abs_eap_base_type_c; |
|
33 class eap_base_type_c; |
|
34 class eapol_session_key_c; |
|
35 class abs_eap_state_notification_c; |
|
36 class eap_rogue_ap_entry_c; |
|
37 |
|
38 /// The abs_ethernet_core_c class defines the interface the ethernet_core_c class |
|
39 /// will use with the partner class. |
|
40 /// Later eapol and ethernet could be integrated. |
|
41 /// Now I am too lazy and there could be some benefit using separate eapol and ethernet layers. |
|
42 class EAP_EXPORT abs_ethernet_core_c |
|
43 { |
|
44 private: |
|
45 //-------------------------------------------------- |
|
46 |
|
47 //-------------------------------------------------- |
|
48 protected: |
|
49 //-------------------------------------------------- |
|
50 |
|
51 //-------------------------------------------------- |
|
52 public: |
|
53 //-------------------------------------------------- |
|
54 |
|
55 // |
|
56 virtual ~abs_ethernet_core_c() |
|
57 { |
|
58 } |
|
59 |
|
60 // |
|
61 abs_ethernet_core_c() |
|
62 { |
|
63 } |
|
64 |
|
65 // |
|
66 virtual eap_status_e packet_send( |
|
67 const eap_am_network_id_c * const network_id, |
|
68 eap_buf_chain_wr_c * const sent_packet, |
|
69 const u32_t header_offset, |
|
70 const u32_t data_length, |
|
71 const u32_t buffer_length) = 0; |
|
72 |
|
73 // |
|
74 virtual u32_t get_header_offset( |
|
75 u32_t * const MTU, |
|
76 u32_t * const trailer_length) = 0; |
|
77 |
|
78 // |
|
79 virtual eap_status_e load_module( |
|
80 const eap_type_value_e type, |
|
81 const eap_type_value_e /* tunneling_type */, |
|
82 abs_eap_base_type_c * const partner, |
|
83 eap_base_type_c ** const eap_type, |
|
84 const bool is_client_when_true, |
|
85 const eap_am_network_id_c * const receive_network_id) = 0; |
|
86 |
|
87 // |
|
88 virtual eap_status_e unload_module(const eap_type_value_e type) = 0; |
|
89 |
|
90 /** |
|
91 * The packet_data_session_key() function passes one traffic encryption key to |
|
92 * the lower layers. Ultimately the key can end up to the WLAN hardware. |
|
93 * @see abs_eapol_core_c::packet_data_session_key(). |
|
94 */ |
|
95 virtual eap_status_e packet_data_session_key( |
|
96 const eap_am_network_id_c * const send_network_id, |
|
97 const eapol_session_key_c * const key |
|
98 ) = 0; |
|
99 |
|
100 virtual eap_status_e read_configure( |
|
101 const eap_configuration_field_c * const field, |
|
102 eap_variable_data_c * const data) = 0; |
|
103 |
|
104 virtual eap_status_e write_configure( |
|
105 const eap_configuration_field_c * const field, |
|
106 eap_variable_data_c * const data) = 0; |
|
107 |
|
108 /** |
|
109 * This is notification of internal state transition. |
|
110 * This is used for notifications, debugging and protocol testing. |
|
111 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
|
112 * and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully. |
|
113 * These two notifications are sent from EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap). |
|
114 */ |
|
115 virtual void state_notification( |
|
116 const abs_eap_state_notification_c * const state) = 0; |
|
117 |
|
118 virtual bool get_is_client() = 0; |
|
119 |
|
120 /** |
|
121 * The set_timer() function initializes timer to be elapsed after p_time_ms milliseconds. |
|
122 * @param initializer is pointer to object which timer_expired() function will |
|
123 * be called after timer elapses. |
|
124 * @param id is identifier which will be returned in timer_expired() function. |
|
125 * The user selects and interprets the id for this timer. |
|
126 * @param data is pointer to any user selected data which will be returned in timer_expired() function. |
|
127 * |
|
128 * Adaptation module internally implements the timer. |
|
129 */ |
|
130 virtual eap_status_e set_timer( |
|
131 abs_eap_base_timer_c * const initializer, |
|
132 const u32_t id, |
|
133 void * const data, |
|
134 const u32_t p_time_ms) = 0; |
|
135 |
|
136 /** |
|
137 * The cancel_timer() function cancels the timer id initiated by initializer. |
|
138 * |
|
139 * Adaptation module internally implements the timer. |
|
140 */ |
|
141 virtual eap_status_e cancel_timer( |
|
142 abs_eap_base_timer_c * const initializer, |
|
143 const u32_t id) = 0; |
|
144 |
|
145 /** |
|
146 * The cancel_all_timers() function cancels all timers. |
|
147 * User should use this in termination of the stack before |
|
148 * the adaptation module of tools is deleted. |
|
149 * Preferred mode is to cancel each timer directly |
|
150 * using cancel_timer() function. |
|
151 * |
|
152 * Adaptation module internally implements the timer. |
|
153 */ |
|
154 virtual eap_status_e cancel_all_timers() = 0; |
|
155 |
|
156 /** |
|
157 * This function queries the validity of EAP-type. |
|
158 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
159 */ |
|
160 virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0; |
|
161 |
|
162 /** |
|
163 * This function queries the list of supported EAP-types. |
|
164 * Lower layer should return eap_status_ok if this call succeeds. |
|
165 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
166 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
167 */ |
|
168 virtual eap_status_e get_eap_type_list( |
|
169 eap_array_c<eap_type_value_e> * const eap_type_list) = 0; |
|
170 |
|
171 virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0; |
|
172 |
|
173 //-------------------------------------------------- |
|
174 }; // class abs_ethernet_core_c |
|
175 |
|
176 #endif //#if !defined(_ABS_ETHERNET_CORE_H_) |
|
177 |
|
178 //-------------------------------------------------- |
|
179 |
|
180 |
|
181 |
|
182 // End. |