OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/network/onc/onc_signature.h" | 5 #include "chromeos/network/onc/onc_signature.h" |
6 | 6 |
7 #include "components/onc/onc_constants.h" | 7 #include "components/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; |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 namespace onc { | 13 namespace onc { |
14 namespace { | 14 namespace { |
15 | 15 |
16 const OncValueSignature kBoolSignature = {base::Value::TYPE_BOOLEAN, NULL}; | 16 const OncValueSignature kBoolSignature = {base::Value::Type::BOOLEAN, NULL}; |
17 const OncValueSignature kStringSignature = {base::Value::TYPE_STRING, NULL}; | 17 const OncValueSignature kStringSignature = {base::Value::Type::STRING, NULL}; |
18 const OncValueSignature kIntegerSignature = {base::Value::TYPE_INTEGER, NULL}; | 18 const OncValueSignature kIntegerSignature = {base::Value::Type::INTEGER, NULL}; |
19 const OncValueSignature kStringListSignature = {base::Value::TYPE_LIST, | 19 const OncValueSignature kStringListSignature = {base::Value::Type::LIST, NULL, |
20 NULL, | |
21 &kStringSignature}; | 20 &kStringSignature}; |
22 const OncValueSignature kIntegerListSignature = {base::Value::TYPE_LIST, | 21 const OncValueSignature kIntegerListSignature = {base::Value::Type::LIST, NULL, |
23 NULL, | |
24 &kIntegerSignature}; | 22 &kIntegerSignature}; |
25 const OncValueSignature kIPConfigListSignature = {base::Value::TYPE_LIST, | 23 const OncValueSignature kIPConfigListSignature = {base::Value::Type::LIST, NULL, |
26 NULL, | |
27 &kIPConfigSignature}; | 24 &kIPConfigSignature}; |
28 const OncValueSignature kCellularApnListSignature = {base::Value::TYPE_LIST, | 25 const OncValueSignature kCellularApnListSignature = { |
29 NULL, | 26 base::Value::Type::LIST, NULL, &kCellularApnSignature}; |
30 &kCellularApnSignature}; | |
31 const OncValueSignature kCellularFoundNetworkListSignature = { | 27 const OncValueSignature kCellularFoundNetworkListSignature = { |
32 base::Value::TYPE_LIST, | 28 base::Value::Type::LIST, NULL, &kCellularFoundNetworkSignature}; |
33 NULL, | |
34 &kCellularFoundNetworkSignature}; | |
35 | 29 |
36 const OncFieldSignature issuer_subject_pattern_fields[] = { | 30 const OncFieldSignature issuer_subject_pattern_fields[] = { |
37 {::onc::client_cert::kCommonName, &kStringSignature}, | 31 {::onc::client_cert::kCommonName, &kStringSignature}, |
38 {::onc::client_cert::kLocality, &kStringSignature}, | 32 {::onc::client_cert::kLocality, &kStringSignature}, |
39 {::onc::client_cert::kOrganization, &kStringSignature}, | 33 {::onc::client_cert::kOrganization, &kStringSignature}, |
40 {::onc::client_cert::kOrganizationalUnit, &kStringSignature}, | 34 {::onc::client_cert::kOrganizationalUnit, &kStringSignature}, |
41 {NULL}}; | 35 {NULL}}; |
42 | 36 |
43 const OncFieldSignature certificate_pattern_fields[] = { | 37 const OncFieldSignature certificate_pattern_fields[] = { |
44 {::onc::kRecommended, &kRecommendedSignature}, | 38 {::onc::kRecommended, &kRecommendedSignature}, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 {::onc::encrypted::kHMAC, &kStringSignature}, | 361 {::onc::encrypted::kHMAC, &kStringSignature}, |
368 {::onc::encrypted::kHMACMethod, &kStringSignature}, | 362 {::onc::encrypted::kHMACMethod, &kStringSignature}, |
369 {::onc::encrypted::kIV, &kStringSignature}, | 363 {::onc::encrypted::kIV, &kStringSignature}, |
370 {::onc::encrypted::kIterations, &kIntegerSignature}, | 364 {::onc::encrypted::kIterations, &kIntegerSignature}, |
371 {::onc::encrypted::kSalt, &kStringSignature}, | 365 {::onc::encrypted::kSalt, &kStringSignature}, |
372 {::onc::encrypted::kStretch, &kStringSignature}, | 366 {::onc::encrypted::kStretch, &kStringSignature}, |
373 {NULL}}; | 367 {NULL}}; |
374 | 368 |
375 } // namespace | 369 } // namespace |
376 | 370 |
377 const OncValueSignature kRecommendedSignature = {base::Value::TYPE_LIST, | 371 const OncValueSignature kRecommendedSignature = {base::Value::Type::LIST, NULL, |
378 NULL, | |
379 &kStringSignature}; | 372 &kStringSignature}; |
380 const OncValueSignature kEAPSignature = {base::Value::TYPE_DICTIONARY, | 373 const OncValueSignature kEAPSignature = {base::Value::Type::DICTIONARY, |
381 eap_fields, | 374 eap_fields, NULL}; |
382 NULL}; | |
383 const OncValueSignature kIssuerSubjectPatternSignature = { | 375 const OncValueSignature kIssuerSubjectPatternSignature = { |
384 base::Value::TYPE_DICTIONARY, | 376 base::Value::Type::DICTIONARY, issuer_subject_pattern_fields, NULL}; |
385 issuer_subject_pattern_fields, | |
386 NULL}; | |
387 const OncValueSignature kCertificatePatternSignature = { | 377 const OncValueSignature kCertificatePatternSignature = { |
388 base::Value::TYPE_DICTIONARY, | 378 base::Value::Type::DICTIONARY, certificate_pattern_fields, NULL}; |
389 certificate_pattern_fields, | 379 const OncValueSignature kIPsecSignature = {base::Value::Type::DICTIONARY, |
390 NULL}; | 380 ipsec_fields, NULL}; |
391 const OncValueSignature kIPsecSignature = {base::Value::TYPE_DICTIONARY, | 381 const OncValueSignature kXAUTHSignature = {base::Value::Type::DICTIONARY, |
392 ipsec_fields, | 382 xauth_fields, NULL}; |
393 NULL}; | 383 const OncValueSignature kL2TPSignature = {base::Value::Type::DICTIONARY, |
394 const OncValueSignature kXAUTHSignature = {base::Value::TYPE_DICTIONARY, | 384 l2tp_fields, NULL}; |
395 xauth_fields, | 385 const OncValueSignature kOpenVPNSignature = {base::Value::Type::DICTIONARY, |
396 NULL}; | 386 openvpn_fields, NULL}; |
397 const OncValueSignature kL2TPSignature = {base::Value::TYPE_DICTIONARY, | 387 const OncValueSignature kThirdPartyVPNSignature = { |
398 l2tp_fields, | 388 base::Value::Type::DICTIONARY, third_party_vpn_fields, NULL}; |
399 NULL}; | 389 const OncValueSignature kVerifyX509Signature = {base::Value::Type::DICTIONARY, |
400 const OncValueSignature kOpenVPNSignature = {base::Value::TYPE_DICTIONARY, | 390 verify_x509_fields, NULL}; |
401 openvpn_fields, | 391 const OncValueSignature kVPNSignature = {base::Value::Type::DICTIONARY, |
402 NULL}; | 392 vpn_fields, NULL}; |
403 const OncValueSignature kThirdPartyVPNSignature = {base::Value::TYPE_DICTIONARY, | 393 const OncValueSignature kEthernetSignature = {base::Value::Type::DICTIONARY, |
404 third_party_vpn_fields, | 394 ethernet_fields, NULL}; |
405 NULL}; | 395 const OncValueSignature kIPConfigSignature = {base::Value::Type::DICTIONARY, |
406 const OncValueSignature kVerifyX509Signature = {base::Value::TYPE_DICTIONARY, | 396 ipconfig_fields, NULL}; |
407 verify_x509_fields, | 397 const OncValueSignature kSavedIPConfigSignature = { |
408 NULL}; | 398 base::Value::Type::DICTIONARY, ipconfig_fields, NULL}; |
409 const OncValueSignature kVPNSignature = {base::Value::TYPE_DICTIONARY, | |
410 vpn_fields, | |
411 NULL}; | |
412 const OncValueSignature kEthernetSignature = {base::Value::TYPE_DICTIONARY, | |
413 ethernet_fields, | |
414 NULL}; | |
415 const OncValueSignature kIPConfigSignature = {base::Value::TYPE_DICTIONARY, | |
416 ipconfig_fields, | |
417 NULL}; | |
418 const OncValueSignature kSavedIPConfigSignature = {base::Value::TYPE_DICTIONARY, | |
419 ipconfig_fields, | |
420 NULL}; | |
421 const OncValueSignature kStaticIPConfigSignature = { | 399 const OncValueSignature kStaticIPConfigSignature = { |
422 base::Value::TYPE_DICTIONARY, | 400 base::Value::Type::DICTIONARY, ipconfig_fields, NULL}; |
423 ipconfig_fields, | 401 const OncValueSignature kProxyLocationSignature = { |
424 NULL}; | 402 base::Value::Type::DICTIONARY, proxy_location_fields, NULL}; |
425 const OncValueSignature kProxyLocationSignature = {base::Value::TYPE_DICTIONARY, | 403 const OncValueSignature kProxyManualSignature = {base::Value::Type::DICTIONARY, |
426 proxy_location_fields, | 404 proxy_manual_fields, NULL}; |
427 NULL}; | 405 const OncValueSignature kProxySettingsSignature = { |
428 const OncValueSignature kProxyManualSignature = {base::Value::TYPE_DICTIONARY, | 406 base::Value::Type::DICTIONARY, proxy_settings_fields, NULL}; |
429 proxy_manual_fields, | 407 const OncValueSignature kWiFiSignature = {base::Value::Type::DICTIONARY, |
430 NULL}; | 408 wifi_fields, NULL}; |
431 const OncValueSignature kProxySettingsSignature = {base::Value::TYPE_DICTIONARY, | 409 const OncValueSignature kWiMAXSignature = {base::Value::Type::DICTIONARY, |
432 proxy_settings_fields, | 410 wimax_fields, NULL}; |
433 NULL}; | 411 const OncValueSignature kCertificateSignature = {base::Value::Type::DICTIONARY, |
434 const OncValueSignature kWiFiSignature = {base::Value::TYPE_DICTIONARY, | 412 certificate_fields, NULL}; |
435 wifi_fields, | |
436 NULL}; | |
437 const OncValueSignature kWiMAXSignature = {base::Value::TYPE_DICTIONARY, | |
438 wimax_fields, | |
439 NULL}; | |
440 const OncValueSignature kCertificateSignature = {base::Value::TYPE_DICTIONARY, | |
441 certificate_fields, | |
442 NULL}; | |
443 const OncValueSignature kNetworkConfigurationSignature = { | 413 const OncValueSignature kNetworkConfigurationSignature = { |
444 base::Value::TYPE_DICTIONARY, | 414 base::Value::Type::DICTIONARY, network_configuration_fields, NULL}; |
445 network_configuration_fields, | |
446 NULL}; | |
447 const OncValueSignature kGlobalNetworkConfigurationSignature = { | 415 const OncValueSignature kGlobalNetworkConfigurationSignature = { |
448 base::Value::TYPE_DICTIONARY, | 416 base::Value::Type::DICTIONARY, global_network_configuration_fields, NULL}; |
449 global_network_configuration_fields, | 417 const OncValueSignature kCertificateListSignature = { |
450 NULL}; | 418 base::Value::Type::LIST, NULL, &kCertificateSignature}; |
451 const OncValueSignature kCertificateListSignature = {base::Value::TYPE_LIST, | |
452 NULL, | |
453 &kCertificateSignature}; | |
454 const OncValueSignature kNetworkConfigurationListSignature = { | 419 const OncValueSignature kNetworkConfigurationListSignature = { |
455 base::Value::TYPE_LIST, | 420 base::Value::Type::LIST, NULL, &kNetworkConfigurationSignature}; |
456 NULL, | |
457 &kNetworkConfigurationSignature}; | |
458 const OncValueSignature kToplevelConfigurationSignature = { | 421 const OncValueSignature kToplevelConfigurationSignature = { |
459 base::Value::TYPE_DICTIONARY, | 422 base::Value::Type::DICTIONARY, toplevel_configuration_fields, NULL}; |
460 toplevel_configuration_fields, | |
461 NULL}; | |
462 | 423 |
463 // Derived "ONC with State" signatures. | 424 // Derived "ONC with State" signatures. |
464 const OncValueSignature kNetworkWithStateSignature = { | 425 const OncValueSignature kNetworkWithStateSignature = { |
465 base::Value::TYPE_DICTIONARY, | 426 base::Value::Type::DICTIONARY, network_with_state_fields, NULL, |
466 network_with_state_fields, | |
467 NULL, | |
468 &kNetworkConfigurationSignature}; | 427 &kNetworkConfigurationSignature}; |
469 const OncValueSignature kWiFiWithStateSignature = {base::Value::TYPE_DICTIONARY, | 428 const OncValueSignature kWiFiWithStateSignature = { |
470 wifi_with_state_fields, | 429 base::Value::Type::DICTIONARY, wifi_with_state_fields, NULL, |
471 NULL, | 430 &kWiFiSignature}; |
472 &kWiFiSignature}; | |
473 const OncValueSignature kWiMAXWithStateSignature = { | 431 const OncValueSignature kWiMAXWithStateSignature = { |
474 base::Value::TYPE_DICTIONARY, | 432 base::Value::Type::DICTIONARY, wimax_with_state_fields, NULL, |
475 wimax_with_state_fields, | |
476 NULL, | |
477 &kWiMAXSignature}; | 433 &kWiMAXSignature}; |
478 const OncValueSignature kCellularSignature = {base::Value::TYPE_DICTIONARY, | 434 const OncValueSignature kCellularSignature = {base::Value::Type::DICTIONARY, |
479 cellular_fields, | 435 cellular_fields, NULL}; |
480 NULL}; | |
481 const OncValueSignature kCellularWithStateSignature = { | 436 const OncValueSignature kCellularWithStateSignature = { |
482 base::Value::TYPE_DICTIONARY, | 437 base::Value::Type::DICTIONARY, cellular_with_state_fields, NULL, |
483 cellular_with_state_fields, | |
484 NULL, | |
485 &kCellularSignature}; | 438 &kCellularSignature}; |
486 const OncValueSignature kCellularPaymentPortalSignature = { | 439 const OncValueSignature kCellularPaymentPortalSignature = { |
487 base::Value::TYPE_DICTIONARY, | 440 base::Value::Type::DICTIONARY, cellular_payment_portal_fields, NULL}; |
488 cellular_payment_portal_fields, | |
489 NULL}; | |
490 const OncValueSignature kCellularProviderSignature = { | 441 const OncValueSignature kCellularProviderSignature = { |
491 base::Value::TYPE_DICTIONARY, | 442 base::Value::Type::DICTIONARY, cellular_provider_fields, NULL}; |
492 cellular_provider_fields, | 443 const OncValueSignature kCellularApnSignature = {base::Value::Type::DICTIONARY, |
493 NULL}; | 444 cellular_apn_fields, NULL}; |
494 const OncValueSignature kCellularApnSignature = {base::Value::TYPE_DICTIONARY, | |
495 cellular_apn_fields, | |
496 NULL}; | |
497 const OncValueSignature kCellularFoundNetworkSignature = { | 445 const OncValueSignature kCellularFoundNetworkSignature = { |
498 base::Value::TYPE_DICTIONARY, | 446 base::Value::Type::DICTIONARY, cellular_found_network_fields, NULL}; |
499 cellular_found_network_fields, | 447 const OncValueSignature kSIMLockStatusSignature = { |
500 NULL}; | 448 base::Value::Type::DICTIONARY, sim_lock_status_fields, NULL}; |
501 const OncValueSignature kSIMLockStatusSignature = {base::Value::TYPE_DICTIONARY, | |
502 sim_lock_status_fields, | |
503 NULL}; | |
504 | 449 |
505 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature, | 450 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature, |
506 const std::string& onc_field_name) { | 451 const std::string& onc_field_name) { |
507 if (!signature.fields) | 452 if (!signature.fields) |
508 return NULL; | 453 return NULL; |
509 for (const OncFieldSignature* field_signature = signature.fields; | 454 for (const OncFieldSignature* field_signature = signature.fields; |
510 field_signature->onc_field_name != NULL; ++field_signature) { | 455 field_signature->onc_field_name != NULL; ++field_signature) { |
511 if (onc_field_name == field_signature->onc_field_name) | 456 if (onc_field_name == field_signature->onc_field_name) |
512 return field_signature; | 457 return field_signature; |
513 } | 458 } |
(...skipping 29 matching lines...) Expand all Loading... |
543 if (&signature == entry->value_signature && | 488 if (&signature == entry->value_signature && |
544 onc_field_name == entry->field_name) { | 489 onc_field_name == entry->field_name) { |
545 return true; | 490 return true; |
546 } | 491 } |
547 } | 492 } |
548 return false; | 493 return false; |
549 } | 494 } |
550 | 495 |
551 } // namespace onc | 496 } // namespace onc |
552 } // namespace chromeos | 497 } // namespace chromeos |
OLD | NEW |