Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chromeos / network / onc / onc_translation_tables.h
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.
4
5 #ifndef CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/network/onc/onc_signature.h"
13
14 namespace chromeos {
15 namespace onc {
16
17 struct FieldTranslationEntry {
18   const char* onc_field_name;
19   const char* shill_property_name;
20 };
21
22 struct StringTranslationEntry {
23   const char* onc_value;
24   const char* shill_value;
25 };
26
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[];
37
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[];
42
43 const FieldTranslationEntry* GetFieldTranslationTable(
44     const OncValueSignature& onc_signature);
45
46 std::vector<std::string> GetPathToNestedShillDictionary(
47     const OncValueSignature& onc_signature);
48
49 bool GetShillPropertyName(const std::string& onc_field_name,
50                           const FieldTranslationEntry table[],
51                           std::string* shill_property_name);
52
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);
58
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);
63
64 }  // namespace onc
65 }  // namespace chromeos
66
67 #endif  // CHROMEOS_NETWORK_ONC_ONC_TRANSLATION_TABLES_H_