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
3 // found in the LICENSE file.
5 #include "chromeos/network/onc/onc_signature.h"
7 #include "components/onc/onc_constants.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
16 const OncValueSignature kBoolSignature
= {
17 base::Value::TYPE_BOOLEAN
, NULL
19 const OncValueSignature kStringSignature
= {
20 base::Value::TYPE_STRING
, NULL
22 const OncValueSignature kIntegerSignature
= {
23 base::Value::TYPE_INTEGER
, NULL
25 const OncValueSignature kDoubleSignature
= {
26 base::Value::TYPE_DOUBLE
, NULL
28 const OncValueSignature kStringListSignature
= {
29 base::Value::TYPE_LIST
, NULL
, &kStringSignature
31 const OncValueSignature kIntegerListSignature
= {
32 base::Value::TYPE_LIST
, NULL
, &kIntegerSignature
34 const OncValueSignature kIPConfigListSignature
= {
35 base::Value::TYPE_LIST
, NULL
, &kIPConfigSignature
37 const OncValueSignature kCellularApnListSignature
= {
38 base::Value::TYPE_LIST
, NULL
, &kCellularApnSignature
40 const OncValueSignature kCellularFoundNetworkListSignature
= {
41 base::Value::TYPE_LIST
, NULL
, &kCellularFoundNetworkSignature
44 const OncFieldSignature issuer_subject_pattern_fields
[] = {
45 { ::onc::client_cert::kCommonName
, &kStringSignature
},
46 { ::onc::client_cert::kLocality
, &kStringSignature
},
47 { ::onc::client_cert::kOrganization
, &kStringSignature
},
48 { ::onc::client_cert::kOrganizationalUnit
, &kStringSignature
},
51 const OncFieldSignature certificate_pattern_fields
[] = {
52 { ::onc::kRecommended
, &kRecommendedSignature
},
53 { ::onc::client_cert::kEnrollmentURI
, &kStringListSignature
},
54 { ::onc::client_cert::kIssuer
, &kIssuerSubjectPatternSignature
},
55 { ::onc::client_cert::kIssuerCARef
, &kStringListSignature
},
56 // Used internally. Not officially supported.
57 { ::onc::client_cert::kIssuerCAPEMs
, &kStringListSignature
},
58 { ::onc::client_cert::kSubject
, &kIssuerSubjectPatternSignature
},
61 const OncFieldSignature eap_fields
[] = {
62 { ::onc::kRecommended
, &kRecommendedSignature
},
63 { ::onc::eap::kAnonymousIdentity
, &kStringSignature
},
64 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
65 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
66 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
67 { ::onc::eap::kIdentity
, &kStringSignature
},
68 { ::onc::eap::kInner
, &kStringSignature
},
69 { ::onc::eap::kOuter
, &kStringSignature
},
70 { ::onc::eap::kPassword
, &kStringSignature
},
71 { ::onc::eap::kSaveCredentials
, &kBoolSignature
},
72 // Used internally. Not officially supported.
73 { ::onc::eap::kServerCAPEMs
, &kStringListSignature
},
74 { ::onc::eap::kServerCARef
, &kStringSignature
},
75 { ::onc::eap::kServerCARefs
, &kStringListSignature
},
76 { ::onc::eap::kUseSystemCAs
, &kBoolSignature
},
79 const OncFieldSignature ipsec_fields
[] = {
80 { ::onc::kRecommended
, &kRecommendedSignature
},
81 { ::onc::ipsec::kAuthenticationType
, &kStringSignature
},
82 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
83 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
84 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
85 { ::onc::ipsec::kGroup
, &kStringSignature
},
86 { ::onc::ipsec::kIKEVersion
, &kIntegerSignature
},
87 { ::onc::ipsec::kPSK
, &kStringSignature
},
88 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
89 // Used internally. Not officially supported.
90 { ::onc::ipsec::kServerCAPEMs
, &kStringListSignature
},
91 { ::onc::ipsec::kServerCARef
, &kStringSignature
},
92 { ::onc::ipsec::kServerCARefs
, &kStringListSignature
},
93 { ::onc::ipsec::kXAUTH
, &kXAUTHSignature
},
95 // { ipsec::kEAP, &kEAPSignature },
98 const OncFieldSignature xauth_fields
[] = {
99 { ::onc::vpn::kPassword
, &kStringSignature
},
100 { ::onc::vpn::kUsername
, &kStringSignature
},
103 const OncFieldSignature l2tp_fields
[] = {
104 { ::onc::kRecommended
, &kRecommendedSignature
},
105 { ::onc::vpn::kPassword
, &kStringSignature
},
106 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
107 { ::onc::vpn::kUsername
, &kStringSignature
},
110 const OncFieldSignature openvpn_fields
[] = {
111 { ::onc::kRecommended
, &kRecommendedSignature
},
112 { ::onc::openvpn::kAuth
, &kStringSignature
},
113 { ::onc::openvpn::kAuthNoCache
, &kBoolSignature
},
114 { ::onc::openvpn::kAuthRetry
, &kStringSignature
},
115 { ::onc::openvpn::kCipher
, &kStringSignature
},
116 { ::onc::client_cert::kClientCertPattern
, &kCertificatePatternSignature
},
117 { ::onc::client_cert::kClientCertRef
, &kStringSignature
},
118 { ::onc::client_cert::kClientCertType
, &kStringSignature
},
119 { ::onc::openvpn::kCompLZO
, &kStringSignature
},
120 { ::onc::openvpn::kCompNoAdapt
, &kBoolSignature
},
121 { ::onc::openvpn::kIgnoreDefaultRoute
, &kBoolSignature
},
122 { ::onc::openvpn::kKeyDirection
, &kStringSignature
},
123 { ::onc::openvpn::kNsCertType
, &kStringSignature
},
124 { ::onc::openvpn::kOTP
, &kStringSignature
},
125 { ::onc::openvpn::kPassword
, &kStringSignature
},
126 { ::onc::openvpn::kPort
, &kIntegerSignature
},
127 { ::onc::openvpn::kProto
, &kStringSignature
},
128 { ::onc::openvpn::kPushPeerInfo
, &kBoolSignature
},
129 { ::onc::openvpn::kRemoteCertEKU
, &kStringSignature
},
130 { ::onc::openvpn::kRemoteCertKU
, &kStringListSignature
},
131 { ::onc::openvpn::kRemoteCertTLS
, &kStringSignature
},
132 { ::onc::openvpn::kRenegSec
, &kIntegerSignature
},
133 { ::onc::vpn::kSaveCredentials
, &kBoolSignature
},
134 // Used internally. Not officially supported.
135 { ::onc::openvpn::kServerCAPEMs
, &kStringListSignature
},
136 { ::onc::openvpn::kServerCARef
, &kStringSignature
},
137 { ::onc::openvpn::kServerCARefs
, &kStringListSignature
},
138 // Not supported, yet.
139 { ::onc::openvpn::kServerCertPEM
, &kStringSignature
},
140 { ::onc::openvpn::kServerCertRef
, &kStringSignature
},
141 { ::onc::openvpn::kServerPollTimeout
, &kIntegerSignature
},
142 { ::onc::openvpn::kShaper
, &kIntegerSignature
},
143 { ::onc::openvpn::kStaticChallenge
, &kStringSignature
},
144 { ::onc::openvpn::kTLSAuthContents
, &kStringSignature
},
145 { ::onc::openvpn::kTLSRemote
, &kStringSignature
},
146 { ::onc::openvpn::kUserAuthenticationType
, &kStringSignature
},
147 { ::onc::vpn::kUsername
, &kStringSignature
},
148 // Not supported, yet.
149 { ::onc::openvpn::kVerb
, &kStringSignature
},
150 { ::onc::openvpn::kVerifyHash
, &kStringSignature
},
151 { ::onc::openvpn::kVerifyX509
, &kVerifyX509Signature
},
154 const OncFieldSignature verify_x509_fields
[] = {
155 { ::onc::verify_x509::kName
, &kStringSignature
},
156 { ::onc::verify_x509::kType
, &kStringSignature
},
159 const OncFieldSignature vpn_fields
[] = {
160 { ::onc::kRecommended
, &kRecommendedSignature
},
161 { ::onc::vpn::kAutoConnect
, &kBoolSignature
},
162 { ::onc::vpn::kHost
, &kStringSignature
},
163 { ::onc::vpn::kIPsec
, &kIPsecSignature
},
164 { ::onc::vpn::kL2TP
, &kL2TPSignature
},
165 { ::onc::vpn::kOpenVPN
, &kOpenVPNSignature
},
166 { ::onc::vpn::kType
, &kStringSignature
},
169 const OncFieldSignature ethernet_fields
[] = {
170 { ::onc::kRecommended
, &kRecommendedSignature
},
171 { ::onc::ethernet::kAuthentication
, &kStringSignature
},
172 { ::onc::ethernet::kEAP
, &kEAPSignature
},
175 const OncFieldSignature ipconfig_fields
[] = {
176 { ::onc::ipconfig::kGateway
, &kStringSignature
},
177 { ::onc::ipconfig::kIPAddress
, &kStringSignature
},
178 { ::onc::ipconfig::kNameServers
, &kStringListSignature
},
179 { ::onc::ipconfig::kRoutingPrefix
, &kIntegerSignature
},
180 { ::onc::network_config::kSearchDomains
, &kStringListSignature
},
181 { ::onc::ipconfig::kType
, &kStringSignature
},
182 { ::onc::ipconfig::kWebProxyAutoDiscoveryUrl
, &kStringSignature
},
185 const OncFieldSignature proxy_location_fields
[] = {
186 { ::onc::proxy::kHost
, &kStringSignature
},
187 { ::onc::proxy::kPort
, &kIntegerSignature
}, {NULL
}};
189 const OncFieldSignature proxy_manual_fields
[] = {
190 { ::onc::proxy::kFtp
, &kProxyLocationSignature
},
191 { ::onc::proxy::kHttp
, &kProxyLocationSignature
},
192 { ::onc::proxy::kHttps
, &kProxyLocationSignature
},
193 { ::onc::proxy::kSocks
, &kProxyLocationSignature
},
196 const OncFieldSignature proxy_settings_fields
[] = {
197 { ::onc::kRecommended
, &kRecommendedSignature
},
198 { ::onc::proxy::kExcludeDomains
, &kStringListSignature
},
199 { ::onc::proxy::kManual
, &kProxyManualSignature
},
200 { ::onc::proxy::kPAC
, &kStringSignature
},
201 { ::onc::proxy::kType
, &kStringSignature
},
204 const OncFieldSignature wifi_fields
[] = {
205 { ::onc::kRecommended
, &kRecommendedSignature
},
206 { ::onc::wifi::kAllowGatewayARPPolling
, &kBoolSignature
},
207 { ::onc::wifi::kAutoConnect
, &kBoolSignature
},
208 { ::onc::wifi::kEAP
, &kEAPSignature
},
209 { ::onc::wifi::kHiddenSSID
, &kBoolSignature
},
210 { ::onc::wifi::kPassphrase
, &kStringSignature
},
211 { ::onc::wifi::kSSID
, &kStringSignature
},
212 { ::onc::wifi::kSecurity
, &kStringSignature
},
215 const OncFieldSignature wifi_with_state_fields
[] = {
216 { ::onc::wifi::kBSSID
, &kStringSignature
},
217 { ::onc::wifi::kFrequency
, &kIntegerSignature
},
218 { ::onc::wifi::kFrequencyList
, &kIntegerListSignature
},
219 { ::onc::wifi::kSignalStrength
, &kIntegerSignature
},
222 const OncFieldSignature wimax_fields
[] = {
223 { ::onc::kRecommended
, &kRecommendedSignature
},
224 { ::onc::wimax::kAutoConnect
, &kBoolSignature
},
225 { ::onc::wimax::kEAP
, &kEAPSignature
},
228 const OncFieldSignature wimax_with_state_fields
[] = {
229 { ::onc::wimax::kSignalStrength
, &kIntegerSignature
},
232 const OncFieldSignature cellular_provider_fields
[] = {
233 { ::onc::cellular_provider::kCode
, &kStringSignature
},
234 { ::onc::cellular_provider::kCountry
, &kStringSignature
},
235 { ::onc::cellular_provider::kName
, &kStringSignature
},
238 const OncFieldSignature cellular_apn_fields
[] = {
239 { ::onc::cellular_apn::kAccessPointName
, &kStringSignature
},
240 { ::onc::cellular_apn::kName
, &kStringSignature
},
241 { ::onc::cellular_apn::kUsername
, &kStringSignature
},
242 { ::onc::cellular_apn::kPassword
, &kStringSignature
},
243 { ::onc::cellular_apn::kLocalizedName
, &kStringSignature
},
244 { ::onc::cellular_apn::kLanguage
, &kStringSignature
},
247 const OncFieldSignature cellular_found_network_fields
[] = {
248 { ::onc::cellular_found_network::kStatus
, &kStringSignature
},
249 { ::onc::cellular_found_network::kNetworkId
, &kStringSignature
},
250 { ::onc::cellular_found_network::kShortName
, &kStringSignature
},
251 { ::onc::cellular_found_network::kLongName
, &kStringSignature
},
252 { ::onc::cellular_found_network::kTechnology
, &kStringSignature
},
255 const OncFieldSignature sim_lock_status_fields
[] = {
256 { ::onc::sim_lock_status::kLockEnabled
, &kBoolSignature
},
257 { ::onc::sim_lock_status::kLockType
, &kStringSignature
},
258 { ::onc::sim_lock_status::kRetriesLeft
, &kDoubleSignature
},
261 const OncFieldSignature cellular_fields
[] = {
262 { ::onc::kRecommended
, &kRecommendedSignature
},
263 { ::onc::cellular::kAPN
, &kCellularApnSignature
},
264 { ::onc::cellular::kAPNList
, &kCellularApnListSignature
},
265 { ::onc::vpn::kAutoConnect
, &kBoolSignature
},
268 const OncFieldSignature cellular_with_state_fields
[] = {
269 { ::onc::cellular::kActivationType
, &kStringSignature
},
270 { ::onc::cellular::kActivationState
, &kStringSignature
},
271 { ::onc::cellular::kAllowRoaming
, &kBoolSignature
},
272 { ::onc::cellular::kCarrier
, &kStringSignature
},
273 { ::onc::cellular::kESN
, &kStringSignature
},
274 { ::onc::cellular::kFamily
, &kStringSignature
},
275 { ::onc::cellular::kFirmwareRevision
, &kStringSignature
},
276 { ::onc::cellular::kFoundNetworks
, &kCellularFoundNetworkListSignature
},
277 { ::onc::cellular::kHardwareRevision
, &kStringSignature
},
278 { ::onc::cellular::kHomeProvider
, &kCellularProviderSignature
},
279 { ::onc::cellular::kICCID
, &kStringSignature
},
280 { ::onc::cellular::kIMEI
, &kStringSignature
},
281 { ::onc::cellular::kIMSI
, &kStringSignature
},
282 { ::onc::cellular::kLastGoodAPN
, &kCellularApnSignature
},
283 { ::onc::cellular::kManufacturer
, &kStringSignature
},
284 { ::onc::cellular::kMDN
, &kStringSignature
},
285 { ::onc::cellular::kMEID
, &kStringSignature
},
286 { ::onc::cellular::kMIN
, &kStringSignature
},
287 { ::onc::cellular::kModelID
, &kStringSignature
},
288 { ::onc::cellular::kNetworkTechnology
, &kStringSignature
},
289 { ::onc::cellular::kPRLVersion
, &kIntegerSignature
},
290 { ::onc::cellular::kProviderRequiresRoaming
, &kBoolSignature
},
291 { ::onc::cellular::kRoamingState
, &kStringSignature
},
292 { ::onc::cellular::kServingOperator
, &kCellularProviderSignature
},
293 { ::onc::cellular::kSIMLockStatus
, &kSIMLockStatusSignature
},
294 { ::onc::cellular::kSIMPresent
, &kBoolSignature
},
295 { ::onc::cellular::kSupportNetworkScan
, &kBoolSignature
},
296 { ::onc::cellular::kSupportedCarriers
, &kStringListSignature
},
299 const OncFieldSignature network_configuration_fields
[] = {
300 { ::onc::network_config::kCellular
, &kCellularSignature
},
301 { ::onc::network_config::kEthernet
, &kEthernetSignature
},
302 { ::onc::network_config::kGUID
, &kStringSignature
},
304 { ::onc::network_config::kName
, &kStringSignature
},
306 // Not supported, yet.
307 { ::onc::network_config::kNameServers
, &kStringListSignature
},
309 { ::onc::network_config::kPriority
, &kIntegerSignature
},
310 { ::onc::network_config::kProxySettings
, &kProxySettingsSignature
},
311 { ::onc::kRecommended
, &kRecommendedSignature
},
312 { ::onc::kRemove
, &kBoolSignature
},
314 // Not supported, yet.
315 { ::onc::network_config::kSearchDomains
, &kStringListSignature
},
317 { ::onc::network_config::kStaticIPConfig
, &kStaticIPConfigSignature
},
318 { ::onc::network_config::kType
, &kStringSignature
},
319 { ::onc::network_config::kVPN
, &kVPNSignature
},
320 { ::onc::network_config::kWiFi
, &kWiFiSignature
},
321 { ::onc::network_config::kWimax
, &kWiMAXSignature
},
324 const OncFieldSignature network_with_state_fields
[] = {
325 { ::onc::network_config::kCellular
, &kCellularWithStateSignature
},
326 { ::onc::network_config::kConnectionState
, &kStringSignature
},
327 { ::onc::network_config::kConnectable
, &kBoolSignature
},
328 { ::onc::network_config::kErrorState
, &kStringSignature
},
329 { ::onc::network_config::kIPConfigs
, &kIPConfigListSignature
},
330 { ::onc::network_config::kMacAddress
, &kStringSignature
},
331 { ::onc::network_config::kRestrictedConnectivity
, &kBoolSignature
},
332 { ::onc::network_config::kSavedIPConfig
, &kSavedIPConfigSignature
},
333 { ::onc::network_config::kSource
, &kStringSignature
},
334 { ::onc::network_config::kWiFi
, &kWiFiWithStateSignature
},
335 { ::onc::network_config::kWimax
, &kWiMAXWithStateSignature
},
338 const OncFieldSignature global_network_configuration_fields
[] = {
339 { ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect
,
343 const OncFieldSignature certificate_fields
[] = {
344 { ::onc::certificate::kGUID
, &kStringSignature
},
345 { ::onc::certificate::kPKCS12
, &kStringSignature
},
346 { ::onc::kRemove
, &kBoolSignature
},
347 { ::onc::certificate::kTrustBits
, &kStringListSignature
},
348 { ::onc::certificate::kType
, &kStringSignature
},
349 { ::onc::certificate::kX509
, &kStringSignature
},
352 const OncFieldSignature toplevel_configuration_fields
[] = {
353 { ::onc::toplevel_config::kCertificates
, &kCertificateListSignature
},
354 { ::onc::toplevel_config::kNetworkConfigurations
,
355 &kNetworkConfigurationListSignature
},
356 { ::onc::toplevel_config::kGlobalNetworkConfiguration
,
357 &kGlobalNetworkConfigurationSignature
},
358 { ::onc::toplevel_config::kType
, &kStringSignature
},
359 { ::onc::encrypted::kCipher
, &kStringSignature
},
360 { ::onc::encrypted::kCiphertext
, &kStringSignature
},
361 { ::onc::encrypted::kHMAC
, &kStringSignature
},
362 { ::onc::encrypted::kHMACMethod
, &kStringSignature
},
363 { ::onc::encrypted::kIV
, &kStringSignature
},
364 { ::onc::encrypted::kIterations
, &kIntegerSignature
},
365 { ::onc::encrypted::kSalt
, &kStringSignature
},
366 { ::onc::encrypted::kStretch
, &kStringSignature
}, {NULL
}};
370 const OncValueSignature kRecommendedSignature
= {
371 base::Value::TYPE_LIST
, NULL
, &kStringSignature
373 const OncValueSignature kEAPSignature
= {
374 base::Value::TYPE_DICTIONARY
, eap_fields
, NULL
376 const OncValueSignature kIssuerSubjectPatternSignature
= {
377 base::Value::TYPE_DICTIONARY
, issuer_subject_pattern_fields
, NULL
379 const OncValueSignature kCertificatePatternSignature
= {
380 base::Value::TYPE_DICTIONARY
, certificate_pattern_fields
, NULL
382 const OncValueSignature kIPsecSignature
= {
383 base::Value::TYPE_DICTIONARY
, ipsec_fields
, NULL
385 const OncValueSignature kXAUTHSignature
= {
386 base::Value::TYPE_DICTIONARY
, xauth_fields
, NULL
388 const OncValueSignature kL2TPSignature
= {
389 base::Value::TYPE_DICTIONARY
, l2tp_fields
, NULL
391 const OncValueSignature kOpenVPNSignature
= {
392 base::Value::TYPE_DICTIONARY
, openvpn_fields
, NULL
394 const OncValueSignature kVerifyX509Signature
= {
395 base::Value::TYPE_DICTIONARY
, verify_x509_fields
, NULL
397 const OncValueSignature kVPNSignature
= {
398 base::Value::TYPE_DICTIONARY
, vpn_fields
, NULL
400 const OncValueSignature kEthernetSignature
= {
401 base::Value::TYPE_DICTIONARY
, ethernet_fields
, NULL
403 const OncValueSignature kIPConfigSignature
= {
404 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
406 const OncValueSignature kSavedIPConfigSignature
= {
407 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
409 const OncValueSignature kStaticIPConfigSignature
= {
410 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
412 const OncValueSignature kProxyLocationSignature
= {
413 base::Value::TYPE_DICTIONARY
, proxy_location_fields
, NULL
415 const OncValueSignature kProxyManualSignature
= {
416 base::Value::TYPE_DICTIONARY
, proxy_manual_fields
, NULL
418 const OncValueSignature kProxySettingsSignature
= {
419 base::Value::TYPE_DICTIONARY
, proxy_settings_fields
, NULL
421 const OncValueSignature kWiFiSignature
= {
422 base::Value::TYPE_DICTIONARY
, wifi_fields
, NULL
424 const OncValueSignature kWiMAXSignature
= {
425 base::Value::TYPE_DICTIONARY
, wimax_fields
, NULL
427 const OncValueSignature kCertificateSignature
= {
428 base::Value::TYPE_DICTIONARY
, certificate_fields
, NULL
430 const OncValueSignature kNetworkConfigurationSignature
= {
431 base::Value::TYPE_DICTIONARY
, network_configuration_fields
, NULL
433 const OncValueSignature kGlobalNetworkConfigurationSignature
= {
434 base::Value::TYPE_DICTIONARY
, global_network_configuration_fields
, NULL
436 const OncValueSignature kCertificateListSignature
= {
437 base::Value::TYPE_LIST
, NULL
, &kCertificateSignature
439 const OncValueSignature kNetworkConfigurationListSignature
= {
440 base::Value::TYPE_LIST
, NULL
, &kNetworkConfigurationSignature
442 const OncValueSignature kToplevelConfigurationSignature
= {
443 base::Value::TYPE_DICTIONARY
, toplevel_configuration_fields
, NULL
446 // Derived "ONC with State" signatures.
447 const OncValueSignature kNetworkWithStateSignature
= {
448 base::Value::TYPE_DICTIONARY
, network_with_state_fields
, NULL
,
449 &kNetworkConfigurationSignature
451 const OncValueSignature kWiFiWithStateSignature
= {
452 base::Value::TYPE_DICTIONARY
, wifi_with_state_fields
, NULL
, &kWiFiSignature
454 const OncValueSignature kWiMAXWithStateSignature
= {
455 base::Value::TYPE_DICTIONARY
, wimax_with_state_fields
, NULL
, &kWiMAXSignature
457 const OncValueSignature kCellularSignature
= {
458 base::Value::TYPE_DICTIONARY
, cellular_fields
, NULL
460 const OncValueSignature kCellularWithStateSignature
= {
461 base::Value::TYPE_DICTIONARY
, cellular_with_state_fields
, NULL
,
464 const OncValueSignature kCellularProviderSignature
= {
465 base::Value::TYPE_DICTIONARY
, cellular_provider_fields
, NULL
467 const OncValueSignature kCellularApnSignature
= {
468 base::Value::TYPE_DICTIONARY
, cellular_apn_fields
, NULL
470 const OncValueSignature kCellularFoundNetworkSignature
= {
471 base::Value::TYPE_DICTIONARY
, cellular_found_network_fields
, NULL
473 const OncValueSignature kSIMLockStatusSignature
= {
474 base::Value::TYPE_DICTIONARY
, sim_lock_status_fields
, NULL
477 const OncFieldSignature
* GetFieldSignature(const OncValueSignature
& signature
,
478 const std::string
& onc_field_name
) {
479 if (!signature
.fields
)
481 for (const OncFieldSignature
* field_signature
= signature
.fields
;
482 field_signature
->onc_field_name
!= NULL
; ++field_signature
) {
483 if (onc_field_name
== field_signature
->onc_field_name
)
484 return field_signature
;
486 if (signature
.base_signature
)
487 return GetFieldSignature(*signature
.base_signature
, onc_field_name
);
493 struct CredentialEntry
{
494 const OncValueSignature
* value_signature
;
495 const char* field_name
;
498 const CredentialEntry credentials
[] = {
499 {&kEAPSignature
, ::onc::eap::kPassword
},
500 {&kIPsecSignature
, ::onc::ipsec::kPSK
},
501 {&kXAUTHSignature
, ::onc::vpn::kPassword
},
502 {&kL2TPSignature
, ::onc::vpn::kPassword
},
503 {&kOpenVPNSignature
, ::onc::vpn::kPassword
},
504 {&kOpenVPNSignature
, ::onc::openvpn::kTLSAuthContents
},
505 {&kWiFiSignature
, ::onc::wifi::kPassphrase
},
506 {&kCellularApnSignature
, ::onc::cellular_apn::kPassword
},
511 bool FieldIsCredential(const OncValueSignature
& signature
,
512 const std::string
& onc_field_name
) {
513 for (const CredentialEntry
* entry
= credentials
;
514 entry
->value_signature
!= NULL
; ++entry
) {
515 if (&signature
== entry
->value_signature
&&
516 onc_field_name
== entry
->field_name
) {
524 } // namespace chromeos