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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 {NULL}}; | 178 {NULL}}; |
179 | 179 |
180 const FieldTranslationEntry ipconfig_fields[] = { | 180 const FieldTranslationEntry ipconfig_fields[] = { |
181 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, | 181 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, |
182 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, | 182 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, |
183 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, | 183 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, |
184 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, | 184 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, |
185 // This field is converted during translation, see ShillToONCTranslator:: | 185 // This field is converted during translation, see ShillToONCTranslator:: |
186 // TranslateIPConfig. It is only converted from Shill->ONC. | 186 // TranslateIPConfig. It is only converted from Shill->ONC. |
187 // { ::onc::ipconfig::kType, shill::kMethodProperty}, | 187 // { ::onc::ipconfig::kType, shill::kMethodProperty}, |
| 188 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl, |
| 189 shill::kWebProxyAutoDiscoveryUrlProperty}, |
| 190 {NULL}}; |
| 191 |
| 192 const FieldTranslationEntry saved_ipconfig_fields[] = { |
| 193 { ::onc::ipconfig::kIPAddress, shill::kSavedIPAddressProperty}, |
| 194 { ::onc::ipconfig::kGateway, shill::kSavedIPGatewayProperty}, |
| 195 { ::onc::ipconfig::kRoutingPrefix, shill::kSavedIPPrefixlenProperty}, |
| 196 // NameServers are converted during translation, see onc_translator_*. |
| 197 // { ::onc::ipconfig::kNameServers, shill::kSavedIPNameServersProperty}, |
| 198 {NULL}}; |
| 199 |
| 200 const FieldTranslationEntry static_ipconfig_fields[] = { |
| 201 { ::onc::ipconfig::kIPAddress, shill::kStaticIPAddressProperty}, |
| 202 { ::onc::ipconfig::kGateway, shill::kStaticIPGatewayProperty}, |
| 203 { ::onc::ipconfig::kRoutingPrefix, shill::kStaticIPPrefixlenProperty}, |
| 204 // NameServers are converted during translation, see onc_translator_*. |
| 205 // { ::onc::ipconfig::kNameServers, shill::kStaticIPNameServersProperty}, |
188 {NULL}}; | 206 {NULL}}; |
189 | 207 |
190 struct OncValueTranslationEntry { | 208 struct OncValueTranslationEntry { |
191 const OncValueSignature* onc_signature; | 209 const OncValueSignature* onc_signature; |
192 const FieldTranslationEntry* field_translation_table; | 210 const FieldTranslationEntry* field_translation_table; |
193 }; | 211 }; |
194 | 212 |
195 const OncValueTranslationEntry onc_value_translation_table[] = { | 213 const OncValueTranslationEntry onc_value_translation_table[] = { |
196 { &kEAPSignature, eap_fields }, | 214 { &kEAPSignature, eap_fields }, |
197 { &kIPsecSignature, ipsec_fields }, | 215 { &kIPsecSignature, ipsec_fields }, |
198 { &kL2TPSignature, l2tp_fields }, | 216 { &kL2TPSignature, l2tp_fields }, |
199 { &kXAUTHSignature, xauth_fields }, | 217 { &kXAUTHSignature, xauth_fields }, |
200 { &kOpenVPNSignature, openvpn_fields }, | 218 { &kOpenVPNSignature, openvpn_fields }, |
201 { &kVerifyX509Signature, verify_x509_fields }, | 219 { &kVerifyX509Signature, verify_x509_fields }, |
202 { &kVPNSignature, vpn_fields }, | 220 { &kVPNSignature, vpn_fields }, |
203 { &kWiFiSignature, wifi_fields }, | 221 { &kWiFiSignature, wifi_fields }, |
204 { &kWiFiWithStateSignature, wifi_fields }, | 222 { &kWiFiWithStateSignature, wifi_fields }, |
205 { &kCellularApnSignature, cellular_apn_fields }, | 223 { &kCellularApnSignature, cellular_apn_fields }, |
206 { &kCellularFoundNetworkSignature, cellular_found_network_fields }, | 224 { &kCellularFoundNetworkSignature, cellular_found_network_fields }, |
207 { &kCellularProviderSignature, cellular_provider_fields }, | 225 { &kCellularProviderSignature, cellular_provider_fields }, |
208 { &kSIMLockStatusSignature, sim_lock_status_fields }, | 226 { &kSIMLockStatusSignature, sim_lock_status_fields }, |
209 { &kCellularSignature, cellular_fields }, | 227 { &kCellularSignature, cellular_fields }, |
210 { &kCellularWithStateSignature, cellular_fields }, | 228 { &kCellularWithStateSignature, cellular_fields }, |
211 { &kNetworkWithStateSignature, network_fields }, | 229 { &kNetworkWithStateSignature, network_fields }, |
212 { &kNetworkConfigurationSignature, network_fields }, | 230 { &kNetworkConfigurationSignature, network_fields }, |
213 { &kIPConfigSignature, ipconfig_fields }, | 231 { &kIPConfigSignature, ipconfig_fields }, |
| 232 { &kSavedIPConfigSignature, saved_ipconfig_fields }, |
| 233 { &kStaticIPConfigSignature, static_ipconfig_fields }, |
214 { NULL } | 234 { NULL } |
215 }; | 235 }; |
216 | 236 |
217 struct NestedShillDictionaryEntry { | 237 struct NestedShillDictionaryEntry { |
218 const OncValueSignature* onc_signature; | 238 const OncValueSignature* onc_signature; |
219 // NULL terminated list of Shill property keys. | 239 // NULL terminated list of Shill property keys. |
220 const char* const* shill_property_path; | 240 const char* const* shill_property_path; |
221 }; | 241 }; |
222 | 242 |
223 const char* cellular_apn_property_path_entries[] = { | 243 const char* cellular_apn_property_path_entries[] = { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 continue; | 388 continue; |
369 *onc_value = table[i].onc_value; | 389 *onc_value = table[i].onc_value; |
370 return true; | 390 return true; |
371 } | 391 } |
372 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; | 392 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; |
373 return false; | 393 return false; |
374 } | 394 } |
375 | 395 |
376 } // namespace onc | 396 } // namespace onc |
377 } // namespace chromeos | 397 } // namespace chromeos |
OLD | NEW |