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