OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/network_configuration/wifi_security_class.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "third_party/cros_system_api/dbus/service_constants.h" | |
stevenjb
2014/10/27 20:25:15
#if defined(OS_CHROMEOS)
mukesh agrawal
2014/10/27 21:31:27
Done.
| |
9 | |
10 namespace network_configuration { | |
11 | |
stevenjb
2014/10/27 20:25:15
#if defined(OS_CHROMEOS)
mukesh agrawal
2014/10/27 21:31:27
Done.
| |
12 WifiSecurityClass WifiSecurityClassFromShillString( | |
13 const std::string& security_class_in) { | |
14 if (security_class_in == shill::kSecurityNone) { | |
15 return SECURITY_CLASS_NONE; | |
16 } else if (security_class_in == shill::kSecurityWep) { | |
17 return SECURITY_CLASS_WEP; | |
18 } else if (security_class_in == shill::kSecurityPsk) { | |
19 return SECURITY_CLASS_PSK; | |
20 } else if (security_class_in == shill::kSecurity8021x) { | |
21 return SECURITY_CLASS_802_1X; | |
22 } else { | |
23 return SECURITY_CLASS_INVALID; | |
24 } | |
25 } | |
26 | |
27 bool WifiSecurityClassToShillString( | |
28 WifiSecurityClass security_class_in, std::string* security_class_out) { | |
29 switch (security_class_in) { | |
30 case SECURITY_CLASS_NONE: | |
31 *security_class_out = shill::kSecurityNone; | |
32 return true; | |
33 case SECURITY_CLASS_WEP: | |
34 *security_class_out = shill::kSecurityWep; | |
35 return true; | |
36 case SECURITY_CLASS_PSK: | |
37 *security_class_out = shill::kSecurityPsk; | |
38 return true; | |
39 case SECURITY_CLASS_802_1X: | |
40 *security_class_out = shill::kSecurity8021x; | |
41 return true; | |
42 case SECURITY_CLASS_INVALID: | |
43 return false; | |
44 default: | |
45 CHECK(false) << "Invalid WifiSecurityClass enum with value " | |
46 << security_class_in; | |
47 return false; | |
48 } | |
49 } | |
50 | |
51 } // namespace network_configuration | |
OLD | NEW |