|
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(_EAP_STATE_SELECTOR_H_) |
|
22 #define _EAP_STATE_SELECTOR_H_ |
|
23 |
|
24 #error Do not use. |
|
25 |
|
26 #include "eap_am_memory.h" |
|
27 #include "eap_tools.h" |
|
28 #include "eap_am_export.h" |
|
29 #include "eap_variable_data.h" |
|
30 #include "sae_cookie.h" |
|
31 |
|
32 |
|
33 //-------------------------------------------------- |
|
34 |
|
35 class EAP_EXPORT eap_state_selector_c |
|
36 : public eap_variable_data_c |
|
37 { |
|
38 private: |
|
39 |
|
40 abs_eap_am_tools_c * const m_am_tools; |
|
41 |
|
42 public: |
|
43 |
|
44 virtual ~eap_state_selector_c() |
|
45 { |
|
46 } |
|
47 |
|
48 eap_state_selector_c( |
|
49 abs_eap_am_tools_c * const tools) |
|
50 : eap_variable_data_c(tools) |
|
51 , m_am_tools(tools) |
|
52 { |
|
53 } |
|
54 |
|
55 |
|
56 eap_state_selector_c( |
|
57 abs_eap_am_tools_c * const tools, |
|
58 sae_cookie_c * const own_cookie, |
|
59 sae_cookie_c * const peer_cookie) |
|
60 : eap_variable_data_c(tools) |
|
61 , m_am_tools(tools) |
|
62 { |
|
63 eap_status_e status = set_copy_of_buffer(own_cookie->get_data(), SAE_COOKIE_LENGTH); |
|
64 if (status != eap_status_ok) |
|
65 { |
|
66 return; |
|
67 } |
|
68 status = add_data(peer_cookie->get_data(), SAE_COOKIE_LENGTH); |
|
69 if (status != eap_status_ok) |
|
70 { |
|
71 return; |
|
72 } |
|
73 } |
|
74 |
|
75 eap_status_e set_selector( |
|
76 sae_cookie_c * const own_cookie, |
|
77 sae_cookie_c * const peer_cookie) |
|
78 { |
|
79 eap_status_e status = eap_status_process_general_error; |
|
80 |
|
81 status = set_copy_of_buffer(own_cookie->get_data(), SAE_COOKIE_LENGTH); |
|
82 if (status != eap_status_ok) |
|
83 { |
|
84 return status; |
|
85 } |
|
86 |
|
87 status = add_data(peer_cookie->get_data(), SAE_COOKIE_LENGTH); |
|
88 if (status != eap_status_ok) |
|
89 { |
|
90 return status; |
|
91 } |
|
92 |
|
93 return status; |
|
94 } |
|
95 |
|
96 eap_state_selector_c( |
|
97 abs_eap_am_tools_c * const tools, |
|
98 const eap_state_selector_c * const selector) |
|
99 : eap_variable_data_c(tools) |
|
100 , m_am_tools(tools) |
|
101 { |
|
102 eap_status_e status = set_copy_of_buffer( |
|
103 selector->get_data(selector->get_data_length()), |
|
104 selector->get_data_length()); |
|
105 if (status != eap_status_ok) |
|
106 { |
|
107 return; |
|
108 } |
|
109 } |
|
110 |
|
111 |
|
112 // |
|
113 eap_state_selector_c * const copy() const |
|
114 { |
|
115 eap_state_selector_c * const new_selector |
|
116 = new eap_state_selector_c(m_am_tools, this); |
|
117 |
|
118 return new_selector; |
|
119 } |
|
120 |
|
121 }; |
|
122 |
|
123 #endif //#if !defined(_EAP_STATE_SELECTOR_H_) |
|
124 |
|
125 //-------------------------------------------------- |
|
126 |
|
127 |
|
128 |
|
129 // End. |