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

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

Issue 1031253002: Format ONC translation files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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"
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 21
22 namespace { 22 namespace {
23 23
24 const FieldTranslationEntry eap_fields[] = { 24 const FieldTranslationEntry eap_fields[] = {
25 { ::onc::eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty}, 25 {::onc::eap::kAnonymousIdentity, shill::kEapAnonymousIdentityProperty},
26 { ::onc::eap::kIdentity, shill::kEapIdentityProperty}, 26 {::onc::eap::kIdentity, shill::kEapIdentityProperty},
27 // This field is converted during translation, see onc_translator_*. 27 // This field is converted during translation, see onc_translator_*.
28 // { ::onc::eap::kInner, shill::kEapPhase2AuthProperty }, 28 // { ::onc::eap::kInner, shill::kEapPhase2AuthProperty },
29 29
30 // This field is converted during translation, see onc_translator_*. 30 // This field is converted during translation, see onc_translator_*.
31 // { ::onc::eap::kOuter, shill::kEapMethodProperty }, 31 // { ::onc::eap::kOuter, shill::kEapMethodProperty },
32 { ::onc::eap::kPassword, shill::kEapPasswordProperty}, 32 {::onc::eap::kPassword, shill::kEapPasswordProperty},
33 { ::onc::eap::kSaveCredentials, shill::kSaveCredentialsProperty}, 33 {::onc::eap::kSaveCredentials, shill::kSaveCredentialsProperty},
34 { ::onc::eap::kServerCAPEMs, shill::kEapCaCertPemProperty}, 34 {::onc::eap::kServerCAPEMs, shill::kEapCaCertPemProperty},
35 { ::onc::eap::kUseSystemCAs, shill::kEapUseSystemCasProperty}, 35 {::onc::eap::kUseSystemCAs, shill::kEapUseSystemCasProperty},
36 {NULL}}; 36 {NULL}};
37 37
38 const FieldTranslationEntry ipsec_fields[] = { 38 const FieldTranslationEntry ipsec_fields[] = {
39 // This field is converted during translation, see onc_translator_*. 39 // This field is converted during translation, see onc_translator_*.
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 // This field is converted during translation, see onc_translator_*. 46 // This field is converted during translation, see onc_translator_*.
47 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, 47 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty},
48 { ::onc::ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty}, 48 {::onc::ipsec::kServerCAPEMs, shill::kL2tpIpsecCaCertPemProperty},
49 {NULL}}; 49 {NULL}};
50 50
51 const FieldTranslationEntry xauth_fields[] = { 51 const FieldTranslationEntry xauth_fields[] = {
52 { ::onc::vpn::kPassword, shill::kL2tpIpsecXauthPasswordProperty}, 52 {::onc::vpn::kPassword, shill::kL2tpIpsecXauthPasswordProperty},
53 { ::onc::vpn::kUsername, shill::kL2tpIpsecXauthUserProperty}, 53 {::onc::vpn::kUsername, shill::kL2tpIpsecXauthUserProperty},
54 {NULL}}; 54 {NULL}};
55 55
56 const FieldTranslationEntry l2tp_fields[] = { 56 const FieldTranslationEntry l2tp_fields[] = {
57 { ::onc::vpn::kPassword, shill::kL2tpIpsecPasswordProperty}, 57 {::onc::vpn::kPassword, shill::kL2tpIpsecPasswordProperty},
58 // 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
59 // doesn't support separate settings for ipsec and l2tp. 59 // doesn't 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},
62 {NULL}};
62 63
63 const FieldTranslationEntry openvpn_fields[] = { 64 const FieldTranslationEntry openvpn_fields[] = {
64 { ::onc::openvpn::kAuth, shill::kOpenVPNAuthProperty}, 65 {::onc::openvpn::kAuth, shill::kOpenVPNAuthProperty},
65 { ::onc::openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty}, 66 {::onc::openvpn::kAuthNoCache, shill::kOpenVPNAuthNoCacheProperty},
66 { ::onc::openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty}, 67 {::onc::openvpn::kAuthRetry, shill::kOpenVPNAuthRetryProperty},
67 { ::onc::openvpn::kCipher, shill::kOpenVPNCipherProperty}, 68 {::onc::openvpn::kCipher, shill::kOpenVPNCipherProperty},
68 { ::onc::openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty}, 69 {::onc::openvpn::kCompLZO, shill::kOpenVPNCompLZOProperty},
69 { ::onc::openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty}, 70 {::onc::openvpn::kCompNoAdapt, shill::kOpenVPNCompNoAdaptProperty},
70 { ::onc::openvpn::kIgnoreDefaultRoute, 71 {::onc::openvpn::kIgnoreDefaultRoute,
71 shill::kOpenVPNIgnoreDefaultRouteProperty}, 72 shill::kOpenVPNIgnoreDefaultRouteProperty},
72 { ::onc::openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty}, 73 {::onc::openvpn::kKeyDirection, shill::kOpenVPNKeyDirectionProperty},
73 { ::onc::openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty}, 74 {::onc::openvpn::kNsCertType, shill::kOpenVPNNsCertTypeProperty},
74 // This field is converted during translation, see onc_translator_*. 75 // This field is converted during translation, see onc_translator_*.
75 // { ::onc::vpn::kOTP, shill::kOpenVPNTokenProperty or kOpenVPNOTPProperty}, 76 // { ::onc::vpn::kOTP, shill::kOpenVPNTokenProperty or kOpenVPNOTPProperty},
76 // This field is converted during translation, see onc_translator_*. 77 // This field is converted during translation, see onc_translator_*.
77 // { ::onc::vpn::kPassword, shill::kOpenVPNPasswordProperty}, 78 // { ::onc::vpn::kPassword, shill::kOpenVPNPasswordProperty},
78 { ::onc::openvpn::kPort, shill::kOpenVPNPortProperty}, 79 {::onc::openvpn::kPort, shill::kOpenVPNPortProperty},
79 { ::onc::openvpn::kProto, shill::kOpenVPNProtoProperty}, 80 {::onc::openvpn::kProto, shill::kOpenVPNProtoProperty},
80 { ::onc::openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty}, 81 {::onc::openvpn::kPushPeerInfo, shill::kOpenVPNPushPeerInfoProperty},
81 { ::onc::openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty}, 82 {::onc::openvpn::kRemoteCertEKU, shill::kOpenVPNRemoteCertEKUProperty},
82 // This field is converted during translation, see onc_translator_*. 83 // This field is converted during translation, see onc_translator_*.
83 // { ::onc::openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty }, 84 // { ::onc::openvpn::kRemoteCertKU, shill::kOpenVPNRemoteCertKUProperty },
84 { ::onc::openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty}, 85 {::onc::openvpn::kRemoteCertTLS, shill::kOpenVPNRemoteCertTLSProperty},
85 { ::onc::openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty}, 86 {::onc::openvpn::kRenegSec, shill::kOpenVPNRenegSecProperty},
86 // This field is converted during translation, see onc_translator_*. 87 // This field is converted during translation, see onc_translator_*.
87 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty}, 88 // { ::onc::vpn::kSaveCredentials, shill::kSaveCredentialsProperty},
88 { ::onc::openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty}, 89 {::onc::openvpn::kServerCAPEMs, shill::kOpenVPNCaCertPemProperty},
89 { ::onc::openvpn::kServerPollTimeout, 90 {::onc::openvpn::kServerPollTimeout,
90 shill::kOpenVPNServerPollTimeoutProperty}, 91 shill::kOpenVPNServerPollTimeoutProperty},
91 { ::onc::openvpn::kShaper, shill::kOpenVPNShaperProperty}, 92 {::onc::openvpn::kShaper, shill::kOpenVPNShaperProperty},
92 { ::onc::openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty}, 93 {::onc::openvpn::kStaticChallenge, shill::kOpenVPNStaticChallengeProperty},
93 { ::onc::openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty}, 94 {::onc::openvpn::kTLSAuthContents, shill::kOpenVPNTLSAuthContentsProperty},
94 { ::onc::openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty}, 95 {::onc::openvpn::kTLSRemote, shill::kOpenVPNTLSRemoteProperty},
95 { ::onc::vpn::kUsername, shill::kOpenVPNUserProperty}, 96 {::onc::vpn::kUsername, shill::kOpenVPNUserProperty},
96 { ::onc::openvpn::kVerifyHash, shill::kOpenVPNVerifyHashProperty}, 97 {::onc::openvpn::kVerifyHash, shill::kOpenVPNVerifyHashProperty},
97 {NULL}}; 98 {NULL}};
98 99
99 const FieldTranslationEntry verify_x509_fields[] = { 100 const FieldTranslationEntry verify_x509_fields[] = {
100 { ::onc::verify_x509::kName, shill::kOpenVPNVerifyX509NameProperty}, 101 {::onc::verify_x509::kName, shill::kOpenVPNVerifyX509NameProperty},
101 { ::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty}, 102 {::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty},
102 {NULL}}; 103 {NULL}};
103 104
104 const FieldTranslationEntry vpn_fields[] = { 105 const FieldTranslationEntry vpn_fields[] = {
105 { ::onc::vpn::kAutoConnect, shill::kAutoConnectProperty}, 106 {::onc::vpn::kAutoConnect, shill::kAutoConnectProperty},
106 // These fields are converted during translation, see onc_translator_*. 107 // These fields are converted during translation, see onc_translator_*.
107 // { ::onc::vpn::kHost, shill::kProviderHostProperty}, 108 // { ::onc::vpn::kHost, shill::kProviderHostProperty},
108 // { ::onc::vpn::kType, shill::kProviderTypeProperty }, 109 // { ::onc::vpn::kType, shill::kProviderTypeProperty },
109 {NULL}}; 110 {NULL}};
110 111
111 const FieldTranslationEntry wifi_fields[] = { 112 const FieldTranslationEntry wifi_fields[] = {
112 { ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty}, 113 {::onc::wifi::kAutoConnect, shill::kAutoConnectProperty},
113 { ::onc::wifi::kBSSID, shill::kWifiBSsid}, 114 {::onc::wifi::kBSSID, shill::kWifiBSsid},
114 // This dictionary is converted during translation, see onc_translator_*. 115 // This dictionary is converted during translation, see onc_translator_*.
115 // { ::onc::wifi::kEAP, shill::kEap*}, 116 // { ::onc::wifi::kEAP, shill::kEap*},
116 { ::onc::wifi::kFrequency, shill::kWifiFrequency}, 117 {::onc::wifi::kFrequency, shill::kWifiFrequency},
117 { ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty}, 118 {::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty},
118 { ::onc::wifi::kHexSSID, shill::kWifiHexSsid}, 119 {::onc::wifi::kHexSSID, shill::kWifiHexSsid},
119 { ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid}, 120 {::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid},
120 { ::onc::wifi::kPassphrase, shill::kPassphraseProperty}, 121 {::onc::wifi::kPassphrase, shill::kPassphraseProperty},
121 // This field is converted during translation, see onc_translator_*. 122 // This field is converted during translation, see onc_translator_*.
122 // { ::onc::wifi::kSecurity, shill::kSecurityClassProperty }, 123 // { ::onc::wifi::kSecurity, shill::kSecurityClassProperty },
123 { ::onc::wifi::kSignalStrength, shill::kSignalStrengthProperty}, 124 {::onc::wifi::kSignalStrength, shill::kSignalStrengthProperty},
124 {NULL}}; 125 {NULL}};
125 126
126 const FieldTranslationEntry wimax_fields[] = { 127 const FieldTranslationEntry wimax_fields[] = {
127 { ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty}, 128 {::onc::wimax::kAutoConnect, shill::kAutoConnectProperty},
128 // This dictionary is converted during translation, see onc_translator_*. 129 // This dictionary is converted during translation, see onc_translator_*.
129 // { ::onc::wimax::kEAP, shill::kEap*}, 130 // { ::onc::wimax::kEAP, shill::kEap*},
130 { ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty}, 131 {::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty},
131 {NULL}}; 132 {NULL}};
132 133
133 const FieldTranslationEntry cellular_apn_fields[] = { 134 const FieldTranslationEntry cellular_apn_fields[] = {
134 { ::onc::cellular_apn::kAccessPointName, shill::kApnProperty}, 135 {::onc::cellular_apn::kAccessPointName, shill::kApnProperty},
135 { ::onc::cellular_apn::kName, shill::kApnNameProperty}, 136 {::onc::cellular_apn::kName, shill::kApnNameProperty},
136 { ::onc::cellular_apn::kUsername, shill::kApnUsernameProperty}, 137 {::onc::cellular_apn::kUsername, shill::kApnUsernameProperty},
137 { ::onc::cellular_apn::kPassword, shill::kApnPasswordProperty}, 138 {::onc::cellular_apn::kPassword, shill::kApnPasswordProperty},
138 { ::onc::cellular_apn::kLocalizedName, shill::kApnLocalizedNameProperty}, 139 {::onc::cellular_apn::kLocalizedName, shill::kApnLocalizedNameProperty},
139 { ::onc::cellular_apn::kLanguage, shill::kApnLanguageProperty}, 140 {::onc::cellular_apn::kLanguage, shill::kApnLanguageProperty},
140 {NULL}}; 141 {NULL}};
141 142
142 const FieldTranslationEntry cellular_found_network_fields[] = { 143 const FieldTranslationEntry cellular_found_network_fields[] = {
143 { ::onc::cellular_found_network::kNetworkId, shill::kNetworkIdProperty}, 144 {::onc::cellular_found_network::kNetworkId, shill::kNetworkIdProperty},
144 { ::onc::cellular_found_network::kStatus, shill::kStatusProperty}, 145 {::onc::cellular_found_network::kStatus, shill::kStatusProperty},
145 { ::onc::cellular_found_network::kTechnology, shill::kTechnologyProperty}, 146 {::onc::cellular_found_network::kTechnology, shill::kTechnologyProperty},
146 { ::onc::cellular_found_network::kShortName, shill::kShortNameProperty}, 147 {::onc::cellular_found_network::kShortName, shill::kShortNameProperty},
147 { ::onc::cellular_found_network::kLongName, shill::kLongNameProperty}, 148 {::onc::cellular_found_network::kLongName, shill::kLongNameProperty},
148 {NULL}}; 149 {NULL}};
149 150
150 const FieldTranslationEntry cellular_provider_fields[] = { 151 const FieldTranslationEntry cellular_provider_fields[] = {
151 { ::onc::cellular_provider::kCode, shill::kOperatorCodeKey}, 152 {::onc::cellular_provider::kCode, shill::kOperatorCodeKey},
152 { ::onc::cellular_provider::kCountry, shill::kOperatorCountryKey}, 153 {::onc::cellular_provider::kCountry, shill::kOperatorCountryKey},
153 { ::onc::cellular_provider::kName, shill::kOperatorNameKey}, 154 {::onc::cellular_provider::kName, shill::kOperatorNameKey},
154 {NULL}}; 155 {NULL}};
155 156
156 const FieldTranslationEntry sim_lock_status_fields[] = { 157 const FieldTranslationEntry sim_lock_status_fields[] = {
157 { ::onc::sim_lock_status::kLockEnabled, shill::kSIMLockEnabledProperty}, 158 {::onc::sim_lock_status::kLockEnabled, shill::kSIMLockEnabledProperty},
158 { ::onc::sim_lock_status::kLockType, shill::kSIMLockTypeProperty}, 159 {::onc::sim_lock_status::kLockType, shill::kSIMLockTypeProperty},
159 { ::onc::sim_lock_status::kRetriesLeft, shill::kSIMLockRetriesLeftProperty}, 160 {::onc::sim_lock_status::kRetriesLeft, shill::kSIMLockRetriesLeftProperty},
160 {NULL}}; 161 {NULL}};
161 162
162 // This must only contain Service properties and not Device properties. 163 // This must only contain Service properties and not Device properties.
163 // For Device properties see kCellularDeviceTable. 164 // For Device properties see kCellularDeviceTable.
164 const FieldTranslationEntry cellular_fields[] = { 165 const FieldTranslationEntry cellular_fields[] = {
165 { ::onc::cellular::kActivationType, shill::kActivationTypeProperty}, 166 {::onc::cellular::kActivationType, shill::kActivationTypeProperty},
166 // This field is converted during translation, see onc_translator_*. 167 // This field is converted during translation, see onc_translator_*.
167 // { ::onc::cellular::kActivationState, shill::kActivationStateProperty}, 168 // { ::onc::cellular::kActivationState, shill::kActivationStateProperty},
168 { ::onc::vpn::kAutoConnect, shill::kAutoConnectProperty}, 169 {::onc::vpn::kAutoConnect, shill::kAutoConnectProperty},
169 { ::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty}, 170 {::onc::cellular::kNetworkTechnology, shill::kNetworkTechnologyProperty},
170 // This field is converted during translation, see onc_translator_*. 171 // This field is converted during translation, see onc_translator_*.
171 // { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty}, 172 // { ::onc::cellular::kRoamingState, shill::kRoamingStateProperty},
172 { ::onc::cellular::kSignalStrength, shill::kSignalStrengthProperty}, 173 {::onc::cellular::kSignalStrength, shill::kSignalStrengthProperty},
173 {NULL}}; 174 {NULL}};
174 175
175 const FieldTranslationEntry network_fields[] = { 176 const FieldTranslationEntry network_fields[] = {
176 { ::onc::network_config::kGUID, shill::kGuidProperty}, 177 {::onc::network_config::kGUID, shill::kGuidProperty},
177 { ::onc::network_config::kConnectable, shill::kConnectableProperty }, 178 {::onc::network_config::kConnectable, shill::kConnectableProperty},
178 { ::onc::network_config::kErrorState, shill::kErrorProperty }, 179 {::onc::network_config::kErrorState, shill::kErrorProperty},
179 { ::onc::network_config::kPriority, shill::kPriorityProperty }, 180 {::onc::network_config::kPriority, shill::kPriorityProperty},
180 181
181 // Shill doesn't allow setting the name for non-VPN networks. 182 // Shill doesn't allow setting the name for non-VPN networks.
182 // Name is conditionally translated, see onc_translator_*. 183 // Name is conditionally translated, see onc_translator_*.
183 // { ::onc::network_config::kName, shill::kNameProperty }, 184 // { ::onc::network_config::kName, shill::kNameProperty },
184 185
185 // Type is converted during translation, see onc_translator_*. 186 // Type is converted during translation, see onc_translator_*.
186 // { ::onc::network_config::kType, shill::kTypeProperty }, 187 // { ::onc::network_config::kType, shill::kTypeProperty },
187 188
188 // These fields are converted during translation, see 189 // These fields are converted during translation, see
189 // onc_translator_shill_to_onc.cc. They are only converted when going from 190 // onc_translator_shill_to_onc.cc. They are only converted when going from
190 // Shill->ONC, and ignored otherwise. 191 // Shill->ONC, and ignored otherwise.
191 // { ::onc::network_config::kConnectionState, shill::kStateProperty }, 192 // { ::onc::network_config::kConnectionState, shill::kStateProperty },
192 // { ::onc::network_config::kRestrictedConnectivity, 193 // { ::onc::network_config::kRestrictedConnectivity,
193 // shill::kStateProperty }, 194 // shill::kStateProperty },
194 // { ::onc::network_config::kSource, shill::kProfileProperty }, 195 // { ::onc::network_config::kSource, shill::kProfileProperty },
195 // { ::onc::network_config::kMacAddress, shill::kAddressProperty }, 196 // { ::onc::network_config::kMacAddress, shill::kAddressProperty },
196 {NULL}}; 197 {NULL}};
197 198
198 const FieldTranslationEntry ipconfig_fields[] = { 199 const FieldTranslationEntry ipconfig_fields[] = {
199 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, 200 {::onc::ipconfig::kIPAddress, shill::kAddressProperty},
200 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, 201 {::onc::ipconfig::kGateway, shill::kGatewayProperty},
201 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, 202 {::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty},
202 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, 203 {::onc::ipconfig::kNameServers, shill::kNameServersProperty},
203 // This field is converted during translation, see ShillToONCTranslator:: 204 // This field is converted during translation, see ShillToONCTranslator::
204 // TranslateIPConfig. It is only converted from Shill->ONC. 205 // TranslateIPConfig. It is only converted from Shill->ONC.
205 // { ::onc::ipconfig::kType, shill::kMethodProperty}, 206 // { ::onc::ipconfig::kType, shill::kMethodProperty},
206 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl, 207 {::onc::ipconfig::kWebProxyAutoDiscoveryUrl,
207 shill::kWebProxyAutoDiscoveryUrlProperty}, 208 shill::kWebProxyAutoDiscoveryUrlProperty},
208 {NULL}}; 209 {NULL}};
209 210
210 const FieldTranslationEntry static_or_saved_ipconfig_fields[] = { 211 const FieldTranslationEntry static_or_saved_ipconfig_fields[] = {
211 { ::onc::ipconfig::kIPAddress, shill::kAddressProperty}, 212 {::onc::ipconfig::kIPAddress, shill::kAddressProperty},
212 { ::onc::ipconfig::kGateway, shill::kGatewayProperty}, 213 {::onc::ipconfig::kGateway, shill::kGatewayProperty},
213 { ::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty}, 214 {::onc::ipconfig::kRoutingPrefix, shill::kPrefixlenProperty},
214 { ::onc::ipconfig::kNameServers, shill::kNameServersProperty}, 215 {::onc::ipconfig::kNameServers, shill::kNameServersProperty},
215 {NULL}}; 216 {NULL}};
216 217
217 struct OncValueTranslationEntry { 218 struct OncValueTranslationEntry {
218 const OncValueSignature* onc_signature; 219 const OncValueSignature* onc_signature;
219 const FieldTranslationEntry* field_translation_table; 220 const FieldTranslationEntry* field_translation_table;
220 }; 221 };
221 222
222 const OncValueTranslationEntry onc_value_translation_table[] = { 223 const OncValueTranslationEntry onc_value_translation_table[] = {
223 { &kEAPSignature, eap_fields }, 224 {&kEAPSignature, eap_fields},
224 { &kIPsecSignature, ipsec_fields }, 225 {&kIPsecSignature, ipsec_fields},
225 { &kL2TPSignature, l2tp_fields }, 226 {&kL2TPSignature, l2tp_fields},
226 { &kXAUTHSignature, xauth_fields }, 227 {&kXAUTHSignature, xauth_fields},
227 { &kOpenVPNSignature, openvpn_fields }, 228 {&kOpenVPNSignature, openvpn_fields},
228 { &kVerifyX509Signature, verify_x509_fields }, 229 {&kVerifyX509Signature, verify_x509_fields},
229 { &kVPNSignature, vpn_fields }, 230 {&kVPNSignature, vpn_fields},
230 { &kWiFiSignature, wifi_fields }, 231 {&kWiFiSignature, wifi_fields},
231 { &kWiFiWithStateSignature, wifi_fields }, 232 {&kWiFiWithStateSignature, wifi_fields},
232 { &kWiMAXSignature, wimax_fields }, 233 {&kWiMAXSignature, wimax_fields},
233 { &kWiMAXWithStateSignature, wimax_fields }, 234 {&kWiMAXWithStateSignature, wimax_fields},
234 { &kCellularApnSignature, cellular_apn_fields }, 235 {&kCellularApnSignature, cellular_apn_fields},
235 { &kCellularFoundNetworkSignature, cellular_found_network_fields }, 236 {&kCellularFoundNetworkSignature, cellular_found_network_fields},
236 { &kCellularProviderSignature, cellular_provider_fields }, 237 {&kCellularProviderSignature, cellular_provider_fields},
237 { &kSIMLockStatusSignature, sim_lock_status_fields }, 238 {&kSIMLockStatusSignature, sim_lock_status_fields},
238 { &kCellularSignature, cellular_fields }, 239 {&kCellularSignature, cellular_fields},
239 { &kCellularWithStateSignature, cellular_fields }, 240 {&kCellularWithStateSignature, cellular_fields},
240 { &kNetworkWithStateSignature, network_fields }, 241 {&kNetworkWithStateSignature, network_fields},
241 { &kNetworkConfigurationSignature, network_fields }, 242 {&kNetworkConfigurationSignature, network_fields},
242 { &kIPConfigSignature, ipconfig_fields }, 243 {&kIPConfigSignature, ipconfig_fields},
243 { &kSavedIPConfigSignature, static_or_saved_ipconfig_fields }, 244 {&kSavedIPConfigSignature, static_or_saved_ipconfig_fields},
244 { &kStaticIPConfigSignature, static_or_saved_ipconfig_fields }, 245 {&kStaticIPConfigSignature, static_or_saved_ipconfig_fields},
245 { NULL } 246 {NULL}};
246 };
247 247
248 struct NestedShillDictionaryEntry { 248 struct NestedShillDictionaryEntry {
249 const OncValueSignature* onc_signature; 249 const OncValueSignature* onc_signature;
250 // NULL terminated list of Shill property keys. 250 // NULL terminated list of Shill property keys.
251 const char* const* shill_property_path; 251 const char* const* shill_property_path;
252 }; 252 };
253 253
254 const char* cellular_apn_path_entries[] = { 254 const char* cellular_apn_path_entries[] = {shill::kCellularApnProperty, NULL};
255 shill::kCellularApnProperty,
256 NULL
257 };
258 255
259 const char* static_ip_config_path_entries[] = { 256 const char* static_ip_config_path_entries[] = {shill::kStaticIPConfigProperty,
260 shill::kStaticIPConfigProperty, 257 NULL};
261 NULL
262 };
263 258
264 const NestedShillDictionaryEntry nested_shill_dictionaries[] = { 259 const NestedShillDictionaryEntry nested_shill_dictionaries[] = {
265 { &kCellularApnSignature, cellular_apn_path_entries }, 260 {&kCellularApnSignature, cellular_apn_path_entries},
266 { &kStaticIPConfigSignature, static_ip_config_path_entries }, 261 {&kStaticIPConfigSignature, static_ip_config_path_entries},
267 { NULL } 262 {NULL}};
268 };
269 263
270 } // namespace 264 } // namespace
271 265
272 const StringTranslationEntry kNetworkTypeTable[] = { 266 const StringTranslationEntry kNetworkTypeTable[] = {
273 // This mapping is ensured in the translation code. 267 // This mapping is ensured in the translation code.
274 // { network_type::kEthernet, shill::kTypeEthernet }, 268 // { network_type::kEthernet, shill::kTypeEthernet },
275 // { network_type::kEthernet, shill::kTypeEthernetEap }, 269 // { network_type::kEthernet, shill::kTypeEthernetEap },
276 { ::onc::network_type::kWiFi, shill::kTypeWifi}, 270 {::onc::network_type::kWiFi, shill::kTypeWifi},
277 { ::onc::network_type::kWimax, shill::kTypeWimax}, 271 {::onc::network_type::kWimax, shill::kTypeWimax},
278 { ::onc::network_type::kCellular, shill::kTypeCellular}, 272 {::onc::network_type::kCellular, shill::kTypeCellular},
279 { ::onc::network_type::kVPN, shill::kTypeVPN}, 273 {::onc::network_type::kVPN, shill::kTypeVPN},
280 {NULL}}; 274 {NULL}};
281 275
282 const StringTranslationEntry kVPNTypeTable[] = { 276 const StringTranslationEntry kVPNTypeTable[] = {
283 { ::onc::vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec}, 277 {::onc::vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec},
284 { ::onc::vpn::kOpenVPN, shill::kProviderOpenVpn}, 278 {::onc::vpn::kOpenVPN, shill::kProviderOpenVpn},
285 { ::onc::vpn::kThirdPartyVpn, shill::kProviderThirdPartyVpn}, 279 {::onc::vpn::kThirdPartyVpn, shill::kProviderThirdPartyVpn},
286 {NULL}}; 280 {NULL}};
287 281
288 const StringTranslationEntry kWiFiSecurityTable[] = { 282 const StringTranslationEntry kWiFiSecurityTable[] = {
289 { ::onc::wifi::kSecurityNone, shill::kSecurityNone}, 283 {::onc::wifi::kSecurityNone, shill::kSecurityNone},
290 { ::onc::wifi::kWEP_PSK, shill::kSecurityWep}, 284 {::onc::wifi::kWEP_PSK, shill::kSecurityWep},
291 { ::onc::wifi::kWPA_PSK, shill::kSecurityPsk}, 285 {::onc::wifi::kWPA_PSK, shill::kSecurityPsk},
292 { ::onc::wifi::kWPA_EAP, shill::kSecurity8021x}, 286 {::onc::wifi::kWPA_EAP, shill::kSecurity8021x},
293 {NULL}}; 287 {NULL}};
294 288
295 const StringTranslationEntry kEAPOuterTable[] = { 289 const StringTranslationEntry kEAPOuterTable[] = {
296 { ::onc::eap::kPEAP, shill::kEapMethodPEAP}, 290 {::onc::eap::kPEAP, shill::kEapMethodPEAP},
297 { ::onc::eap::kEAP_TLS, shill::kEapMethodTLS}, 291 {::onc::eap::kEAP_TLS, shill::kEapMethodTLS},
298 { ::onc::eap::kEAP_TTLS, shill::kEapMethodTTLS}, 292 {::onc::eap::kEAP_TTLS, shill::kEapMethodTTLS},
299 { ::onc::eap::kLEAP, shill::kEapMethodLEAP}, 293 {::onc::eap::kLEAP, shill::kEapMethodLEAP},
300 {NULL}}; 294 {NULL}};
301 295
302 // Translation of the EAP.Inner field in case of EAP.Outer == PEAP 296 // Translation of the EAP.Inner field in case of EAP.Outer == PEAP
303 const StringTranslationEntry kEAP_PEAP_InnerTable[] = { 297 const StringTranslationEntry kEAP_PEAP_InnerTable[] = {
304 { ::onc::eap::kMD5, shill::kEapPhase2AuthPEAPMD5}, 298 {::onc::eap::kMD5, shill::kEapPhase2AuthPEAPMD5},
305 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2}, {NULL}}; 299 {::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthPEAPMSCHAPV2},
300 {NULL}};
306 301
307 // Translation of the EAP.Inner field in case of EAP.Outer == TTLS 302 // Translation of the EAP.Inner field in case of EAP.Outer == TTLS
308 const StringTranslationEntry kEAP_TTLS_InnerTable[] = { 303 const StringTranslationEntry kEAP_TTLS_InnerTable[] = {
309 { ::onc::eap::kMD5, shill::kEapPhase2AuthTTLSMD5}, 304 {::onc::eap::kMD5, shill::kEapPhase2AuthTTLSMD5},
310 { ::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2}, 305 {::onc::eap::kMSCHAPv2, shill::kEapPhase2AuthTTLSMSCHAPV2},
311 { ::onc::eap::kPAP, shill::kEapPhase2AuthTTLSPAP}, 306 {::onc::eap::kPAP, shill::kEapPhase2AuthTTLSPAP},
312 {NULL}}; 307 {NULL}};
313 308
314 const StringTranslationEntry kActivationStateTable[] = { 309 const StringTranslationEntry kActivationStateTable[] = {
315 { ::onc::cellular::kActivated, shill::kActivationStateActivated}, 310 {::onc::cellular::kActivated, shill::kActivationStateActivated},
316 { ::onc::cellular::kActivating, shill::kActivationStateActivating}, 311 {::onc::cellular::kActivating, shill::kActivationStateActivating},
317 { ::onc::cellular::kNotActivated, shill::kActivationStateNotActivated}, 312 {::onc::cellular::kNotActivated, shill::kActivationStateNotActivated},
318 { ::onc::cellular::kPartiallyActivated, 313 {::onc::cellular::kPartiallyActivated,
319 shill::kActivationStatePartiallyActivated}, 314 shill::kActivationStatePartiallyActivated},
320 {NULL}}; 315 {NULL}};
321 316
322 const StringTranslationEntry kRoamingStateTable[] = { 317 const StringTranslationEntry kRoamingStateTable[] = {
323 { ::onc::cellular::kRoamingHome, shill::kRoamingStateHome}, 318 {::onc::cellular::kRoamingHome, shill::kRoamingStateHome},
324 { ::onc::cellular::kRoamingRoaming, shill::kRoamingStateRoaming}, 319 {::onc::cellular::kRoamingRoaming, shill::kRoamingStateRoaming},
325 {NULL}}; 320 {NULL}};
326 321
327 // This must contain only Shill Device properties and no Service properties. 322 // This must contain only Shill Device properties and no Service properties.
328 // For Service properties see cellular_fields. 323 // For Service properties see cellular_fields.
329 const FieldTranslationEntry kCellularDeviceTable[] = { 324 const FieldTranslationEntry kCellularDeviceTable[] = {
330 // This field is converted during translation, see onc_translator_*. 325 // This field is converted during translation, see onc_translator_*.
331 // { ::onc::cellular::kAPNList, shill::kCellularApnListProperty}, 326 // { ::onc::cellular::kAPNList, shill::kCellularApnListProperty},
332 { ::onc::cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty}, 327 {::onc::cellular::kAllowRoaming, shill::kCellularAllowRoamingProperty},
333 { ::onc::cellular::kCarrier, shill::kCarrierProperty}, 328 {::onc::cellular::kCarrier, shill::kCarrierProperty},
334 { ::onc::cellular::kESN, shill::kEsnProperty}, 329 {::onc::cellular::kESN, shill::kEsnProperty},
335 { ::onc::cellular::kFamily, shill::kTechnologyFamilyProperty}, 330 {::onc::cellular::kFamily, shill::kTechnologyFamilyProperty},
336 { ::onc::cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty}, 331 {::onc::cellular::kFirmwareRevision, shill::kFirmwareRevisionProperty},
337 // This field is converted during translation, see onc_translator_*. 332 // This field is converted during translation, see onc_translator_*.
338 // { ::onc::cellular::kFoundNetworks, shill::kFoundNetworksProperty}, 333 // { ::onc::cellular::kFoundNetworks, shill::kFoundNetworksProperty},
339 { ::onc::cellular::kHardwareRevision, shill::kHardwareRevisionProperty}, 334 {::onc::cellular::kHardwareRevision, shill::kHardwareRevisionProperty},
340 // This field is converted during translation, see onc_translator_*. 335 // This field is converted during translation, see onc_translator_*.
341 // { ::onc::cellular::kHomeProvider, shill::kHomeProviderProperty}, 336 // { ::onc::cellular::kHomeProvider, shill::kHomeProviderProperty},
342 { ::onc::cellular::kICCID, shill::kIccidProperty}, 337 {::onc::cellular::kICCID, shill::kIccidProperty},
343 { ::onc::cellular::kIMEI, shill::kImeiProperty}, 338 {::onc::cellular::kIMEI, shill::kImeiProperty},
344 { ::onc::cellular::kIMSI, shill::kImsiProperty}, 339 {::onc::cellular::kIMSI, shill::kImsiProperty},
345 { ::onc::cellular::kManufacturer, shill::kManufacturerProperty}, 340 {::onc::cellular::kManufacturer, shill::kManufacturerProperty},
346 { ::onc::cellular::kMDN, shill::kMdnProperty}, 341 {::onc::cellular::kMDN, shill::kMdnProperty},
347 { ::onc::cellular::kMEID, shill::kMeidProperty}, 342 {::onc::cellular::kMEID, shill::kMeidProperty},
348 { ::onc::cellular::kMIN, shill::kMinProperty}, 343 {::onc::cellular::kMIN, shill::kMinProperty},
349 { ::onc::cellular::kModelID, shill::kModelIDProperty}, 344 {::onc::cellular::kModelID, shill::kModelIDProperty},
350 { ::onc::cellular::kPRLVersion, shill::kPRLVersionProperty}, 345 {::onc::cellular::kPRLVersion, shill::kPRLVersionProperty},
351 // This field is converted during translation, see onc_translator_*. 346 // This field is converted during translation, see onc_translator_*.
352 // { ::onc::cellular::kSIMLockStatus, shill::kSIMLockStatusProperty}, 347 // { ::onc::cellular::kSIMLockStatus, shill::kSIMLockStatusProperty},
353 { ::onc::cellular::kSIMPresent, shill::kSIMPresentProperty}, 348 {::onc::cellular::kSIMPresent, shill::kSIMPresentProperty},
354 { ::onc::cellular::kSupportedCarriers, shill::kSupportedCarriersProperty}, 349 {::onc::cellular::kSupportedCarriers, shill::kSupportedCarriersProperty},
355 { ::onc::cellular::kSupportNetworkScan, shill::kSupportNetworkScanProperty}, 350 {::onc::cellular::kSupportNetworkScan, shill::kSupportNetworkScanProperty},
356 {NULL}}; 351 {NULL}};
357 352
358 const FieldTranslationEntry* GetFieldTranslationTable( 353 const FieldTranslationEntry* GetFieldTranslationTable(
359 const OncValueSignature& onc_signature) { 354 const OncValueSignature& onc_signature) {
360 for (const OncValueTranslationEntry* it = onc_value_translation_table; 355 for (const OncValueTranslationEntry* it = onc_value_translation_table;
361 it->onc_signature != NULL; ++it) { 356 it->onc_signature != NULL; ++it) {
362 if (it->onc_signature == &onc_signature) 357 if (it->onc_signature == &onc_signature)
363 return it->field_translation_table; 358 return it->field_translation_table;
364 } 359 }
365 return NULL; 360 return NULL;
(...skipping 11 matching lines...) Expand all
377 } 372 }
378 break; 373 break;
379 } 374 }
380 } 375 }
381 return shill_property_path; 376 return shill_property_path;
382 } 377 }
383 378
384 bool GetShillPropertyName(const std::string& onc_field_name, 379 bool GetShillPropertyName(const std::string& onc_field_name,
385 const FieldTranslationEntry table[], 380 const FieldTranslationEntry table[],
386 std::string* shill_property_name) { 381 std::string* shill_property_name) {
387 for (const FieldTranslationEntry* it = table; 382 for (const FieldTranslationEntry* it = table; it->onc_field_name != NULL;
388 it->onc_field_name != NULL; ++it) { 383 ++it) {
389 if (it->onc_field_name != onc_field_name) 384 if (it->onc_field_name != onc_field_name)
390 continue; 385 continue;
391 *shill_property_name = it->shill_property_name; 386 *shill_property_name = it->shill_property_name;
392 return true; 387 return true;
393 } 388 }
394 return false; 389 return false;
395 } 390 }
396 391
397 bool TranslateStringToShill(const StringTranslationEntry table[], 392 bool TranslateStringToShill(const StringTranslationEntry table[],
398 const std::string& onc_value, 393 const std::string& onc_value,
(...skipping 16 matching lines...) Expand all
415 continue; 410 continue;
416 *onc_value = table[i].onc_value; 411 *onc_value = table[i].onc_value;
417 return true; 412 return true;
418 } 413 }
419 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; 414 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC";
420 return false; 415 return false;
421 } 416 }
422 417
423 } // namespace onc 418 } // namespace onc
424 } // namespace chromeos 419 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_signature.cc ('k') | chromeos/network/onc/onc_translator_onc_to_shill.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698