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 kNetworkTechnologyTable
[];
37 CHROMEOS_EXPORT
extern const StringTranslationEntry kRoamingStateTable
[];
39 // A separate translation table for cellular properties that are stored in a
40 // Shill Device instead of a Service. The |shill_property_name| entries
41 // reference Device properties, not Service properties.
42 extern const FieldTranslationEntry kCellularDeviceTable
[];
44 const FieldTranslationEntry
* GetFieldTranslationTable(
45 const OncValueSignature
& onc_signature
);
47 // Returns the path at which the translation of an ONC object will be stored in
48 // a Shill dictionary if its signature is |onc_signature|.
49 // The default is that values are stored directly in the top level of the Shill
51 std::vector
<std::string
> GetPathToNestedShillDictionary(
52 const OncValueSignature
& onc_signature
);
54 bool GetShillPropertyName(const std::string
& onc_field_name
,
55 const FieldTranslationEntry table
[],
56 std::string
* shill_property_name
);
58 // Translate individual strings to Shill using the above tables.
59 CHROMEOS_EXPORT
bool TranslateStringToShill(
60 const StringTranslationEntry table
[],
61 const std::string
& onc_value
,
62 std::string
* shill_value
);
64 // Translate individual strings to ONC using the above tables.
65 CHROMEOS_EXPORT
bool TranslateStringToONC(const StringTranslationEntry table
[],
66 const std::string
& shill_value
,
67 std::string
* onc_value
);
70 } // namespace chromeos
72 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_