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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // This field is converted during translation, see onc_translator_*. | 180 // This field is converted during translation, see onc_translator_*. |
181 // { ::onc::cellular::kPaymentPortal, shill::kPaymentPortal}, | 181 // { ::onc::cellular::kPaymentPortal, shill::kPaymentPortal}, |
182 // This field is converted during translation, see onc_translator_*. | 182 // This field is converted during translation, see onc_translator_*. |
183 // { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, | 183 // { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, |
184 {::onc::cellular::kSignalStrength, shill::kSignalStrengthProperty}, | 184 {::onc::cellular::kSignalStrength, shill::kSignalStrengthProperty}, |
185 {NULL}}; | 185 {NULL}}; |
186 | 186 |
187 const FieldTranslationEntry network_fields[] = { | 187 const FieldTranslationEntry network_fields[] = { |
188 {::onc::network_config::kGUID, shill::kGuidProperty}, | 188 {::onc::network_config::kGUID, shill::kGuidProperty}, |
189 {::onc::network_config::kConnectable, shill::kConnectableProperty}, | 189 {::onc::network_config::kConnectable, shill::kConnectableProperty}, |
190 {::onc::network_config::kErrorState, shill::kErrorProperty}, | |
191 {::onc::network_config::kPriority, shill::kPriorityProperty}, | 190 {::onc::network_config::kPriority, shill::kPriorityProperty}, |
192 | 191 |
193 // Shill doesn't allow setting the name for non-VPN networks. | 192 // Shill doesn't allow setting the name for non-VPN networks. |
194 // Name is conditionally translated, see onc_translator_*. | 193 // Name is conditionally translated, see onc_translator_*. |
195 // { ::onc::network_config::kName, shill::kNameProperty }, | 194 // {::onc::network_config::kName, shill::kNameProperty }, |
196 | 195 |
197 // Type is converted during translation, see onc_translator_*. | 196 // Type is converted during translation, see onc_translator_*. |
198 // { ::onc::network_config::kType, shill::kTypeProperty }, | 197 // {::onc::network_config::kType, shill::kTypeProperty }, |
199 | 198 |
200 // These fields are converted during translation, see | 199 // These fields are converted during translation, see |
201 // onc_translator_shill_to_onc.cc. They are only converted when going from | 200 // onc_translator_shill_to_onc.cc. They are only converted when going from |
202 // Shill->ONC, and ignored otherwise. | 201 // Shill->ONC, and ignored otherwise. |
203 // { ::onc::network_config::kConnectionState, shill::kStateProperty }, | 202 // {::onc::network_config::kConnectionState, shill::kStateProperty }, |
204 // { ::onc::network_config::kRestrictedConnectivity, | 203 // {::onc::network_config::kErrorState, shill::kErrorProperty}, |
205 // shill::kStateProperty }, | 204 // {::onc::network_config::kRestrictedConnectivity, shill::kStateProperty }, |
206 // { ::onc::network_config::kSource, shill::kProfileProperty }, | 205 // {::onc::network_config::kSource, shill::kProfileProperty }, |
207 // { ::onc::network_config::kMacAddress, shill::kAddressProperty }, | 206 // {::onc::network_config::kMacAddress, shill::kAddressProperty }, |
208 {NULL}}; | 207 {NULL}}; |
209 | 208 |
210 const FieldTranslationEntry ipconfig_fields[] = { | 209 const FieldTranslationEntry ipconfig_fields[] = { |
211 {::onc::ipconfig::kIPAddress, shill::kAddressProperty}, | 210 {::onc::ipconfig::kIPAddress, shill::kAddressProperty}, |
212 {::onc::ipconfig::kGateway, shill::kGatewayProperty}, | 211 {::onc::ipconfig::kGateway, shill::kGatewayProperty}, |
213 {::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, | 212 {::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, |
214 {::onc::ipconfig::kNameServers, shill::kNameServersProperty}, | 213 {::onc::ipconfig::kNameServers, shill::kNameServersProperty}, |
215 // This field is converted during translation, see ShillToONCTranslator:: | 214 // This field is converted during translation, see ShillToONCTranslator:: |
216 // TranslateIPConfig. It is only converted from Shill->ONC. | 215 // TranslateIPConfig. It is only converted from Shill->ONC. |
217 // { ::onc::ipconfig::kType, shill::kMethodProperty}, | 216 // { ::onc::ipconfig::kType, shill::kMethodProperty}, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 continue; | 435 continue; |
437 *onc_value = table[i].onc_value; | 436 *onc_value = table[i].onc_value; |
438 return true; | 437 return true; |
439 } | 438 } |
440 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; | 439 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; |
441 return false; | 440 return false; |
442 } | 441 } |
443 | 442 |
444 } // namespace onc | 443 } // namespace onc |
445 } // namespace chromeos | 444 } // namespace chromeos |
OLD | NEW |