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_TRANSLATION_TABLES_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "chromeos/chromeos_export.h" |
11 #include "chromeos/network/onc/onc_signature.h" | 12 #include "chromeos/network/onc/onc_signature.h" |
12 | 13 |
13 namespace chromeos { | 14 namespace chromeos { |
14 namespace onc { | 15 namespace onc { |
15 | 16 |
16 struct FieldTranslationEntry { | 17 struct FieldTranslationEntry { |
17 const char* onc_field_name; | 18 const char* onc_field_name; |
18 const char* shill_property_name; | 19 const char* shill_property_name; |
19 }; | 20 }; |
20 | 21 |
21 struct StringTranslationEntry { | 22 struct StringTranslationEntry { |
22 const char* onc_value; | 23 const char* onc_value; |
23 const char* shill_value; | 24 const char* shill_value; |
24 }; | 25 }; |
25 | 26 |
26 // These tables contain the mapping from ONC strings to Shill strings. | 27 // These tables contain the mapping from ONC strings to Shill strings. |
27 // These are NULL-terminated arrays. | 28 // These are NULL-terminated arrays. |
28 extern const StringTranslationEntry kNetworkTypeTable[]; | 29 CHROMEOS_EXPORT extern const StringTranslationEntry kNetworkTypeTable[]; |
29 extern const StringTranslationEntry kVPNTypeTable[]; | 30 CHROMEOS_EXPORT extern const StringTranslationEntry kVPNTypeTable[]; |
30 extern const StringTranslationEntry kWiFiSecurityTable[]; | 31 CHROMEOS_EXPORT extern const StringTranslationEntry kWiFiSecurityTable[]; |
31 extern const StringTranslationEntry kEAPOuterTable[]; | 32 CHROMEOS_EXPORT extern const StringTranslationEntry kEAPOuterTable[]; |
32 extern const StringTranslationEntry kEAP_PEAP_InnerTable[]; | 33 CHROMEOS_EXPORT extern const StringTranslationEntry kEAP_PEAP_InnerTable[]; |
33 extern const StringTranslationEntry kEAP_TTLS_InnerTable[]; | 34 CHROMEOS_EXPORT extern const StringTranslationEntry kEAP_TTLS_InnerTable[]; |
34 | 35 |
35 // A separate translation table for cellular properties that are stored in a | 36 // A separate translation table for cellular properties that are stored in a |
36 // Shill Device instead of a Service. The |shill_property_name| entries | 37 // Shill Device instead of a Service. The |shill_property_name| entries |
37 // reference Device properties, not Service properties. | 38 // reference Device properties, not Service properties. |
38 extern const FieldTranslationEntry kCellularDeviceTable[]; | 39 extern const FieldTranslationEntry kCellularDeviceTable[]; |
39 | 40 |
40 const FieldTranslationEntry* GetFieldTranslationTable( | 41 const FieldTranslationEntry* GetFieldTranslationTable( |
41 const OncValueSignature& onc_signature); | 42 const OncValueSignature& onc_signature); |
42 | 43 |
43 std::vector<std::string> GetPathToNestedShillDictionary( | 44 std::vector<std::string> GetPathToNestedShillDictionary( |
44 const OncValueSignature& onc_signature); | 45 const OncValueSignature& onc_signature); |
45 | 46 |
46 bool GetShillPropertyName(const std::string& onc_field_name, | 47 bool GetShillPropertyName(const std::string& onc_field_name, |
47 const FieldTranslationEntry table[], | 48 const FieldTranslationEntry table[], |
48 std::string* shill_property_name); | 49 std::string* shill_property_name); |
49 | 50 |
50 // Translate individual strings to Shill using the above tables. | 51 // Translate individual strings to Shill using the above tables. |
51 bool TranslateStringToShill(const StringTranslationEntry table[], | 52 CHROMEOS_EXPORT bool TranslateStringToShill( |
52 const std::string& onc_value, | 53 const StringTranslationEntry table[], |
53 std::string* shill_value); | 54 const std::string& onc_value, |
| 55 std::string* shill_value); |
54 | 56 |
55 // Translate individual strings to ONC using the above tables. | 57 // Translate individual strings to ONC using the above tables. |
56 bool TranslateStringToONC(const StringTranslationEntry table[], | 58 CHROMEOS_EXPORT bool TranslateStringToONC(const StringTranslationEntry table[], |
57 const std::string& shill_value, | 59 const std::string& shill_value, |
58 std::string* onc_value); | 60 std::string* onc_value); |
59 | 61 |
60 } // namespace onc | 62 } // namespace onc |
61 } // namespace chromeos | 63 } // namespace chromeos |
62 | 64 |
63 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_ | 65 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_ |
OLD | NEW |