| 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 #include "chromeos/network/onc/onc_translation_tables.h" | 5 #include "chromeos/network/onc/onc_translation_tables.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/onc/onc_constants.h" | 10 #include "components/onc/onc_constants.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, | 200 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, |
| 201 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, | 201 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, |
| 202 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, | 202 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, |
| 203 // This field is converted during translation, see ShillToONCTranslator:: | 203 // This field is converted during translation, see ShillToONCTranslator:: |
| 204 // TranslateIPConfig. It is only converted from Shill->ONC. | 204 // TranslateIPConfig. It is only converted from Shill->ONC. |
| 205 // { ::onc::ipconfig::kType, shill::kMethodProperty}, | 205 // { ::onc::ipconfig::kType, shill::kMethodProperty}, |
| 206 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl, | 206 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl, |
| 207 shill::kWebProxyAutoDiscoveryUrlProperty}, | 207 shill::kWebProxyAutoDiscoveryUrlProperty}, |
| 208 {NULL}}; | 208 {NULL}}; |
| 209 | 209 |
| 210 const FieldTranslationEntry saved_ipconfig_fields[] = { | 210 const FieldTranslationEntry static_or_saved_ipconfig_fields[] = { |
| 211 { ::onc::ipconfig::kIPAddress, shill::kSavedIPAddressProperty}, | 211 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, |
| 212 { ::onc::ipconfig::kGateway, shill::kSavedIPGatewayProperty}, | 212 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, |
| 213 { ::onc::ipconfig::kRoutingPrefix, shill::kSavedIPPrefixlenProperty}, | 213 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, |
| 214 // NameServers are converted during translation, see onc_translator_*. | 214 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, |
| 215 // { ::onc::ipconfig::kNameServers, shill::kSavedIPNameServersProperty}, | |
| 216 {NULL}}; | |
| 217 | |
| 218 const FieldTranslationEntry static_ipconfig_fields[] = { | |
| 219 { ::onc::ipconfig::kIPAddress, shill::kStaticIPAddressProperty}, | |
| 220 { ::onc::ipconfig::kGateway, shill::kStaticIPGatewayProperty}, | |
| 221 { ::onc::ipconfig::kRoutingPrefix, shill::kStaticIPPrefixlenProperty}, | |
| 222 // NameServers are converted during translation, see onc_translator_*. | |
| 223 // { ::onc::ipconfig::kNameServers, shill::kStaticIPNameServersProperty}, | |
| 224 {NULL}}; | 215 {NULL}}; |
| 225 | 216 |
| 226 struct OncValueTranslationEntry { | 217 struct OncValueTranslationEntry { |
| 227 const OncValueSignature* onc_signature; | 218 const OncValueSignature* onc_signature; |
| 228 const FieldTranslationEntry* field_translation_table; | 219 const FieldTranslationEntry* field_translation_table; |
| 229 }; | 220 }; |
| 230 | 221 |
| 231 const OncValueTranslationEntry onc_value_translation_table[] = { | 222 const OncValueTranslationEntry onc_value_translation_table[] = { |
| 232 { &kEAPSignature, eap_fields }, | 223 { &kEAPSignature, eap_fields }, |
| 233 { &kIPsecSignature, ipsec_fields }, | 224 { &kIPsecSignature, ipsec_fields }, |
| 234 { &kL2TPSignature, l2tp_fields }, | 225 { &kL2TPSignature, l2tp_fields }, |
| 235 { &kXAUTHSignature, xauth_fields }, | 226 { &kXAUTHSignature, xauth_fields }, |
| 236 { &kOpenVPNSignature, openvpn_fields }, | 227 { &kOpenVPNSignature, openvpn_fields }, |
| 237 { &kVerifyX509Signature, verify_x509_fields }, | 228 { &kVerifyX509Signature, verify_x509_fields }, |
| 238 { &kVPNSignature, vpn_fields }, | 229 { &kVPNSignature, vpn_fields }, |
| 239 { &kWiFiSignature, wifi_fields }, | 230 { &kWiFiSignature, wifi_fields }, |
| 240 { &kWiFiWithStateSignature, wifi_fields }, | 231 { &kWiFiWithStateSignature, wifi_fields }, |
| 241 { &kWiMAXSignature, wimax_fields }, | 232 { &kWiMAXSignature, wimax_fields }, |
| 242 { &kWiMAXWithStateSignature, wimax_fields }, | 233 { &kWiMAXWithStateSignature, wimax_fields }, |
| 243 { &kCellularApnSignature, cellular_apn_fields }, | 234 { &kCellularApnSignature, cellular_apn_fields }, |
| 244 { &kCellularFoundNetworkSignature, cellular_found_network_fields }, | 235 { &kCellularFoundNetworkSignature, cellular_found_network_fields }, |
| 245 { &kCellularProviderSignature, cellular_provider_fields }, | 236 { &kCellularProviderSignature, cellular_provider_fields }, |
| 246 { &kSIMLockStatusSignature, sim_lock_status_fields }, | 237 { &kSIMLockStatusSignature, sim_lock_status_fields }, |
| 247 { &kCellularSignature, cellular_fields }, | 238 { &kCellularSignature, cellular_fields }, |
| 248 { &kCellularWithStateSignature, cellular_fields }, | 239 { &kCellularWithStateSignature, cellular_fields }, |
| 249 { &kNetworkWithStateSignature, network_fields }, | 240 { &kNetworkWithStateSignature, network_fields }, |
| 250 { &kNetworkConfigurationSignature, network_fields }, | 241 { &kNetworkConfigurationSignature, network_fields }, |
| 251 { &kIPConfigSignature, ipconfig_fields }, | 242 { &kIPConfigSignature, ipconfig_fields }, |
| 252 { &kSavedIPConfigSignature, saved_ipconfig_fields }, | 243 { &kSavedIPConfigSignature, static_or_saved_ipconfig_fields }, |
| 253 { &kStaticIPConfigSignature, static_ipconfig_fields }, | 244 { &kStaticIPConfigSignature, static_or_saved_ipconfig_fields }, |
| 254 { NULL } | 245 { NULL } |
| 255 }; | 246 }; |
| 256 | 247 |
| 257 struct NestedShillDictionaryEntry { | 248 struct NestedShillDictionaryEntry { |
| 258 const OncValueSignature* onc_signature; | 249 const OncValueSignature* onc_signature; |
| 259 // NULL terminated list of Shill property keys. | 250 // NULL terminated list of Shill property keys. |
| 260 const char* const* shill_property_path; | 251 const char* const* shill_property_path; |
| 261 }; | 252 }; |
| 262 | 253 |
| 263 const char* cellular_apn_property_path_entries[] = { | 254 const char* cellular_apn_path_entries[] = { |
| 264 shill::kCellularApnProperty, | 255 shill::kCellularApnProperty, |
| 265 NULL | 256 NULL |
| 266 }; | 257 }; |
| 267 | 258 |
| 259 const char* static_ip_config_path_entries[] = { |
| 260 shill::kStaticIPConfigProperty, |
| 261 NULL |
| 262 }; |
| 263 |
| 268 const NestedShillDictionaryEntry nested_shill_dictionaries[] = { | 264 const NestedShillDictionaryEntry nested_shill_dictionaries[] = { |
| 269 { &kCellularApnSignature, cellular_apn_property_path_entries }, | 265 { &kCellularApnSignature, cellular_apn_path_entries }, |
| 266 { &kStaticIPConfigSignature, static_ip_config_path_entries }, |
| 270 { NULL } | 267 { NULL } |
| 271 }; | 268 }; |
| 272 | 269 |
| 273 } // namespace | 270 } // namespace |
| 274 | 271 |
| 275 const StringTranslationEntry kNetworkTypeTable[] = { | 272 const StringTranslationEntry kNetworkTypeTable[] = { |
| 276 // This mapping is ensured in the translation code. | 273 // This mapping is ensured in the translation code. |
| 277 // { network_type::kEthernet, shill::kTypeEthernet }, | 274 // { network_type::kEthernet, shill::kTypeEthernet }, |
| 278 // { network_type::kEthernet, shill::kTypeEthernetEap }, | 275 // { network_type::kEthernet, shill::kTypeEthernetEap }, |
| 279 { ::onc::network_type::kWiFi, shill::kTypeWifi}, | 276 { ::onc::network_type::kWiFi, shill::kTypeWifi}, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 continue; | 417 continue; |
| 421 *onc_value = table[i].onc_value; | 418 *onc_value = table[i].onc_value; |
| 422 return true; | 419 return true; |
| 423 } | 420 } |
| 424 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; | 421 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; |
| 425 return false; | 422 return false; |
| 426 } | 423 } |
| 427 | 424 |
| 428 } // namespace onc | 425 } // namespace onc |
| 429 } // namespace chromeos | 426 } // namespace chromeos |
| OLD | NEW |