Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chromeos/network/onc/onc_translation_tables.cc

Issue 249193003: Add Shill to ONC translation of IPConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "third_party/cros_system_api/dbus/service_constants.h" 11 #include "third_party/cros_system_api/dbus/service_constants.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 namespace onc { 14 namespace onc {
15 15
16 // CertificatePattern is converted with function CreateUIData(...) to UIData 16 // CertificatePattern is converted with function CreateUIData(...) to UIData
17 // stored in Shill. 17 // stored in Shill.
18 // 18 //
19 // Proxy settings are converted to Shill by function 19 // Proxy settings are converted to Shill by function
20 // ConvertOncProxySettingsToProxyConfig(...). 20 // ConvertOncProxySettingsToProxyConfig(...).
21 //
22 // Translation of IPConfig objects is not supported, yet.
23 21
24 namespace { 22 namespace {
25 23
26 const FieldTranslationEntry eap_fields[] = { 24 const FieldTranslationEntry eap_fields[] = {
27 { ::onc::eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty}, 25 { ::onc::eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty},
28 { ::onc::eap::kIdentity, shill::kEapIdentityProperty}, 26 { ::onc::eap::kIdentity, shill::kEapIdentityProperty},
29 // This field is converted during translation, see onc_translator_*. 27 // This field is converted during translation, see onc_translator_*.
30 // { ::onc::eap::kInner, shill::kEapPhase2AuthProperty }, 28 // { ::onc::eap::kInner, shill::kEapPhase2AuthProperty },
31 29
32 // This field is converted during translation, see onc_translator_*. 30 // This field is converted during translation, see onc_translator_*.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 { ::onc::network_config::kGUID, shill::kGuidProperty}, 166 { ::onc::network_config::kGUID, shill::kGuidProperty},
169 // This field is converted during translation, see onc_translator_*. 167 // This field is converted during translation, see onc_translator_*.
170 // { ::onc::network_config::kType, shill::kTypeProperty }, 168 // { ::onc::network_config::kType, shill::kTypeProperty },
171 169
172 // This field is converted during translation, see 170 // This field is converted during translation, see
173 // onc_translator_shill_to_onc.cc. It is only converted when going from 171 // onc_translator_shill_to_onc.cc. It is only converted when going from
174 // Shill->ONC, and ignored otherwise. 172 // Shill->ONC, and ignored otherwise.
175 // { ::onc::network_config::kConnectionState, shill::kStateProperty }, 173 // { ::onc::network_config::kConnectionState, shill::kStateProperty },
176 {NULL}}; 174 {NULL}};
177 175
176 const FieldTranslationEntry ipconfig_fields[] = {
177 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty},
178 { ::onc::ipconfig::kGateway, shill::kGatewayProperty},
179 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty},
180 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty},
stevenjb 2014/04/23 19:43:42 We don't need to do this here, but it turns out we
pneubeck (no reviews) 2014/04/25 10:07:34 See changes in onc_translator_shill_to_onc.cc Just
181 {NULL}};
182
178 struct OncValueTranslationEntry { 183 struct OncValueTranslationEntry {
179 const OncValueSignature* onc_signature; 184 const OncValueSignature* onc_signature;
180 const FieldTranslationEntry* field_translation_table; 185 const FieldTranslationEntry* field_translation_table;
181 }; 186 };
182 187
183 const OncValueTranslationEntry onc_value_translation_table[] = { 188 const OncValueTranslationEntry onc_value_translation_table[] = {
184 { &kEAPSignature, eap_fields }, 189 { &kEAPSignature, eap_fields },
185 { &kIPsecSignature, ipsec_fields }, 190 { &kIPsecSignature, ipsec_fields },
186 { &kL2TPSignature, l2tp_fields }, 191 { &kL2TPSignature, l2tp_fields },
187 { &kXAUTHSignature, xauth_fields }, 192 { &kXAUTHSignature, xauth_fields },
188 { &kOpenVPNSignature, openvpn_fields }, 193 { &kOpenVPNSignature, openvpn_fields },
189 { &kVerifyX509Signature, verify_x509_fields }, 194 { &kVerifyX509Signature, verify_x509_fields },
190 { &kVPNSignature, vpn_fields }, 195 { &kVPNSignature, vpn_fields },
191 { &kWiFiSignature, wifi_fields }, 196 { &kWiFiSignature, wifi_fields },
192 { &kWiFiWithStateSignature, wifi_fields }, 197 { &kWiFiWithStateSignature, wifi_fields },
193 { &kCellularApnSignature, cellular_apn_fields }, 198 { &kCellularApnSignature, cellular_apn_fields },
194 { &kCellularProviderSignature, cellular_provider_fields }, 199 { &kCellularProviderSignature, cellular_provider_fields },
195 { &kCellularSignature, cellular_fields }, 200 { &kCellularSignature, cellular_fields },
196 { &kCellularWithStateSignature, cellular_fields }, 201 { &kCellularWithStateSignature, cellular_fields },
197 { &kNetworkWithStateSignature, network_fields }, 202 { &kNetworkWithStateSignature, network_fields },
198 { &kNetworkConfigurationSignature, network_fields }, 203 { &kNetworkConfigurationSignature, network_fields },
204 { &kIPConfigSignature, ipconfig_fields },
199 { NULL } 205 { NULL }
200 }; 206 };
201 207
202 struct NestedShillDictionaryEntry { 208 struct NestedShillDictionaryEntry {
203 const OncValueSignature* onc_signature; 209 const OncValueSignature* onc_signature;
204 // NULL terminated list of Shill property keys. 210 // NULL terminated list of Shill property keys.
205 const char* const* shill_property_path; 211 const char* const* shill_property_path;
206 }; 212 };
207 213
208 const char* cellular_apn_property_path_entries[] = { 214 const char* cellular_apn_property_path_entries[] = {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 continue; 325 continue;
320 *onc_value = table[i].onc_value; 326 *onc_value = table[i].onc_value;
321 return true; 327 return true;
322 } 328 }
323 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; 329 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC";
324 return false; 330 return false;
325 } 331 }
326 332
327 } // namespace onc 333 } // namespace onc
328 } // namespace chromeos 334 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698