|
1 /* |
|
2 * Copyright (c) 2005-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: Statemachine for settings static WEP keys |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "core_sub_operation_set_static_wep.h" |
|
20 #include "core_server.h" |
|
21 #include "am_debug.h" |
|
22 |
|
23 // ======== MEMBER FUNCTIONS ======== |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 core_sub_operation_set_static_wep_c::core_sub_operation_set_static_wep_c( |
|
29 u32_t request_id, |
|
30 core_server_c* server, |
|
31 abs_core_driverif_c* drivers, |
|
32 abs_core_server_callback_c* adaptation ) : |
|
33 core_operation_base_c( core_operation_unspecified, request_id, server, drivers, adaptation, |
|
34 core_base_flag_drivers_needed ) |
|
35 { |
|
36 DEBUG( "core_sub_operation_set_static_wep_c::core_sub_operation_set_static_wep_c()" ); |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 core_sub_operation_set_static_wep_c::~core_sub_operation_set_static_wep_c() |
|
43 { |
|
44 DEBUG( "core_sub_operation_set_static_wep_c::~core_sub_operation_set_static_wep_c()" ); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 core_error_e core_sub_operation_set_static_wep_c::next_state() |
|
51 { |
|
52 DEBUG( "core_sub_operation_set_static_wep_c::next_state()" ); |
|
53 |
|
54 switch ( operation_state_m ) |
|
55 { |
|
56 case core_state_init: |
|
57 { |
|
58 operation_state_m = core_state_req_set_key1; |
|
59 |
|
60 if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_length ) |
|
61 { |
|
62 DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #1" ); |
|
63 |
|
64 drivers_m->add_cipher_key( |
|
65 core_cipher_key_type_wep, |
|
66 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_index, |
|
67 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_length, |
|
68 &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_data[0], |
|
69 BROADCAST_MAC_ADDR, |
|
70 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY1 ).key_index == |
|
71 server_m->get_connection_data()->iap_data().default_wep_key_index() ); |
|
72 } |
|
73 |
|
74 if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_length ) |
|
75 { |
|
76 DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #2" ); |
|
77 |
|
78 drivers_m->add_cipher_key( |
|
79 core_cipher_key_type_wep, |
|
80 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_index, |
|
81 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_length, |
|
82 &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_data[0], |
|
83 BROADCAST_MAC_ADDR, |
|
84 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY2 ).key_index == |
|
85 server_m->get_connection_data()->iap_data().default_wep_key_index() ); |
|
86 } |
|
87 |
|
88 if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_length ) |
|
89 { |
|
90 DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #3" ); |
|
91 |
|
92 drivers_m->add_cipher_key( |
|
93 core_cipher_key_type_wep, |
|
94 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_index, |
|
95 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_length, |
|
96 &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_data[0], |
|
97 BROADCAST_MAC_ADDR, |
|
98 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY3 ).key_index == |
|
99 server_m->get_connection_data()->iap_data().default_wep_key_index() ); |
|
100 } |
|
101 |
|
102 if ( server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_length ) |
|
103 { |
|
104 DEBUG( "core_sub_operation_set_static_wep_c::next_state() - setting WEP key #4" ); |
|
105 |
|
106 drivers_m->add_cipher_key( |
|
107 core_cipher_key_type_wep, |
|
108 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_index, |
|
109 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_length, |
|
110 &server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_data[0], |
|
111 BROADCAST_MAC_ADDR, |
|
112 server_m->get_connection_data()->iap_data().wep_key( WEP_KEY4 ).key_index == |
|
113 server_m->get_connection_data()->iap_data().default_wep_key_index() ); |
|
114 } |
|
115 |
|
116 DEBUG( "core_sub_operation_set_static_wep_c::next_state() - WEP keys set" ); |
|
117 |
|
118 return core_error_ok; |
|
119 } |
|
120 default: |
|
121 { |
|
122 ASSERT( false_t ); |
|
123 } |
|
124 } |
|
125 |
|
126 return core_error_request_pending; |
|
127 } |