41 eap_code_success = 3, ///< This is EAP-Success. |
41 eap_code_success = 3, ///< This is EAP-Success. |
42 eap_code_failure = 4, ///< This is EAP-Failure. |
42 eap_code_failure = 4, ///< This is EAP-Failure. |
43 }; |
43 }; |
44 |
44 |
45 |
45 |
|
46 #if defined(USE_EAP_EXPANDED_TYPES) |
46 /// Enumeration of the IETF defined EAP-Type values. |
47 /// Enumeration of the IETF defined EAP-Type values. |
47 enum eap_type_ietf_values_e |
48 enum eap_type_ietf_values_e |
|
49 #else |
|
50 /// This is the original enumeration of the EAP-Type values. |
|
51 enum eap_type_value_e |
|
52 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
48 { |
53 { |
49 eap_type_none = 0, ///< This is internal value for no type case. |
54 eap_type_none = 0, ///< This is internal value for no type case. |
50 eap_type_identity = 1, ///< This is Identity. |
55 eap_type_identity = 1, ///< This is Identity. |
51 eap_type_notification = 2, ///< This is Notification. |
56 eap_type_notification = 2, ///< This is Notification. |
52 eap_type_nak = 3, ///< This is Nak. |
57 eap_type_nak = 3, ///< This is Nak. |
64 eap_type_tlv_extensions = 33, ///< This is type/length/value extension type for PEAP payloads. |
69 eap_type_tlv_extensions = 33, ///< This is type/length/value extension type for PEAP payloads. |
65 #if defined(USE_FAST_EAP_TYPE) |
70 #if defined(USE_FAST_EAP_TYPE) |
66 eap_type_fast = 43, ///< This is EAP-FAST type. |
71 eap_type_fast = 43, ///< This is EAP-FAST type. |
67 #endif //#if defined(USE_FAST_EAP_TYPE) |
72 #endif //#if defined(USE_FAST_EAP_TYPE) |
68 |
73 |
|
74 eap_type_ttls_plain_pap = 98, // This is for TTLS/PAP. |
|
75 |
|
76 #if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
|
77 eap_type_plain_mschapv2 = 99, ///< This is used to indicate plain MSChapv2 inside TTLS tunnel. |
|
78 #endif //#if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
|
79 |
69 eap_type_saesim = 252, ///< This is just a test EAP-type. |
80 eap_type_saesim = 252, ///< This is just a test EAP-type. |
70 eap_type_dummy_sim = 253, ///< This is just a test EAP-type. |
81 eap_type_dummy_sim = 253, ///< This is just a test EAP-type. |
71 |
82 |
72 eap_type_expanded_type = 254, ///< This is Expanded Type. |
83 eap_type_expanded_type = 254, ///< This is Expanded Type. |
73 eap_type_experimental_type = 255, ///< This is Experimental Type. |
84 eap_type_experimental_type = 255, ///< This is Experimental Type. |
74 }; |
85 }; |
|
86 |
|
87 |
|
88 #if !defined(USE_EAP_EXPANDED_TYPES) |
|
89 typedef eap_type_value_e eap_type_ietf_values_e; |
|
90 #endif //#if !defined(USE_EAP_EXPANDED_TYPES) |
|
91 |
|
92 |
75 |
93 |
76 enum eap_type_vendor_id_e |
94 enum eap_type_vendor_id_e |
77 { |
95 { |
78 eap_type_vendor_id_ietf = 0, |
96 eap_type_vendor_id_ietf = 0, |
79 eap_type_vendor_id_broadcom = 0x0000113d, |
97 eap_type_vendor_id_broadcom = 0x0000113d, |
83 |
101 |
84 enum eap_type_vendor_type_e |
102 enum eap_type_vendor_type_e |
85 { |
103 { |
86 eap_type_vendor_type_secure_easy_setup = 10, |
104 eap_type_vendor_type_secure_easy_setup = 10, |
87 eap_type_vendor_type_WFA_simple_config = 1, |
105 eap_type_vendor_type_WFA_simple_config = 1, |
88 eap_type_vendor_type_ttls_plain_pap_hack = 98, // This is for TTLS/PAP. |
106 eap_type_vendor_type_ttls_plain_pap_hack = eap_type_ttls_plain_pap, // This is for TTLS/PAP. |
89 #if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
107 #if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
90 eap_type_vendor_type_plain_MSCHAPv2_hack = 99, // This is for plain MCHAPv2 and TTLS |
108 eap_type_vendor_type_plain_MSCHAPv2_hack = eap_type_plain_mschapv2, // This is for plain MCHAPv2 and TTLS |
91 #endif //#if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
109 #endif //#if defined(EAP_USE_TTLS_PLAIN_MS_CHAP_V2_HACK) |
92 }; |
110 }; |
93 |
111 |
94 //----------------------------------------------------------------------------------------- |
112 //----------------------------------------------------------------------------------------- |
95 //----------------------------------------------------------------------------------------- |
113 //----------------------------------------------------------------------------------------- |
106 m_vendor_id_size = 3ul*sizeof(u8_t), |
124 m_vendor_id_size = 3ul*sizeof(u8_t), |
107 m_vendor_type_size = sizeof(u32_t), |
125 m_vendor_type_size = sizeof(u32_t), |
108 m_eap_expanded_type_size = m_ietf_type_size+m_vendor_id_size+m_vendor_type_size, |
126 m_eap_expanded_type_size = m_ietf_type_size+m_vendor_id_size+m_vendor_type_size, |
109 }; |
127 }; |
110 |
128 |
111 // This must not be virtual destructor. |
|
112 EAP_FUNC_IMPORT ~eap_expanded_type_c(); |
129 EAP_FUNC_IMPORT ~eap_expanded_type_c(); |
113 |
130 |
114 EAP_FUNC_IMPORT eap_expanded_type_c(); |
131 EAP_FUNC_IMPORT eap_expanded_type_c(); |
115 |
132 |
116 EAP_FUNC_IMPORT eap_expanded_type_c( |
133 EAP_FUNC_IMPORT eap_expanded_type_c( |
118 const u32_t vendor_type); |
135 const u32_t vendor_type); |
119 |
136 |
120 EAP_FUNC_IMPORT eap_expanded_type_c( |
137 EAP_FUNC_IMPORT eap_expanded_type_c( |
121 const eap_type_ietf_values_e type); |
138 const eap_type_ietf_values_e type); |
122 |
139 |
123 EAP_FUNC_IMPORT bool get_is_valid() const; |
|
124 |
|
125 EAP_FUNC_IMPORT bool get_is_valid_data() const; |
|
126 |
|
127 EAP_FUNC_IMPORT eap_expanded_type_c * copy() const; |
|
128 |
|
129 EAP_FUNC_IMPORT static bool is_expanded_type(const eap_type_ietf_values_e eap_type); |
140 EAP_FUNC_IMPORT static bool is_expanded_type(const eap_type_ietf_values_e eap_type); |
130 |
141 |
|
142 #if defined(USE_EAP_EXPANDED_TYPES) |
131 EAP_FUNC_IMPORT static bool is_ietf_type(const eap_expanded_type_c eap_type); |
143 EAP_FUNC_IMPORT static bool is_ietf_type(const eap_expanded_type_c eap_type); |
|
144 #else |
|
145 EAP_FUNC_IMPORT static bool is_ietf_type(const eap_type_ietf_values_e eap_type); |
|
146 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
132 |
147 |
133 EAP_FUNC_IMPORT eap_status_e get_type_data( |
148 EAP_FUNC_IMPORT eap_status_e get_type_data( |
134 abs_eap_am_tools_c * const am_tools, |
149 abs_eap_am_tools_c * const am_tools, |
135 eap_type_ietf_values_e * const type) const; |
150 eap_type_ietf_values_e * const type); |
136 |
151 |
137 EAP_FUNC_IMPORT eap_status_e get_type_data( |
152 EAP_FUNC_IMPORT eap_status_e get_type_data( |
138 abs_eap_am_tools_c * const am_tools, |
153 abs_eap_am_tools_c * const am_tools, |
139 eap_expanded_type_c * const type) const; |
154 eap_expanded_type_c * const type); |
140 |
155 |
141 EAP_FUNC_IMPORT eap_status_e get_expanded_type_data( |
156 EAP_FUNC_IMPORT eap_status_e get_expanded_type_data( |
142 abs_eap_am_tools_c * const am_tools, |
157 abs_eap_am_tools_c * const am_tools, |
143 eap_variable_data_c * const data) const; |
158 eap_variable_data_c * const data); |
144 |
159 |
145 EAP_FUNC_IMPORT eap_status_e set_expanded_type_data( |
160 EAP_FUNC_IMPORT eap_status_e set_expanded_type_data( |
146 abs_eap_am_tools_c * const am_tools, |
161 abs_eap_am_tools_c * const am_tools, |
147 const eap_variable_data_c * const data); |
162 const eap_variable_data_c * const data); |
148 |
|
149 EAP_FUNC_IMPORT eap_status_e set_expanded_type_data( |
|
150 abs_eap_am_tools_c * const am_tools, |
|
151 const void * const data, |
|
152 const u32_t data_length); |
|
153 |
163 |
154 EAP_FUNC_IMPORT void set_eap_type_values( |
164 EAP_FUNC_IMPORT void set_eap_type_values( |
155 const eap_type_vendor_id_e vendor_id, |
165 const eap_type_vendor_id_e vendor_id, |
156 const u32_t vendor_type); |
166 const u32_t vendor_type); |
157 |
167 |
181 EAP_FUNC_IMPORT static eap_status_e read_type( |
191 EAP_FUNC_IMPORT static eap_status_e read_type( |
182 abs_eap_am_tools_c * const am_tools, |
192 abs_eap_am_tools_c * const am_tools, |
183 const u32_t index, |
193 const u32_t index, |
184 const void * const buffer, |
194 const void * const buffer, |
185 const u32_t buffer_length, |
195 const u32_t buffer_length, |
|
196 #if defined(USE_EAP_EXPANDED_TYPES) |
186 eap_expanded_type_c * const type |
197 eap_expanded_type_c * const type |
|
198 #else |
|
199 eap_type_ietf_values_e * const type |
|
200 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
187 ); |
201 ); |
188 |
202 |
189 /// This function writes EAP-type to offset. |
203 /// This function writes EAP-type to offset. |
190 EAP_FUNC_IMPORT static eap_status_e write_type( |
204 EAP_FUNC_IMPORT static eap_status_e write_type( |
191 abs_eap_am_tools_c * const am_tools, |
205 abs_eap_am_tools_c * const am_tools, |
192 const u32_t index, ///< Index is from 0 to n. Index 0 is the first EAP type field after base EAP header. |
206 const u32_t index, ///< Index is from 0 to n. Index 0 is the first EAP type field after base EAP header. |
193 void * const buffer, |
207 void * const buffer, |
194 const u32_t buffer_length, |
208 const u32_t buffer_length, |
195 const bool write_extented_type_when_true, ///< True value writes always Extented Type. |
209 const bool write_extented_type_when_true, ///< True value writes always Extented Type. |
|
210 #if defined(USE_EAP_EXPANDED_TYPES) |
196 const eap_expanded_type_c p_type ///< The EAP type to be written. |
211 const eap_expanded_type_c p_type ///< The EAP type to be written. |
|
212 #else |
|
213 const eap_type_ietf_values_e p_type ///< The EAP type to be written. |
|
214 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
197 ); |
215 ); |
198 |
216 |
|
217 #if defined(USE_EAP_EXPANDED_TYPES) |
199 EAP_FUNC_IMPORT i32_t compare(const eap_expanded_type_c * const data) const; |
218 EAP_FUNC_IMPORT i32_t compare(const eap_expanded_type_c * const data) const; |
|
219 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
200 |
220 |
201 private: |
221 private: |
202 |
222 |
203 eap_type_vendor_id_e m_vendor_id; ///< Here we use only 24 least significant bits. |
223 eap_type_vendor_id_e m_vendor_id; ///< Here we use only 24 least significant bits. |
204 u32_t m_vendor_type; |
224 u32_t m_vendor_type; |
255 //----------------------------------------------------------------------------------------- |
275 //----------------------------------------------------------------------------------------- |
256 //----------------------------------------------------------------------------------------- |
276 //----------------------------------------------------------------------------------------- |
257 //----------------------------------------------------------------------------------------- |
277 //----------------------------------------------------------------------------------------- |
258 |
278 |
259 |
279 |
260 typedef eap_expanded_type_c eap_type_value_e; |
280 #if defined(USE_EAP_EXPANDED_TYPES) |
261 |
281 |
262 |
282 typedef eap_expanded_type_c eap_type_value_e; |
263 EAP_C_FUNC_IMPORT u32_t convert_eap_type_to_u32_t(eap_type_value_e type); |
283 |
264 |
284 EAP_C_FUNC_IMPORT u32_t convert_eap_type_to_u32_t(eap_type_value_e type); |
265 EAP_C_FUNC_IMPORT u64_t convert_eap_type_to_u64_t(eap_type_value_e type); |
285 |
|
286 EAP_C_FUNC_IMPORT u64_t convert_eap_type_to_u64_t(eap_type_value_e type); |
|
287 |
|
288 #else |
|
289 |
|
290 EAP_C_FUNC_IMPORT u32_t convert_eap_type_to_u32_t(eap_type_value_e type); |
|
291 |
|
292 EAP_C_FUNC_IMPORT u64_t convert_eap_type_to_u64_t(eap_type_value_e type); |
|
293 |
|
294 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
266 |
295 |
267 |
296 |
268 //----------------------------------------------------------------------------------------- |
297 //----------------------------------------------------------------------------------------- |
269 //----------------------------------------------------------------------------------------- |
298 //----------------------------------------------------------------------------------------- |
270 //----------------------------------------------------------------------------------------- |
299 //----------------------------------------------------------------------------------------- |