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