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

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

Issue 11664005: Extending the translation from ONC to Shill. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Initial patch. Created 7 years, 12 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_signature.h" 5 #include "chromeos/network/onc/onc_signature.h"
6 6
7 #include "chromeos/network/onc/onc_constants.h" 7 #include "chromeos/network/onc/onc_constants.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h" 8 #include "third_party/cros_system_api/dbus/service_constants.h"
9 9
10 using base::Value; 10 using base::Value;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 }; 47 };
48 48
49 const OncFieldSignature eap_fields[] = { 49 const OncFieldSignature eap_fields[] = {
50 { kRecommended, NULL, &kRecommendedSignature }, 50 { kRecommended, NULL, &kRecommendedSignature },
51 { eap::kAnonymousIdentity, flimflam::kEapAnonymousIdentityProperty, 51 { eap::kAnonymousIdentity, flimflam::kEapAnonymousIdentityProperty,
52 &kStringSignature }, 52 &kStringSignature },
53 { eap::kClientCertPattern, NULL, &kCertificatePatternSignature }, 53 { eap::kClientCertPattern, NULL, &kCertificatePatternSignature },
54 { eap::kClientCertRef, NULL, &kStringSignature }, 54 { eap::kClientCertRef, NULL, &kStringSignature },
55 { eap::kClientCertType, NULL, &kStringSignature }, 55 { eap::kClientCertType, NULL, &kStringSignature },
56 { eap::kIdentity, flimflam::kEapIdentityProperty, &kStringSignature }, 56 { eap::kIdentity, flimflam::kEapIdentityProperty, &kStringSignature },
57 { eap::kInner, flimflam::kEapPhase2AuthProperty, &kStringSignature }, 57 // This field is converted during translation, see onc_translator_*.
58 { eap::kOuter, flimflam::kEapMethodProperty, &kStringSignature }, 58 { eap::kInner, NULL, &kStringSignature },
59 // This field is converted during translation, see onc_translator_*.
60 { eap::kOuter, NULL, &kStringSignature },
59 { eap::kPassword, flimflam::kEapPasswordProperty, &kStringSignature }, 61 { eap::kPassword, flimflam::kEapPasswordProperty, &kStringSignature },
60 { eap::kSaveCredentials, flimflam::kSaveCredentialsProperty, 62 { eap::kSaveCredentials, flimflam::kSaveCredentialsProperty,
61 &kBoolSignature }, 63 &kBoolSignature },
62 { eap::kServerCARef, flimflam::kEapCaCertNssProperty, &kStringSignature }, 64 { eap::kServerCARef, flimflam::kEapCaCertNssProperty, &kStringSignature },
63 { eap::kUseSystemCAs, flimflam::kEapUseSystemCasProperty, &kBoolSignature }, 65 { eap::kUseSystemCAs, flimflam::kEapUseSystemCasProperty, &kBoolSignature },
64 { NULL } 66 { NULL }
65 }; 67 };
66 68
67 const OncFieldSignature ipsec_fields[] = { 69 const OncFieldSignature ipsec_fields[] = {
68 { kRecommended, NULL, &kRecommendedSignature }, 70 { kRecommended, NULL, &kRecommendedSignature },
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 { vpn::kRemoteCertEKU, flimflam::kOpenVPNRemoteCertEKUProperty, 121 { vpn::kRemoteCertEKU, flimflam::kOpenVPNRemoteCertEKUProperty,
120 &kStringSignature }, 122 &kStringSignature },
121 // This field is converted during translation, see onc_translator_*. 123 // This field is converted during translation, see onc_translator_*.
122 { vpn::kRemoteCertKU, NULL, &kStringListSignature }, 124 { vpn::kRemoteCertKU, NULL, &kStringListSignature },
123 { vpn::kRemoteCertTLS, flimflam::kOpenVPNRemoteCertTLSProperty, 125 { vpn::kRemoteCertTLS, flimflam::kOpenVPNRemoteCertTLSProperty,
124 &kStringSignature }, 126 &kStringSignature },
125 { vpn::kRenegSec, flimflam::kOpenVPNRenegSecProperty, &kIntegerSignature }, 127 { vpn::kRenegSec, flimflam::kOpenVPNRenegSecProperty, &kIntegerSignature },
126 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty, 128 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty,
127 &kBoolSignature }, 129 &kBoolSignature },
128 { vpn::kServerCARef, flimflam::kOpenVPNCaCertNSSProperty, &kStringSignature }, 130 { vpn::kServerCARef, flimflam::kOpenVPNCaCertNSSProperty, &kStringSignature },
131 // Not supported, yet.
129 { vpn::kServerCertRef, NULL, &kStringSignature }, 132 { vpn::kServerCertRef, NULL, &kStringSignature },
130 { vpn::kServerPollTimeout, flimflam::kOpenVPNServerPollTimeoutProperty, 133 { vpn::kServerPollTimeout, flimflam::kOpenVPNServerPollTimeoutProperty,
131 &kIntegerSignature }, 134 &kIntegerSignature },
132 { vpn::kShaper, flimflam::kOpenVPNShaperProperty, &kIntegerSignature }, 135 { vpn::kShaper, flimflam::kOpenVPNShaperProperty, &kIntegerSignature },
133 { vpn::kStaticChallenge, flimflam::kOpenVPNStaticChallengeProperty, 136 { vpn::kStaticChallenge, flimflam::kOpenVPNStaticChallengeProperty,
134 &kStringSignature }, 137 &kStringSignature },
135 { vpn::kTLSAuthContents, flimflam::kOpenVPNTLSAuthContentsProperty, 138 { vpn::kTLSAuthContents, flimflam::kOpenVPNTLSAuthContentsProperty,
136 &kStringSignature }, 139 &kStringSignature },
137 { vpn::kTLSRemote, flimflam::kOpenVPNTLSRemoteProperty, &kStringSignature }, 140 { vpn::kTLSRemote, flimflam::kOpenVPNTLSRemoteProperty, &kStringSignature },
138 { vpn::kUsername, flimflam::kOpenVPNUserProperty, &kStringSignature }, 141 { vpn::kUsername, flimflam::kOpenVPNUserProperty, &kStringSignature },
142 // Not supported, yet.
139 { vpn::kVerb, NULL, &kStringSignature }, 143 { vpn::kVerb, NULL, &kStringSignature },
140 { NULL } 144 { NULL }
141 }; 145 };
142 146
143 const OncFieldSignature vpn_fields[] = { 147 const OncFieldSignature vpn_fields[] = {
144 { kRecommended, NULL, &kRecommendedSignature }, 148 { kRecommended, NULL, &kRecommendedSignature },
145 { vpn::kHost, flimflam::kProviderHostProperty, &kStringSignature }, 149 { vpn::kHost, flimflam::kProviderHostProperty, &kStringSignature },
146 { vpn::kIPsec, NULL, &kIPsecSignature }, 150 { vpn::kIPsec, NULL, &kIPsecSignature },
147 { vpn::kL2TP, NULL, &kL2TPSignature }, 151 { vpn::kL2TP, NULL, &kL2TPSignature },
148 { vpn::kOpenVPN, NULL, &kOpenVPNSignature }, 152 { vpn::kOpenVPN, NULL, &kOpenVPNSignature },
149 // This field is converted during translation, see onc_translator_*. 153 // This field is converted during translation, see onc_translator_*.
150 { kType, NULL, &kStringSignature }, 154 { vpn::kType, NULL, &kStringSignature },
151 { NULL } 155 { NULL }
152 }; 156 };
153 157
154 const OncFieldSignature ethernet_fields[] = { 158 const OncFieldSignature ethernet_fields[] = {
155 { kRecommended, NULL, &kRecommendedSignature }, 159 { kRecommended, NULL, &kRecommendedSignature },
160 // Not supported, yet.
156 { ethernet::kAuthentication, NULL, &kStringSignature }, 161 { ethernet::kAuthentication, NULL, &kStringSignature },
157 { ethernet::kEAP, NULL, &kEAPSignature }, 162 { ethernet::kEAP, NULL, &kEAPSignature },
158 { NULL } 163 { NULL }
159 }; 164 };
160 165
161 const OncFieldSignature ipconfig_fields[] = { 166 const OncFieldSignature ipconfig_fields[] = {
162 { ipconfig::kGateway, NULL, &kStringSignature }, 167 { ipconfig::kGateway, NULL, &kStringSignature },
163 { ipconfig::kIPAddress, NULL, &kStringSignature }, 168 { ipconfig::kIPAddress, NULL, &kStringSignature },
164 { kNameServers, NULL, &kStringSignature }, 169 { kNameServers, NULL, &kStringSignature },
165 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, 170 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature },
166 { kSearchDomains, NULL, &kStringListSignature }, 171 { kSearchDomains, NULL, &kStringListSignature },
167 // This field is converted during translation, see onc_translator_*. 172 { ipconfig::kType, NULL, &kStringSignature },
168 { kType, NULL, &kStringSignature },
169 { NULL } 173 { NULL }
170 }; 174 };
171 175
172 const OncFieldSignature proxy_location_fields[] = { 176 const OncFieldSignature proxy_location_fields[] = {
173 { proxy::kHost, NULL, &kStringSignature }, 177 { proxy::kHost, NULL, &kStringSignature },
174 { proxy::kPort, NULL, &kIntegerSignature }, 178 { proxy::kPort, NULL, &kIntegerSignature },
175 { NULL } 179 { NULL }
176 }; 180 };
177 181
178 const OncFieldSignature proxy_manual_fields[] = { 182 const OncFieldSignature proxy_manual_fields[] = {
179 { proxy::kFtp, NULL, &kProxyLocationSignature }, 183 { proxy::kFtp, NULL, &kProxyLocationSignature },
180 { proxy::kHttp, NULL, &kProxyLocationSignature }, 184 { proxy::kHttp, NULL, &kProxyLocationSignature },
181 { proxy::kHttps, NULL, &kProxyLocationSignature }, 185 { proxy::kHttps, NULL, &kProxyLocationSignature },
182 { proxy::kSocks, NULL, &kProxyLocationSignature }, 186 { proxy::kSocks, NULL, &kProxyLocationSignature },
183 { NULL } 187 { NULL }
184 }; 188 };
185 189
186 const OncFieldSignature proxy_settings_fields[] = { 190 const OncFieldSignature proxy_settings_fields[] = {
187 { kRecommended, NULL, &kRecommendedSignature }, 191 { kRecommended, NULL, &kRecommendedSignature },
188 { proxy::kExcludeDomains, NULL, &kStringListSignature }, 192 { proxy::kExcludeDomains, NULL, &kStringListSignature },
189 { proxy::kManual, NULL, &kProxyManualSignature }, 193 { proxy::kManual, NULL, &kProxyManualSignature },
190 { proxy::kPAC, NULL, &kStringSignature }, 194 { proxy::kPAC, NULL, &kStringSignature },
191 { kType, NULL, &kStringSignature }, 195 { proxy::kType, NULL, &kStringSignature },
192 { NULL } 196 { NULL }
193 }; 197 };
194 198
195 const OncFieldSignature wifi_fields[] = { 199 const OncFieldSignature wifi_fields[] = {
196 { kRecommended, NULL, &kRecommendedSignature }, 200 { kRecommended, NULL, &kRecommendedSignature },
197 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, 201 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature },
198 { wifi::kEAP, NULL, &kEAPSignature }, 202 { wifi::kEAP, NULL, &kEAPSignature },
199 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, 203 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature },
200 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, 204 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature },
201 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, 205 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature },
202 { wifi::kSecurity, flimflam::kSecurityProperty, &kStringSignature }, 206 // This field is converted during translation, see onc_translator_*.
207 { wifi::kSecurity, NULL, &kStringSignature },
203 { NULL } 208 { NULL }
204 }; 209 };
205 210
206 const OncFieldSignature network_configuration_fields[] = { 211 const OncFieldSignature network_configuration_fields[] = {
207 { kRecommended, NULL, &kRecommendedSignature }, 212 { kRecommended, NULL, &kRecommendedSignature },
208 { kEthernet, NULL, &kEthernetSignature }, 213 { kEthernet, NULL, &kEthernetSignature },
209 { kGUID, flimflam::kGuidProperty, &kStringSignature }, 214 { kGUID, flimflam::kGuidProperty, &kStringSignature },
210 { kIPConfigs, NULL, &kIPConfigListSignature }, 215 { kIPConfigs, NULL, &kIPConfigListSignature },
211 { kName, flimflam::kNameProperty, &kStringSignature }, 216 // Shill doesn't allow setting the name for non-VPN networks.
217 // This field is conditionally translated, see onc_translator_*.
218 { kName, NULL, &kStringSignature },
212 { kNameServers, NULL, &kStringListSignature }, 219 { kNameServers, NULL, &kStringListSignature },
213 { kProxySettings, NULL, &kProxySettingsSignature }, 220 { kProxySettings, NULL, &kProxySettingsSignature },
214 { kRemove, NULL, &kBoolSignature }, 221 { kRemove, NULL, &kBoolSignature },
215 { kSearchDomains, NULL, &kStringListSignature }, 222 { kSearchDomains, NULL, &kStringListSignature },
216 // This field is converted during translation, see onc_translator_*. 223 // This field is converted during translation, see onc_translator_*.
217 { kType, NULL, &kStringSignature }, 224 { kType, NULL, &kStringSignature },
218 { kVPN, NULL, &kVPNSignature }, 225 { kVPN, NULL, &kVPNSignature },
219 { kWiFi, NULL, &kWiFiSignature }, 226 { kWiFi, NULL, &kWiFiSignature },
220 { NULL } 227 { NULL }
221 }; 228 };
222 229
223 const OncFieldSignature certificate_fields[] = { 230 const OncFieldSignature certificate_fields[] = {
224 { kGUID, flimflam::kGuidProperty, &kStringSignature }, 231 { kGUID, flimflam::kGuidProperty, &kStringSignature },
225 { certificate::kPKCS12, NULL, &kStringSignature }, 232 { certificate::kPKCS12, NULL, &kStringSignature },
226 { kRemove, NULL, &kBoolSignature }, 233 { kRemove, NULL, &kBoolSignature },
227 { certificate::kTrust, NULL, &kStringListSignature }, 234 { certificate::kTrust, NULL, &kStringListSignature },
228 { kType, NULL, &kStringSignature }, 235 { certificate::kType, NULL, &kStringSignature },
229 { certificate::kX509, NULL, &kStringSignature }, 236 { certificate::kX509, NULL, &kStringSignature },
230 { NULL } 237 { NULL }
231 }; 238 };
232 239
233 const OncFieldSignature toplevel_configuration_fields[] = { 240 const OncFieldSignature toplevel_configuration_fields[] = {
234 { kCertificates, NULL, &kCertificateListSignature }, 241 { kCertificates, NULL, &kCertificateListSignature },
235 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, 242 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature },
236 { kType, NULL, &kStringSignature }, 243 { kType, NULL, &kStringSignature },
237 { encrypted::kCipher, NULL, &kStringSignature }, 244 { encrypted::kCipher, NULL, &kStringSignature },
238 { encrypted::kCiphertext, NULL, &kStringSignature }, 245 { encrypted::kCiphertext, NULL, &kStringSignature },
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 for (const OncFieldSignature* field_signature = signature.fields; 319 for (const OncFieldSignature* field_signature = signature.fields;
313 field_signature->onc_field_name != NULL; ++field_signature) { 320 field_signature->onc_field_name != NULL; ++field_signature) {
314 if (onc_field_name == field_signature->onc_field_name) 321 if (onc_field_name == field_signature->onc_field_name)
315 return field_signature; 322 return field_signature;
316 } 323 }
317 return NULL; 324 return NULL;
318 } 325 }
319 326
320 } // namespace onc 327 } // namespace onc
321 } // namespace chromeos 328 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698