Add abhijeet.k@samsung.com to AUTHORS list.
[chromium-blink-merge.git] / components / wifi_sync / wifi_security_class.h
blob1b2f1bd4f6e9782b0373f2557bcdd9c22d862a22
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.
5 #ifndef COMPONENTS_WIFI_SYNC_WIFI_SECURITY_CLASS_H_
6 #define COMPONENTS_WIFI_SYNC_WIFI_SECURITY_CLASS_H_
8 #include <string>
10 #include "sync/protocol/sync.pb.h"
12 namespace wifi_sync {
14 enum WifiSecurityClass {
15 SECURITY_CLASS_INVALID,
16 SECURITY_CLASS_NONE,
17 SECURITY_CLASS_WEP,
18 SECURITY_CLASS_PSK, // WPA-PSK or RSN-PSK
19 SECURITY_CLASS_802_1X, // WPA-Enterprise or RSN-Enterprise
22 // Returns true iff |security_class| allows passphrases. Note that a
23 // security class may permit passphrases, without requiring them.
24 bool WifiSecurityClassSupportsPassphrases(WifiSecurityClass security_class);
26 // Converts from Chrome Sync's serialized form of a security class, to
27 // a WifiSecurityClass. Returns the appropriate WifiSecurityClass
28 // value. If |sync_enum| is unrecognized, returns SECURITY_CLASS_INVALID.
29 WifiSecurityClass
30 WifiSecurityClassFromSyncSecurityClass(
31 sync_pb::WifiCredentialSpecifics_SecurityClass sync_enum);
33 // Converts from a WifiSecurityClass enum to Chrome Sync's serialized
34 // form of a security class. Returns the appropriate sync value. If
35 // |security_class| is unrecognized, or unsupported by Chrome Sync,
36 // returns sync's SECURITY_CLASS_INVALID.
37 sync_pb::WifiCredentialSpecifics_SecurityClass
38 WifiSecurityClassToSyncSecurityClass(WifiSecurityClass security_class);
40 // Converts from a WifiSecurityClass enum to an onc::wifi::kSecurity
41 // string value. The resulting string is written to
42 // |security_class_string|. Returns false if |security_class| is
43 // SECURITY_CLASS_INVALID, or unrecognized.
44 bool WifiSecurityClassToOncSecurityString(WifiSecurityClass security_class,
45 std::string* security_class_string);
47 #if defined(OS_CHROMEOS)
48 // Converts from a Security string presented by the ChromeOS
49 // connection manager ("Shill") to a WifiSecurityClass enum. Returns
50 // the appropriate enum value. If |shill_security| is unrecognized,
51 // returns SECURITY_CLASS_INVALID.
52 WifiSecurityClass WifiSecurityClassFromShillSecurity(
53 const std::string& shill_security);
54 #endif // OS_CHROMEOS
56 } // namespace wifi_sync
58 #endif // COMPONENTS_WIFI_SYNC_WIFI_SECURITY_CLASS_H_