OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/network/onc/onc_constants.h" | 12 #include "chromeos/network/onc/onc_constants.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 } | 16 } |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 namespace onc { | 19 namespace onc { |
20 | 20 |
| 21 // A valid but empty (no networks and no certificates) and unencrypted |
| 22 // configuration. |
| 23 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; |
| 24 |
21 // Parses |json| according to the JSON format. If |json| is a JSON formatted | 25 // Parses |json| according to the JSON format. If |json| is a JSON formatted |
22 // dictionary, the function returns the dictionary as a DictionaryValue. | 26 // dictionary, the function returns the dictionary as a DictionaryValue. |
23 // Otherwise returns NULL. | 27 // Otherwise returns NULL. |
24 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( | 28 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( |
25 const std::string& json); | 29 const std::string& json); |
26 | 30 |
27 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) | 31 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) |
28 // using |passphrase|. The resulting UnencryptedConfiguration is returned. If an | 32 // using |passphrase|. The resulting UnencryptedConfiguration is returned. If an |
29 // error occurs, returns NULL. | 33 // error occurs, returns NULL. |
30 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt( | 34 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt( |
31 const std::string& passphrase, | 35 const std::string& passphrase, |
32 const base::DictionaryValue& onc); | 36 const base::DictionaryValue& onc); |
33 | 37 |
34 // For logging only: strings not user facing. | 38 // For logging only: strings not user facing. |
35 CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source); | 39 CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source); |
36 | 40 |
37 } // chromeos | 41 } // chromeos |
38 } // onc | 42 } // onc |
39 | 43 |
40 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 44 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
OLD | NEW |