|
1 /* |
|
2 * Copyright (c) 2005-2009 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: Statemachine for connecting to a network |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CORE_SUB_OPERATION_CONNECT_H |
|
20 #define CORE_SUB_OPERATION_CONNECT_H |
|
21 |
|
22 #include "core_operation_base.h" |
|
23 #include "core_ap_data.h" |
|
24 #include "core_type_list.h" |
|
25 #include "abs_core_frame_handler.h" |
|
26 |
|
27 class core_server_c; |
|
28 class abs_core_driverif_c; |
|
29 class core_frame_dot11_ie_c; |
|
30 class core_frame_assoc_resp_c; |
|
31 |
|
32 const u64_t RRM_CAPABILITY_BIT_MASK = 0xfc0070; |
|
33 |
|
34 /** |
|
35 * Statemachine for connecting to a network |
|
36 * |
|
37 * @lib wlmserversrv.lib |
|
38 * @since S60 v3.1 |
|
39 */ |
|
40 NONSHARABLE_CLASS( core_sub_operation_connect_c ) : |
|
41 public core_operation_base_c, |
|
42 public abs_core_frame_handler_c |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 enum core_state_e |
|
48 { |
|
49 core_state_init = core_base_state_next, |
|
50 core_state_req_set_tx_level, |
|
51 core_state_req_set_tx_rate_policies, |
|
52 core_state_connect, |
|
53 core_state_connect_frame, |
|
54 core_state_connect_complete, |
|
55 core_state_MAX |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 core_sub_operation_connect_c( |
|
62 u32_t request_id, |
|
63 core_server_c* server, |
|
64 abs_core_driverif_c* drivers, |
|
65 abs_core_server_callback_c* adaptation, |
|
66 bool_t& is_connected, |
|
67 core_management_status_e& connect_status, |
|
68 const core_ssid_s& ssid, |
|
69 core_ap_data_c& ap_data, |
|
70 u16_t auth_algorithm, |
|
71 core_encryption_mode_e encryption_level, |
|
72 core_cipher_key_type_e pairwise_key_type, |
|
73 core_type_list_c<core_frame_dot11_ie_c>& assoc_ie_list, |
|
74 core_frame_assoc_resp_c** assoc_resp, |
|
75 bool_t is_pairwise_key_invalidated, |
|
76 bool_t is_group_key_invalidated ); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 virtual ~core_sub_operation_connect_c(); |
|
82 |
|
83 protected: |
|
84 |
|
85 /** |
|
86 * This method is called when a pending request has been completed |
|
87 * and so sub-operations are pending. |
|
88 * |
|
89 * @since S60 v3.1 |
|
90 * @return status of the operation: |
|
91 * core_error_request_pending if the operation is not finished, |
|
92 * otherwise the status code of the finished operation |
|
93 */ |
|
94 core_error_e next_state(); |
|
95 |
|
96 /** |
|
97 * This method is called when the operation is cancelled from the outside. |
|
98 * |
|
99 * @since S60 v3.2 |
|
100 * @param do_graceful_cancel Whether cancel should be graceful or forced. |
|
101 */ |
|
102 void user_cancel( |
|
103 bool_t do_graceful_cancel ); |
|
104 |
|
105 /** |
|
106 * This method is called when the operation needs to be canceled. |
|
107 * |
|
108 * @since S60 v3.1 |
|
109 * @return status of the operation: |
|
110 * core_error_request_pending if the operation is not finished, |
|
111 * otherwise the status code of the finished operation |
|
112 */ |
|
113 core_error_e cancel(); |
|
114 |
|
115 /** |
|
116 * From abs_core_frame_handler_c Called by the core server when a dot11 frame has been received. |
|
117 * |
|
118 * @since S60 v3.1 |
|
119 * @param frame Pointer to a dot11 frame parser. |
|
120 * @param rcpi RCPI value of the frame. |
|
121 * @return true_t if the frame was handled, false_t otherwise. |
|
122 */ |
|
123 bool_t receive_frame( |
|
124 const core_frame_dot11_c* frame, |
|
125 u8_t rcpi ); |
|
126 |
|
127 private: // data |
|
128 |
|
129 /** |
|
130 * Whether we are still connected to an AP. |
|
131 */ |
|
132 bool_t& is_connected_m; |
|
133 |
|
134 /** Status of connection attempt. */ |
|
135 core_management_status_e& connect_status_m; |
|
136 |
|
137 /** |
|
138 * SSID to connect to. |
|
139 */ |
|
140 const core_ssid_s& ssid_m; |
|
141 |
|
142 /** |
|
143 * AP to connect to. |
|
144 */ |
|
145 core_ap_data_c& ap_data_m; |
|
146 |
|
147 /** |
|
148 * Authentication algorithm number to use. |
|
149 */ |
|
150 u16_t auth_algorithm_m; |
|
151 |
|
152 /** |
|
153 * Encryption to use. |
|
154 */ |
|
155 core_encryption_mode_e encryption_m; |
|
156 |
|
157 /** |
|
158 * Pairwise cipher key type to be used. |
|
159 */ |
|
160 core_cipher_key_type_e pairwise_key_type_m; |
|
161 |
|
162 /** |
|
163 * The maximum allowed TX level. |
|
164 */ |
|
165 u32_t tx_level_m; |
|
166 |
|
167 /** The list of IEs that will be added to the association/resassociation request */ |
|
168 core_type_list_c<core_frame_dot11_ie_c>& assoc_ie_list_m; |
|
169 |
|
170 /** Buffer for storing all the IEs added to the association/reassociation request. */ |
|
171 u8_t* assoc_ie_data_m; |
|
172 |
|
173 /** |
|
174 * The (re-)association response frame is stored here if received. |
|
175 * Not owned by this pointer. |
|
176 */ |
|
177 core_frame_assoc_resp_c** assoc_resp_m; |
|
178 |
|
179 /** |
|
180 * Whether the pairwise key should be invalidated. |
|
181 */ |
|
182 bool_t is_pairwise_key_invalidated_m; |
|
183 |
|
184 /** |
|
185 * Whether the group key should be invalidated. |
|
186 */ |
|
187 bool_t is_group_key_invalidated_m; |
|
188 |
|
189 }; |
|
190 |
|
191 #endif // CORE_SUB_OPERATION_CONNECT_H |