|
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(_GSMSIM_RESULT_H_) |
|
22 #define _GSMSIM_RESULT_H_ |
|
23 |
|
24 #include "eap_variable_data.h" |
|
25 #include "eap_am_export.h" |
|
26 #include "eap_type_gsmsim_header.h" |
|
27 |
|
28 |
|
29 |
|
30 class EAP_EXPORT gsmsim_fixed_data_c |
|
31 { |
|
32 private: |
|
33 //-------------------------------------------------- |
|
34 |
|
35 bool m_is_valid; |
|
36 gsmsim_payload_AT_header_c m_original_header; |
|
37 u16_t m_type; |
|
38 u16_t m_data; |
|
39 |
|
40 //-------------------------------------------------- |
|
41 protected: |
|
42 //-------------------------------------------------- |
|
43 |
|
44 //-------------------------------------------------- |
|
45 public: |
|
46 //-------------------------------------------------- |
|
47 |
|
48 EAP_FUNC_IMPORT virtual ~gsmsim_fixed_data_c(); |
|
49 |
|
50 EAP_FUNC_IMPORT gsmsim_fixed_data_c( |
|
51 abs_eap_am_tools_c * const tools); |
|
52 |
|
53 EAP_FUNC_IMPORT bool get_is_valid() const; |
|
54 |
|
55 EAP_FUNC_IMPORT const gsmsim_payload_AT_header_c * get_original_header(); |
|
56 |
|
57 EAP_FUNC_IMPORT u16_t get_type(abs_eap_am_tools_c * const m_am_tools) const; |
|
58 |
|
59 EAP_FUNC_IMPORT u16_t get_data(abs_eap_am_tools_c * const m_am_tools) const; |
|
60 |
|
61 EAP_FUNC_IMPORT void set_data( |
|
62 const gsmsim_payload_AT_header_c * const original_header, |
|
63 const u16_t type, const u16_t data); |
|
64 |
|
65 //-------------------------------------------------- |
|
66 }; // class gsmsim_fixed_data_c |
|
67 |
|
68 |
|
69 class EAP_EXPORT gsmsim_variable_data_c |
|
70 { |
|
71 private: |
|
72 //-------------------------------------------------- |
|
73 |
|
74 abs_eap_am_tools_c * const m_am_tools; |
|
75 |
|
76 eap_variable_data_c m_data; |
|
77 |
|
78 gsmsim_payload_AT_header_c m_original_header; |
|
79 |
|
80 bool m_payload_included; |
|
81 |
|
82 //-------------------------------------------------- |
|
83 protected: |
|
84 //-------------------------------------------------- |
|
85 |
|
86 //-------------------------------------------------- |
|
87 public: |
|
88 //-------------------------------------------------- |
|
89 |
|
90 EAP_FUNC_IMPORT virtual ~gsmsim_variable_data_c(); |
|
91 |
|
92 EAP_FUNC_IMPORT gsmsim_variable_data_c(abs_eap_am_tools_c * const tools); |
|
93 |
|
94 EAP_FUNC_IMPORT const gsmsim_payload_AT_header_c * get_original_header() const; |
|
95 |
|
96 EAP_FUNC_IMPORT eap_status_e set_buffer( |
|
97 const gsmsim_payload_AT_header_c * const original_header, |
|
98 u8_t *buffer, |
|
99 const u32_t buffer_length, |
|
100 const bool free_buffer, |
|
101 const bool is_writable); |
|
102 |
|
103 EAP_FUNC_IMPORT bool get_payload_included() const; |
|
104 |
|
105 EAP_FUNC_IMPORT u32_t get_data_length() const; |
|
106 |
|
107 EAP_FUNC_IMPORT u8_t * get_data(const u32_t data_length) const; |
|
108 |
|
109 EAP_FUNC_IMPORT eap_variable_data_c * get_payload_buffer(); |
|
110 |
|
111 EAP_FUNC_IMPORT eap_status_e reset(); |
|
112 |
|
113 //-------------------------------------------------- |
|
114 }; // class gsmsim_variable_data_c |
|
115 |
|
116 |
|
117 //-------------------------------------------------- |
|
118 |
|
119 |
|
120 // |
|
121 class EAP_EXPORT gsmsim_payloads_c |
|
122 { |
|
123 private: |
|
124 //-------------------------------------------------- |
|
125 |
|
126 abs_eap_am_tools_c * const m_am_tools; |
|
127 |
|
128 gsmsim_variable_data_c m_nonce_mt; |
|
129 |
|
130 gsmsim_variable_data_c m_nonce_s; |
|
131 |
|
132 gsmsim_variable_data_c m_MAC; |
|
133 |
|
134 gsmsim_variable_data_c m_ENCR_DATA; |
|
135 |
|
136 gsmsim_variable_data_c m_IDENTITY_payload; |
|
137 |
|
138 gsmsim_variable_data_c m_padding_payload; |
|
139 |
|
140 gsmsim_variable_data_c m_n_RANDs; |
|
141 |
|
142 gsmsim_variable_data_c m_PERMANENT_ID_REQ; |
|
143 |
|
144 gsmsim_variable_data_c m_FULLAUTH_ID_REQ; |
|
145 |
|
146 gsmsim_variable_data_c m_ANY_ID_REQ; |
|
147 |
|
148 gsmsim_variable_data_c m_IV; |
|
149 |
|
150 gsmsim_variable_data_c m_NEXT_PSEUDONYM; |
|
151 |
|
152 gsmsim_variable_data_c m_NEXT_REAUTH_ID; |
|
153 |
|
154 gsmsim_variable_data_c m_NOTIFICATION; |
|
155 |
|
156 gsmsim_variable_data_c m_VERSION_LIST; |
|
157 |
|
158 gsmsim_variable_data_c m_SELECTED_VERSION; |
|
159 |
|
160 gsmsim_variable_data_c m_COUNTER; |
|
161 |
|
162 gsmsim_variable_data_c m_COUNTER_TOO_SMALL; |
|
163 |
|
164 gsmsim_variable_data_c m_CLIENT_ERROR_CODE; |
|
165 |
|
166 gsmsim_variable_data_c m_RESULT_IND; |
|
167 |
|
168 gsmsim_payload_AT_type_e m_unknown_payload; |
|
169 |
|
170 bool m_includes_other_version_than_1; |
|
171 |
|
172 bool m_is_valid; |
|
173 |
|
174 //-------------------------------------------------- |
|
175 protected: |
|
176 //-------------------------------------------------- |
|
177 |
|
178 //-------------------------------------------------- |
|
179 public: |
|
180 //-------------------------------------------------- |
|
181 |
|
182 |
|
183 enum eap_gsmsim_payload_status_e |
|
184 { |
|
185 eap_gsmsim_payload_status_optional, |
|
186 eap_gsmsim_payload_status_must_be, |
|
187 eap_gsmsim_payload_status_must_not_be |
|
188 }; |
|
189 |
|
190 |
|
191 EAP_FUNC_IMPORT virtual ~gsmsim_payloads_c(); |
|
192 |
|
193 EAP_FUNC_IMPORT gsmsim_payloads_c( |
|
194 abs_eap_am_tools_c * const tools); |
|
195 |
|
196 EAP_FUNC_IMPORT bool check_one_payload( |
|
197 const eap_gsmsim_payload_status_e status, |
|
198 const gsmsim_variable_data_c * const payload); |
|
199 |
|
200 /** This function checks the correct set of payloads are included in the message. |
|
201 * NOTE do not change the order of parameters. |
|
202 * Add new payload type to the last of the parameter list. |
|
203 */ |
|
204 EAP_FUNC_IMPORT bool check_payloads( |
|
205 const eap_gsmsim_payload_status_e nonce_mt, |
|
206 const eap_gsmsim_payload_status_e nonce_s, |
|
207 const eap_gsmsim_payload_status_e MAC, |
|
208 const eap_gsmsim_payload_status_e ENCR_DATA, |
|
209 const eap_gsmsim_payload_status_e IDENTITY, |
|
210 const eap_gsmsim_payload_status_e padding, |
|
211 const eap_gsmsim_payload_status_e n_RANDs, |
|
212 const eap_gsmsim_payload_status_e PERMANENT_ID_REQ, |
|
213 const eap_gsmsim_payload_status_e FULLAUTH_ID_REQ, |
|
214 const eap_gsmsim_payload_status_e ANY_ID_REQ, |
|
215 const eap_gsmsim_payload_status_e IV, |
|
216 const eap_gsmsim_payload_status_e NEXT_PSEUDONYM, |
|
217 const eap_gsmsim_payload_status_e NEXT_REAUTH_ID, |
|
218 const eap_gsmsim_payload_status_e NOTIFICATION, |
|
219 const eap_gsmsim_payload_status_e VERSION_LIST, |
|
220 const eap_gsmsim_payload_status_e SELECTED_VERSION, |
|
221 const eap_gsmsim_payload_status_e COUNTER, |
|
222 const eap_gsmsim_payload_status_e COUNTER_TOO_SMALL, |
|
223 const eap_gsmsim_payload_status_e CLIENT_ERROR_CODE, |
|
224 const eap_gsmsim_payload_status_e RESULT_IND |
|
225 ); |
|
226 |
|
227 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_NONCE_MT(); |
|
228 |
|
229 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_NONCE_S(); |
|
230 |
|
231 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_MAC(); |
|
232 |
|
233 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_ENCR_DATA(); |
|
234 |
|
235 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_IDENTITY_payload(); |
|
236 |
|
237 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_padding_payload(); |
|
238 |
|
239 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_n_RANDs(); |
|
240 |
|
241 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_PERMANENT_ID_REQ(); |
|
242 |
|
243 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_FULLAUTH_ID_REQ(); |
|
244 |
|
245 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_ANY_ID_REQ(); |
|
246 |
|
247 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_IV(); |
|
248 |
|
249 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_NEXT_PSEUDONYM(); |
|
250 |
|
251 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_NEXT_REAUTH_ID(); |
|
252 |
|
253 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_NOTIFICATION(); |
|
254 |
|
255 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_RESULT_IND(); |
|
256 |
|
257 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_VERSION_LIST(); |
|
258 |
|
259 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_SELECTED_VERSION(); |
|
260 |
|
261 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_CLIENT_ERROR_CODE(); |
|
262 |
|
263 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_COUNTER(); |
|
264 |
|
265 EAP_FUNC_IMPORT gsmsim_variable_data_c * get_COUNTER_TOO_SMALL(); |
|
266 |
|
267 |
|
268 EAP_FUNC_IMPORT void set_includes_unknown_attribute(const gsmsim_payload_AT_type_e unknown_payload); |
|
269 |
|
270 EAP_FUNC_IMPORT gsmsim_payload_AT_type_e get_includes_unknown_attribute(); |
|
271 |
|
272 |
|
273 EAP_FUNC_IMPORT void set_includes_other_version_than_1(const bool includes_other_version_than_1); |
|
274 |
|
275 EAP_FUNC_IMPORT bool get_includes_other_version_than_1(); |
|
276 |
|
277 |
|
278 EAP_FUNC_IMPORT bool get_is_valid() const; |
|
279 |
|
280 //-------------------------------------------------- |
|
281 }; // class gsmsim_payloads_c |
|
282 |
|
283 |
|
284 #endif //#if !defined(_GSMSIM_RESULT_H_) |
|
285 |
|
286 //-------------------------------------------------- |
|
287 |
|
288 |
|
289 |
|
290 // End. |