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