| 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 25 matching lines...) Expand all Loading... |
| 36 {NULL}}; | 36 {NULL}}; |
| 37 | 37 |
| 38 const FieldTranslationEntry ipsec_fields[] = { | 38 const FieldTranslationEntry ipsec_fields[] = { |
| 39 // Ignored by Shill, not necessary to synchronize. | 39 // Ignored by Shill, not necessary to synchronize. |
| 40 // { ::onc::ipsec::kAuthenticationType, shill::kL2tpIpsecAuthenticationType | 40 // { ::onc::ipsec::kAuthenticationType, shill::kL2tpIpsecAuthenticationType |
| 41 // }, | 41 // }, |
| 42 { ::onc::ipsec::kGroup, shill::kL2tpIpsecTunnelGroupProperty}, | 42 { ::onc::ipsec::kGroup, shill::kL2tpIpsecTunnelGroupProperty}, |
| 43 // Ignored by Shill, not necessary to synchronize. | 43 // Ignored by Shill, not necessary to synchronize. |
| 44 // { ::onc::ipsec::kIKEVersion, shill::kL2tpIpsecIkeVersion }, | 44 // { ::onc::ipsec::kIKEVersion, shill::kL2tpIpsecIkeVersion }, |
| 45 { ::onc::ipsec::kPSK, shill::kL2tpIpsecPskProperty}, | 45 { ::onc::ipsec::kPSK, shill::kL2tpIpsecPskProperty}, |
| 46 { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, | 46 // This field is converted during translation, see onc_translator_*. |
| 47 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, |
| 47 { ::onc::ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty}, | 48 { ::onc::ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty}, |
| 48 {NULL}}; | 49 {NULL}}; |
| 49 | 50 |
| 50 const FieldTranslationEntry xauth_fields[] = { | 51 const FieldTranslationEntry xauth_fields[] = { |
| 51 { ::onc::vpn::kPassword, shill::kL2tpIpsecXauthPasswordProperty}, | 52 { ::onc::vpn::kPassword, shill::kL2tpIpsecXauthPasswordProperty}, |
| 52 { ::onc::vpn::kUsername, shill::kL2tpIpsecXauthUserProperty}, | 53 { ::onc::vpn::kUsername, shill::kL2tpIpsecXauthUserProperty}, |
| 53 {NULL}}; | 54 {NULL}}; |
| 54 | 55 |
| 55 const FieldTranslationEntry l2tp_fields[] = { | 56 const FieldTranslationEntry l2tp_fields[] = { |
| 56 { ::onc::vpn::kPassword, shill::kL2tpIpsecPasswordProperty}, | 57 { ::onc::vpn::kPassword, shill::kL2tpIpsecPasswordProperty}, |
| 57 // We don't synchronize l2tp's SaveCredentials field for now, as Shill | 58 // We don't synchronize l2tp's SaveCredentials field for now, as Shill |
| 58 // doesn't | 59 // doesn't support separate settings for ipsec and l2tp. |
| 59 // support separate settings for ipsec and l2tp. | |
| 60 // { ::onc::vpn::kSaveCredentials, &kBoolSignature }, | 60 // { ::onc::vpn::kSaveCredentials, &kBoolSignature }, |
| 61 { ::onc::vpn::kUsername, shill::kL2tpIpsecUserProperty}, {NULL}}; | 61 { ::onc::vpn::kUsername, shill::kL2tpIpsecUserProperty}, {NULL}}; |
| 62 | 62 |
| 63 const FieldTranslationEntry openvpn_fields[] = { | 63 const FieldTranslationEntry openvpn_fields[] = { |
| 64 { ::onc::openvpn::kAuth, shill::kOpenVPNAuthProperty}, | 64 { ::onc::openvpn::kAuth, shill::kOpenVPNAuthProperty}, |
| 65 { ::onc::openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty}, | 65 { ::onc::openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty}, |
| 66 { ::onc::openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty}, | 66 { ::onc::openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty}, |
| 67 { ::onc::openvpn::kCipher, shill::kOpenVPNCipherProperty}, | 67 { ::onc::openvpn::kCipher, shill::kOpenVPNCipherProperty}, |
| 68 { ::onc::openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty}, | 68 { ::onc::openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty}, |
| 69 { ::onc::openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty}, | 69 { ::onc::openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty}, |
| 70 { ::onc::openvpn::kIgnoreDefaultRoute, | 70 { ::onc::openvpn::kIgnoreDefaultRoute, |
| 71 shill::kOpenVPNIgnoreDefaultRouteProperty}, | 71 shill::kOpenVPNIgnoreDefaultRouteProperty}, |
| 72 { ::onc::openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty}, | 72 { ::onc::openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty}, |
| 73 { ::onc::openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty}, | 73 { ::onc::openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty}, |
| 74 { ::onc::vpn::kPassword, shill::kOpenVPNPasswordProperty}, | 74 { ::onc::vpn::kPassword, shill::kOpenVPNPasswordProperty}, |
| 75 { ::onc::openvpn::kPort, shill::kOpenVPNPortProperty}, | 75 { ::onc::openvpn::kPort, shill::kOpenVPNPortProperty}, |
| 76 { ::onc::openvpn::kProto, shill::kOpenVPNProtoProperty}, | 76 { ::onc::openvpn::kProto, shill::kOpenVPNProtoProperty}, |
| 77 { ::onc::openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty}, | 77 { ::onc::openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty}, |
| 78 { ::onc::openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty}, | 78 { ::onc::openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty}, |
| 79 // This field is converted during translation, see onc_translator_*. | 79 // This field is converted during translation, see onc_translator_*. |
| 80 // { ::onc::openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty }, | 80 // { ::onc::openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty }, |
| 81 { ::onc::openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty}, | 81 { ::onc::openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty}, |
| 82 { ::onc::openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty}, | 82 { ::onc::openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty}, |
| 83 { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, | 83 // This field is converted during translation, see onc_translator_*. |
| 84 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, |
| 84 { ::onc::openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty}, | 85 { ::onc::openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty}, |
| 85 { ::onc::openvpn::kServerPollTimeout, | 86 { ::onc::openvpn::kServerPollTimeout, |
| 86 shill::kOpenVPNServerPollTimeoutProperty}, | 87 shill::kOpenVPNServerPollTimeoutProperty}, |
| 87 { ::onc::openvpn::kShaper, shill::kOpenVPNShaperProperty}, | 88 { ::onc::openvpn::kShaper, shill::kOpenVPNShaperProperty}, |
| 88 { ::onc::openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty}, | 89 { ::onc::openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty}, |
| 89 { ::onc::openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty}, | 90 { ::onc::openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty}, |
| 90 { ::onc::openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty}, | 91 { ::onc::openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty}, |
| 91 { ::onc::vpn::kUsername, shill::kOpenVPNUserProperty}, | 92 { ::onc::vpn::kUsername, shill::kOpenVPNUserProperty}, |
| 92 { ::onc::openvpn::kVerifyHash, shill::kOpenVPNVerifyHashProperty}, | 93 { ::onc::openvpn::kVerifyHash, shill::kOpenVPNVerifyHashProperty}, |
| 93 {NULL}}; | 94 {NULL}}; |
| 94 | 95 |
| 95 const FieldTranslationEntry verify_x509_fields[] = { | 96 const FieldTranslationEntry verify_x509_fields[] = { |
| 96 { ::onc::verify_x509::kName, shill::kOpenVPNVerifyX509NameProperty}, | 97 { ::onc::verify_x509::kName, shill::kOpenVPNVerifyX509NameProperty}, |
| 97 { ::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty}, | 98 { ::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty}, |
| 98 {NULL}}; | 99 {NULL}}; |
| 99 | 100 |
| 100 const FieldTranslationEntry vpn_fields[] = { | 101 const FieldTranslationEntry vpn_fields[] = { |
| 101 { ::onc::vpn::kAutoConnect, shill::kAutoConnectProperty}, | 102 { ::onc::vpn::kAutoConnect, shill::kAutoConnectProperty}, |
| 102 { ::onc::vpn::kHost, shill::kProviderHostProperty}, | 103 // These fields are converted during translation, see onc_translator_*. |
| 103 // This field is converted during translation, see onc_translator_*. | 104 // { ::onc::vpn::kHost, shill::kProviderHostProperty}, |
| 104 // { ::onc::vpn::kType, shill::kProviderTypeProperty }, | 105 // { ::onc::vpn::kType, shill::kProviderTypeProperty }, |
| 105 {NULL}}; | 106 {NULL}}; |
| 106 | 107 |
| 107 const FieldTranslationEntry wifi_fields[] = { | 108 const FieldTranslationEntry wifi_fields[] = { |
| 108 { ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty}, | 109 { ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty}, |
| 109 { ::onc::wifi::kBSSID, shill::kWifiBSsid}, | 110 { ::onc::wifi::kBSSID, shill::kWifiBSsid}, |
| 110 { ::onc::wifi::kFrequency, shill::kWifiFrequency}, | 111 { ::onc::wifi::kFrequency, shill::kWifiFrequency}, |
| 111 { ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty}, | 112 { ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty}, |
| 112 { ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid}, | 113 { ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid}, |
| 113 { ::onc::wifi::kPassphrase, shill::kPassphraseProperty}, | 114 { ::onc::wifi::kPassphrase, shill::kPassphraseProperty}, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 { ::onc::cellular::kActivationType, shill::kActivationTypeProperty}, | 153 { ::onc::cellular::kActivationType, shill::kActivationTypeProperty}, |
| 153 { ::onc::cellular::kActivationState, shill::kActivationStateProperty}, | 154 { ::onc::cellular::kActivationState, shill::kActivationStateProperty}, |
| 154 { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty}, | 155 { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty}, |
| 155 { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, | 156 { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, |
| 156 {NULL}}; | 157 {NULL}}; |
| 157 | 158 |
| 158 const FieldTranslationEntry network_fields[] = { | 159 const FieldTranslationEntry network_fields[] = { |
| 159 { ::onc::network_config::kGUID, shill::kGuidProperty}, | 160 { ::onc::network_config::kGUID, shill::kGuidProperty}, |
| 160 { ::onc::network_config::kConnectable, shill::kConnectableProperty }, | 161 { ::onc::network_config::kConnectable, shill::kConnectableProperty }, |
| 161 { ::onc::network_config::kErrorState, shill::kErrorProperty }, | 162 { ::onc::network_config::kErrorState, shill::kErrorProperty }, |
| 163 { ::onc::network_config::kPriority, shill::kPriorityProperty }, |
| 162 | 164 |
| 163 // Shill doesn't allow setting the name for non-VPN networks. | 165 // Shill doesn't allow setting the name for non-VPN networks. |
| 164 // Name is conditionally translated, see onc_translator_*. | 166 // Name is conditionally translated, see onc_translator_*. |
| 165 // { ::onc::network_config::kName, shill::kNameProperty }, | 167 // { ::onc::network_config::kName, shill::kNameProperty }, |
| 166 | 168 |
| 167 // Type is converted during translation, see onc_translator_*. | 169 // Type is converted during translation, see onc_translator_*. |
| 168 // { ::onc::network_config::kType, shill::kTypeProperty }, | 170 // { ::onc::network_config::kType, shill::kTypeProperty }, |
| 169 | 171 |
| 170 // These fields are converted during translation, see | 172 // These fields are converted during translation, see |
| 171 // onc_translator_shill_to_onc.cc. They are only converted when going from | 173 // onc_translator_shill_to_onc.cc. They are only converted when going from |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 continue; | 367 continue; |
| 366 *onc_value = table[i].onc_value; | 368 *onc_value = table[i].onc_value; |
| 367 return true; | 369 return true; |
| 368 } | 370 } |
| 369 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; | 371 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; |
| 370 return false; | 372 return false; |
| 371 } | 373 } |
| 372 | 374 |
| 373 } // namespace onc | 375 } // namespace onc |
| 374 } // namespace chromeos | 376 } // namespace chromeos |
| OLD | NEW |