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

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

Issue 535283002: Translate activation/romaing state, restricted pool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_7b
Patch Set: Only set RestrictedConnectivity if true, fix tests Created 6 years, 3 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
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"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const FieldTranslationEntry sim_lock_status_fields[] = { 145 const FieldTranslationEntry sim_lock_status_fields[] = {
146 { ::onc::sim_lock_status::kLockEnabled, shill::kSIMLockEnabledProperty}, 146 { ::onc::sim_lock_status::kLockEnabled, shill::kSIMLockEnabledProperty},
147 { ::onc::sim_lock_status::kLockType, shill::kSIMLockTypeProperty}, 147 { ::onc::sim_lock_status::kLockType, shill::kSIMLockTypeProperty},
148 { ::onc::sim_lock_status::kRetriesLeft, shill::kSIMLockRetriesLeftProperty}, 148 { ::onc::sim_lock_status::kRetriesLeft, shill::kSIMLockRetriesLeftProperty},
149 {NULL}}; 149 {NULL}};
150 150
151 // This must only contain Service properties and not Device properties. 151 // This must only contain Service properties and not Device properties.
152 // For Device properties see kCellularDeviceTable. 152 // For Device properties see kCellularDeviceTable.
153 const FieldTranslationEntry cellular_fields[] = { 153 const FieldTranslationEntry cellular_fields[] = {
154 { ::onc::cellular::kActivationType, shill::kActivationTypeProperty}, 154 { ::onc::cellular::kActivationType, shill::kActivationTypeProperty},
155 { ::onc::cellular::kActivationState, shill::kActivationStateProperty}, 155 // This field is converted during translation, see onc_translator_*.
156 // { ::onc::cellular::kActivationState, shill::kActivationStateProperty},
156 { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty}, 157 { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty},
157 { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, 158 // This field is converted during translation, see onc_translator_*.
159 // { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty},
158 {NULL}}; 160 {NULL}};
159 161
160 const FieldTranslationEntry network_fields[] = { 162 const FieldTranslationEntry network_fields[] = {
161 { ::onc::network_config::kGUID, shill::kGuidProperty}, 163 { ::onc::network_config::kGUID, shill::kGuidProperty},
162 { ::onc::network_config::kConnectable, shill::kConnectableProperty }, 164 { ::onc::network_config::kConnectable, shill::kConnectableProperty },
163 { ::onc::network_config::kErrorState, shill::kErrorProperty }, 165 { ::onc::network_config::kErrorState, shill::kErrorProperty },
164 { ::onc::network_config::kPriority, shill::kPriorityProperty }, 166 { ::onc::network_config::kPriority, shill::kPriorityProperty },
165 167
166 // Shill doesn't allow setting the name for non-VPN networks. 168 // Shill doesn't allow setting the name for non-VPN networks.
167 // Name is conditionally translated, see onc_translator_*. 169 // Name is conditionally translated, see onc_translator_*.
168 // { ::onc::network_config::kName, shill::kNameProperty }, 170 // { ::onc::network_config::kName, shill::kNameProperty },
169 171
170 // Type is converted during translation, see onc_translator_*. 172 // Type is converted during translation, see onc_translator_*.
171 // { ::onc::network_config::kType, shill::kTypeProperty }, 173 // { ::onc::network_config::kType, shill::kTypeProperty },
172 174
173 // These fields are converted during translation, see 175 // These fields are converted during translation, see
174 // onc_translator_shill_to_onc.cc. They are only converted when going from 176 // onc_translator_shill_to_onc.cc. They are only converted when going from
175 // Shill->ONC, and ignored otherwise. 177 // Shill->ONC, and ignored otherwise.
176 // { ::onc::network_config::kConnectionState, shill::kStateProperty }, 178 // { ::onc::network_config::kConnectionState, shill::kStateProperty },
179 // { ::onc::network_config::kRestrictedConnectivity,
180 // shill::kStateProperty },
177 // { ::onc::network_config::kMacAddress, shill::kAddressProperty }, 181 // { ::onc::network_config::kMacAddress, shill::kAddressProperty },
178 {NULL}}; 182 {NULL}};
179 183
180 const FieldTranslationEntry ipconfig_fields[] = { 184 const FieldTranslationEntry ipconfig_fields[] = {
181 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, 185 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty},
182 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, 186 { ::onc::ipconfig::kGateway, shill::kGatewayProperty},
183 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, 187 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty},
184 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, 188 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty},
185 // This field is converted during translation, see ShillToONCTranslator:: 189 // This field is converted during translation, see ShillToONCTranslator::
186 // TranslateIPConfig. It is only converted from Shill->ONC. 190 // TranslateIPConfig. It is only converted from Shill->ONC.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 { ::onc::eap::kMD5, shill::kEapPhase2AuthPEAPMD5}, 292 { ::onc::eap::kMD5, shill::kEapPhase2AuthPEAPMD5},
289 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2}, {NULL}}; 293 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2}, {NULL}};
290 294
291 // Translation of the EAP.Inner field in case of EAP.Outer == TTLS 295 // Translation of the EAP.Inner field in case of EAP.Outer == TTLS
292 const StringTranslationEntry kEAP_TTLS_InnerTable[] = { 296 const StringTranslationEntry kEAP_TTLS_InnerTable[] = {
293 { ::onc::eap::kMD5, shill::kEapPhase2AuthTTLSMD5}, 297 { ::onc::eap::kMD5, shill::kEapPhase2AuthTTLSMD5},
294 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2}, 298 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2},
295 { ::onc::eap::kPAP, shill::kEapPhase2AuthTTLSPAP}, 299 { ::onc::eap::kPAP, shill::kEapPhase2AuthTTLSPAP},
296 {NULL}}; 300 {NULL}};
297 301
302 const StringTranslationEntry kActivationStateTable[] = {
303 { ::onc::cellular::kActivated, shill::kActivationStateActivated},
304 { ::onc::cellular::kActivating, shill::kActivationStateActivating},
305 { ::onc::cellular::kNotActivated, shill::kActivationStateNotActivated},
306 { ::onc::cellular::kPartiallyActivated,
307 shill::kActivationStatePartiallyActivated},
308 {NULL}};
309
310 const StringTranslationEntry kRoamingStateTable[] = {
311 { ::onc::cellular::kHome, shill::kRoamingStateHome},
312 { ::onc::cellular::kRoaming, shill::kRoamingStateRoaming},
313 {NULL}};
314
298 // This must contain only Shill Device properties and no Service properties. 315 // This must contain only Shill Device properties and no Service properties.
299 // For Service properties see cellular_fields. 316 // For Service properties see cellular_fields.
300 const FieldTranslationEntry kCellularDeviceTable[] = { 317 const FieldTranslationEntry kCellularDeviceTable[] = {
301 // This field is converted during translation, see onc_translator_*. 318 // This field is converted during translation, see onc_translator_*.
302 // { ::onc::cellular::kAPNList, shill::kCellularApnListProperty}, 319 // { ::onc::cellular::kAPNList, shill::kCellularApnListProperty},
303 { ::onc::cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty}, 320 { ::onc::cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty},
304 { ::onc::cellular::kCarrier, shill::kCarrierProperty}, 321 { ::onc::cellular::kCarrier, shill::kCarrierProperty},
305 { ::onc::cellular::kESN, shill::kEsnProperty}, 322 { ::onc::cellular::kESN, shill::kEsnProperty},
306 { ::onc::cellular::kFamily, shill::kTechnologyFamilyProperty}, 323 { ::onc::cellular::kFamily, shill::kTechnologyFamilyProperty},
307 { ::onc::cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty}, 324 { ::onc::cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty},
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 continue; 405 continue;
389 *onc_value = table[i].onc_value; 406 *onc_value = table[i].onc_value;
390 return true; 407 return true;
391 } 408 }
392 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; 409 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC";
393 return false; 410 return false;
394 } 411 }
395 412
396 } // namespace onc 413 } // namespace onc
397 } // namespace chromeos 414 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.h ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698