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_
10 #include "chromeos/network/onc/onc_signature.h"
15 struct FieldTranslationEntry
{
16 const char* onc_field_name
;
17 const char* shill_property_name
;
20 struct OncValueTranslationEntry
{
21 const OncValueSignature
* onc_signature
;
22 const FieldTranslationEntry
* field_translation_table
;
25 struct StringTranslationEntry
{
26 const char* onc_value
;
27 const char* shill_value
;
30 // These tables contain the mapping from ONC strings to Shill strings.
31 // These are NULL-terminated arrays.
32 extern const StringTranslationEntry kNetworkTypeTable
[];
33 extern const StringTranslationEntry kVPNTypeTable
[];
34 extern const StringTranslationEntry kWiFiSecurityTable
[];
35 extern const StringTranslationEntry kEAPOuterTable
[];
36 extern const StringTranslationEntry kEAP_PEAP_InnerTable
[];
37 extern const StringTranslationEntry kEAP_TTLS_InnerTable
[];
39 const FieldTranslationEntry
* GetFieldTranslationTable(
40 const OncValueSignature
& onc_signature
);
42 bool GetShillPropertyName(const std::string
& onc_field_name
,
43 const FieldTranslationEntry table
[],
44 std::string
* shill_property_name
);
46 // Translate individual strings to Shill using the above tables.
47 bool TranslateStringToShill(const StringTranslationEntry table
[],
48 const std::string
& onc_value
,
49 std::string
* shill_value
);
51 // Translate individual strings to ONC using the above tables.
52 bool TranslateStringToONC(const StringTranslationEntry table
[],
53 const std::string
& shill_value
,
54 std::string
* onc_value
);
57 } // namespace chromeos
59 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_