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::ipconfig::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::kHexSSID
, &kStringSignature
},
210 { ::onc::wifi::kHiddenSSID
, &kBoolSignature
},
211 { ::onc::wifi::kPassphrase
, &kStringSignature
},
212 { ::onc::wifi::kSSID
, &kStringSignature
},
213 { ::onc::wifi::kSecurity
, &kStringSignature
},
216 const OncFieldSignature wifi_with_state_fields
[] = {
217 { ::onc::wifi::kBSSID
, &kStringSignature
},
218 { ::onc::wifi::kFrequency
, &kIntegerSignature
},
219 { ::onc::wifi::kFrequencyList
, &kIntegerListSignature
},
220 { ::onc::wifi::kSignalStrength
, &kIntegerSignature
},
223 const OncFieldSignature wimax_fields
[] = {
224 { ::onc::kRecommended
, &kRecommendedSignature
},
225 { ::onc::wimax::kAutoConnect
, &kBoolSignature
},
226 { ::onc::wimax::kEAP
, &kEAPSignature
},
229 const OncFieldSignature wimax_with_state_fields
[] = {
230 { ::onc::wimax::kSignalStrength
, &kIntegerSignature
},
233 const OncFieldSignature cellular_provider_fields
[] = {
234 { ::onc::cellular_provider::kCode
, &kStringSignature
},
235 { ::onc::cellular_provider::kCountry
, &kStringSignature
},
236 { ::onc::cellular_provider::kName
, &kStringSignature
},
239 const OncFieldSignature cellular_apn_fields
[] = {
240 { ::onc::cellular_apn::kAccessPointName
, &kStringSignature
},
241 { ::onc::cellular_apn::kName
, &kStringSignature
},
242 { ::onc::cellular_apn::kUsername
, &kStringSignature
},
243 { ::onc::cellular_apn::kPassword
, &kStringSignature
},
244 { ::onc::cellular_apn::kLocalizedName
, &kStringSignature
},
245 { ::onc::cellular_apn::kLanguage
, &kStringSignature
},
248 const OncFieldSignature cellular_found_network_fields
[] = {
249 { ::onc::cellular_found_network::kStatus
, &kStringSignature
},
250 { ::onc::cellular_found_network::kNetworkId
, &kStringSignature
},
251 { ::onc::cellular_found_network::kShortName
, &kStringSignature
},
252 { ::onc::cellular_found_network::kLongName
, &kStringSignature
},
253 { ::onc::cellular_found_network::kTechnology
, &kStringSignature
},
256 const OncFieldSignature sim_lock_status_fields
[] = {
257 { ::onc::sim_lock_status::kLockEnabled
, &kBoolSignature
},
258 { ::onc::sim_lock_status::kLockType
, &kStringSignature
},
259 { ::onc::sim_lock_status::kRetriesLeft
, &kDoubleSignature
},
262 const OncFieldSignature cellular_fields
[] = {
263 { ::onc::kRecommended
, &kRecommendedSignature
},
264 { ::onc::cellular::kAPN
, &kCellularApnSignature
},
265 { ::onc::cellular::kAPNList
, &kCellularApnListSignature
},
266 { ::onc::vpn::kAutoConnect
, &kBoolSignature
},
269 const OncFieldSignature cellular_with_state_fields
[] = {
270 { ::onc::cellular::kActivationType
, &kStringSignature
},
271 { ::onc::cellular::kActivationState
, &kStringSignature
},
272 { ::onc::cellular::kAllowRoaming
, &kBoolSignature
},
273 { ::onc::cellular::kCarrier
, &kStringSignature
},
274 { ::onc::cellular::kESN
, &kStringSignature
},
275 { ::onc::cellular::kFamily
, &kStringSignature
},
276 { ::onc::cellular::kFirmwareRevision
, &kStringSignature
},
277 { ::onc::cellular::kFoundNetworks
, &kCellularFoundNetworkListSignature
},
278 { ::onc::cellular::kHardwareRevision
, &kStringSignature
},
279 { ::onc::cellular::kHomeProvider
, &kCellularProviderSignature
},
280 { ::onc::cellular::kICCID
, &kStringSignature
},
281 { ::onc::cellular::kIMEI
, &kStringSignature
},
282 { ::onc::cellular::kIMSI
, &kStringSignature
},
283 { ::onc::cellular::kLastGoodAPN
, &kCellularApnSignature
},
284 { ::onc::cellular::kManufacturer
, &kStringSignature
},
285 { ::onc::cellular::kMDN
, &kStringSignature
},
286 { ::onc::cellular::kMEID
, &kStringSignature
},
287 { ::onc::cellular::kMIN
, &kStringSignature
},
288 { ::onc::cellular::kModelID
, &kStringSignature
},
289 { ::onc::cellular::kNetworkTechnology
, &kStringSignature
},
290 { ::onc::cellular::kPRLVersion
, &kIntegerSignature
},
291 { ::onc::cellular::kRoamingState
, &kStringSignature
},
292 { ::onc::cellular::kServingOperator
, &kCellularProviderSignature
},
293 { ::onc::cellular::kSignalStrength
, &kIntegerSignature
},
294 { ::onc::cellular::kSIMLockStatus
, &kSIMLockStatusSignature
},
295 { ::onc::cellular::kSIMPresent
, &kBoolSignature
},
296 { ::onc::cellular::kSupportNetworkScan
, &kBoolSignature
},
297 { ::onc::cellular::kSupportedCarriers
, &kStringListSignature
},
300 const OncFieldSignature network_configuration_fields
[] = {
301 { ::onc::network_config::kCellular
, &kCellularSignature
},
302 { ::onc::network_config::kEthernet
, &kEthernetSignature
},
303 { ::onc::network_config::kGUID
, &kStringSignature
},
304 { ::onc::network_config::kIPAddressConfigType
, &kStringSignature
},
305 { ::onc::network_config::kName
, &kStringSignature
},
306 { ::onc::network_config::kNameServersConfigType
, &kStringSignature
},
307 { ::onc::network_config::kPriority
, &kIntegerSignature
},
308 { ::onc::network_config::kProxySettings
, &kProxySettingsSignature
},
309 { ::onc::kRecommended
, &kRecommendedSignature
},
310 { ::onc::kRemove
, &kBoolSignature
},
311 { ::onc::network_config::kStaticIPConfig
, &kStaticIPConfigSignature
},
312 { ::onc::network_config::kType
, &kStringSignature
},
313 { ::onc::network_config::kVPN
, &kVPNSignature
},
314 { ::onc::network_config::kWiFi
, &kWiFiSignature
},
315 { ::onc::network_config::kWimax
, &kWiMAXSignature
},
318 const OncFieldSignature network_with_state_fields
[] = {
319 { ::onc::network_config::kCellular
, &kCellularWithStateSignature
},
320 { ::onc::network_config::kConnectionState
, &kStringSignature
},
321 { ::onc::network_config::kConnectable
, &kBoolSignature
},
322 { ::onc::network_config::kErrorState
, &kStringSignature
},
323 { ::onc::network_config::kIPConfigs
, &kIPConfigListSignature
},
324 { ::onc::network_config::kMacAddress
, &kStringSignature
},
325 { ::onc::network_config::kRestrictedConnectivity
, &kBoolSignature
},
326 { ::onc::network_config::kSavedIPConfig
, &kSavedIPConfigSignature
},
327 { ::onc::network_config::kSource
, &kStringSignature
},
328 { ::onc::network_config::kWiFi
, &kWiFiWithStateSignature
},
329 { ::onc::network_config::kWimax
, &kWiMAXWithStateSignature
},
332 const OncFieldSignature global_network_configuration_fields
[] = {
333 { ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect
,
337 const OncFieldSignature certificate_fields
[] = {
338 { ::onc::certificate::kGUID
, &kStringSignature
},
339 { ::onc::certificate::kPKCS12
, &kStringSignature
},
340 { ::onc::kRemove
, &kBoolSignature
},
341 { ::onc::certificate::kTrustBits
, &kStringListSignature
},
342 { ::onc::certificate::kType
, &kStringSignature
},
343 { ::onc::certificate::kX509
, &kStringSignature
},
346 const OncFieldSignature toplevel_configuration_fields
[] = {
347 { ::onc::toplevel_config::kCertificates
, &kCertificateListSignature
},
348 { ::onc::toplevel_config::kNetworkConfigurations
,
349 &kNetworkConfigurationListSignature
},
350 { ::onc::toplevel_config::kGlobalNetworkConfiguration
,
351 &kGlobalNetworkConfigurationSignature
},
352 { ::onc::toplevel_config::kType
, &kStringSignature
},
353 { ::onc::encrypted::kCipher
, &kStringSignature
},
354 { ::onc::encrypted::kCiphertext
, &kStringSignature
},
355 { ::onc::encrypted::kHMAC
, &kStringSignature
},
356 { ::onc::encrypted::kHMACMethod
, &kStringSignature
},
357 { ::onc::encrypted::kIV
, &kStringSignature
},
358 { ::onc::encrypted::kIterations
, &kIntegerSignature
},
359 { ::onc::encrypted::kSalt
, &kStringSignature
},
360 { ::onc::encrypted::kStretch
, &kStringSignature
}, {NULL
}};
364 const OncValueSignature kRecommendedSignature
= {
365 base::Value::TYPE_LIST
, NULL
, &kStringSignature
367 const OncValueSignature kEAPSignature
= {
368 base::Value::TYPE_DICTIONARY
, eap_fields
, NULL
370 const OncValueSignature kIssuerSubjectPatternSignature
= {
371 base::Value::TYPE_DICTIONARY
, issuer_subject_pattern_fields
, NULL
373 const OncValueSignature kCertificatePatternSignature
= {
374 base::Value::TYPE_DICTIONARY
, certificate_pattern_fields
, NULL
376 const OncValueSignature kIPsecSignature
= {
377 base::Value::TYPE_DICTIONARY
, ipsec_fields
, NULL
379 const OncValueSignature kXAUTHSignature
= {
380 base::Value::TYPE_DICTIONARY
, xauth_fields
, NULL
382 const OncValueSignature kL2TPSignature
= {
383 base::Value::TYPE_DICTIONARY
, l2tp_fields
, NULL
385 const OncValueSignature kOpenVPNSignature
= {
386 base::Value::TYPE_DICTIONARY
, openvpn_fields
, NULL
388 const OncValueSignature kVerifyX509Signature
= {
389 base::Value::TYPE_DICTIONARY
, verify_x509_fields
, NULL
391 const OncValueSignature kVPNSignature
= {
392 base::Value::TYPE_DICTIONARY
, vpn_fields
, NULL
394 const OncValueSignature kEthernetSignature
= {
395 base::Value::TYPE_DICTIONARY
, ethernet_fields
, NULL
397 const OncValueSignature kIPConfigSignature
= {
398 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
400 const OncValueSignature kSavedIPConfigSignature
= {
401 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
403 const OncValueSignature kStaticIPConfigSignature
= {
404 base::Value::TYPE_DICTIONARY
, ipconfig_fields
, NULL
406 const OncValueSignature kProxyLocationSignature
= {
407 base::Value::TYPE_DICTIONARY
, proxy_location_fields
, NULL
409 const OncValueSignature kProxyManualSignature
= {
410 base::Value::TYPE_DICTIONARY
, proxy_manual_fields
, NULL
412 const OncValueSignature kProxySettingsSignature
= {
413 base::Value::TYPE_DICTIONARY
, proxy_settings_fields
, NULL
415 const OncValueSignature kWiFiSignature
= {
416 base::Value::TYPE_DICTIONARY
, wifi_fields
, NULL
418 const OncValueSignature kWiMAXSignature
= {
419 base::Value::TYPE_DICTIONARY
, wimax_fields
, NULL
421 const OncValueSignature kCertificateSignature
= {
422 base::Value::TYPE_DICTIONARY
, certificate_fields
, NULL
424 const OncValueSignature kNetworkConfigurationSignature
= {
425 base::Value::TYPE_DICTIONARY
, network_configuration_fields
, NULL
427 const OncValueSignature kGlobalNetworkConfigurationSignature
= {
428 base::Value::TYPE_DICTIONARY
, global_network_configuration_fields
, NULL
430 const OncValueSignature kCertificateListSignature
= {
431 base::Value::TYPE_LIST
, NULL
, &kCertificateSignature
433 const OncValueSignature kNetworkConfigurationListSignature
= {
434 base::Value::TYPE_LIST
, NULL
, &kNetworkConfigurationSignature
436 const OncValueSignature kToplevelConfigurationSignature
= {
437 base::Value::TYPE_DICTIONARY
, toplevel_configuration_fields
, NULL
440 // Derived "ONC with State" signatures.
441 const OncValueSignature kNetworkWithStateSignature
= {
442 base::Value::TYPE_DICTIONARY
, network_with_state_fields
, NULL
,
443 &kNetworkConfigurationSignature
445 const OncValueSignature kWiFiWithStateSignature
= {
446 base::Value::TYPE_DICTIONARY
, wifi_with_state_fields
, NULL
, &kWiFiSignature
448 const OncValueSignature kWiMAXWithStateSignature
= {
449 base::Value::TYPE_DICTIONARY
, wimax_with_state_fields
, NULL
, &kWiMAXSignature
451 const OncValueSignature kCellularSignature
= {
452 base::Value::TYPE_DICTIONARY
, cellular_fields
, NULL
454 const OncValueSignature kCellularWithStateSignature
= {
455 base::Value::TYPE_DICTIONARY
, cellular_with_state_fields
, NULL
,
458 const OncValueSignature kCellularProviderSignature
= {
459 base::Value::TYPE_DICTIONARY
, cellular_provider_fields
, NULL
461 const OncValueSignature kCellularApnSignature
= {
462 base::Value::TYPE_DICTIONARY
, cellular_apn_fields
, NULL
464 const OncValueSignature kCellularFoundNetworkSignature
= {
465 base::Value::TYPE_DICTIONARY
, cellular_found_network_fields
, NULL
467 const OncValueSignature kSIMLockStatusSignature
= {
468 base::Value::TYPE_DICTIONARY
, sim_lock_status_fields
, NULL
471 const OncFieldSignature
* GetFieldSignature(const OncValueSignature
& signature
,
472 const std::string
& onc_field_name
) {
473 if (!signature
.fields
)
475 for (const OncFieldSignature
* field_signature
= signature
.fields
;
476 field_signature
->onc_field_name
!= NULL
; ++field_signature
) {
477 if (onc_field_name
== field_signature
->onc_field_name
)
478 return field_signature
;
480 if (signature
.base_signature
)
481 return GetFieldSignature(*signature
.base_signature
, onc_field_name
);
487 struct CredentialEntry
{
488 const OncValueSignature
* value_signature
;
489 const char* field_name
;
492 const CredentialEntry credentials
[] = {
493 {&kEAPSignature
, ::onc::eap::kPassword
},
494 {&kIPsecSignature
, ::onc::ipsec::kPSK
},
495 {&kXAUTHSignature
, ::onc::vpn::kPassword
},
496 {&kL2TPSignature
, ::onc::vpn::kPassword
},
497 {&kOpenVPNSignature
, ::onc::vpn::kPassword
},
498 {&kOpenVPNSignature
, ::onc::openvpn::kTLSAuthContents
},
499 {&kWiFiSignature
, ::onc::wifi::kPassphrase
},
500 {&kCellularApnSignature
, ::onc::cellular_apn::kPassword
},
505 bool FieldIsCredential(const OncValueSignature
& signature
,
506 const std::string
& onc_field_name
) {
507 for (const CredentialEntry
* entry
= credentials
;
508 entry
->value_signature
!= NULL
; ++entry
) {
509 if (&signature
== entry
->value_signature
&&
510 onc_field_name
== entry
->field_name
) {
518 } // namespace chromeos