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 "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 10 matching lines...) Expand all Loading... |
21 }; | 21 }; |
22 const OncValueSignature kIntegerSignature = { | 22 const OncValueSignature kIntegerSignature = { |
23 Value::TYPE_INTEGER, NULL | 23 Value::TYPE_INTEGER, NULL |
24 }; | 24 }; |
25 const OncValueSignature kStringListSignature = { | 25 const OncValueSignature kStringListSignature = { |
26 Value::TYPE_LIST, NULL, &kStringSignature | 26 Value::TYPE_LIST, NULL, &kStringSignature |
27 }; | 27 }; |
28 const OncValueSignature kIPConfigListSignature = { | 28 const OncValueSignature kIPConfigListSignature = { |
29 Value::TYPE_LIST, NULL, &kIPConfigSignature | 29 Value::TYPE_LIST, NULL, &kIPConfigSignature |
30 }; | 30 }; |
31 const OncValueSignature kCertificateListSignature = { | |
32 Value::TYPE_LIST, NULL, &kCertificateSignature | |
33 }; | |
34 const OncValueSignature kNetworkConfigurationListSignature = { | |
35 Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature | |
36 }; | |
37 | 31 |
38 const OncFieldSignature issuer_subject_pattern_fields[] = { | 32 const OncFieldSignature issuer_subject_pattern_fields[] = { |
39 { certificate::kCommonName, NULL, &kStringSignature }, | 33 { certificate::kCommonName, NULL, &kStringSignature }, |
40 { certificate::kLocality, NULL, &kStringSignature }, | 34 { certificate::kLocality, NULL, &kStringSignature }, |
41 { certificate::kOrganization, NULL, &kStringSignature }, | 35 { certificate::kOrganization, NULL, &kStringSignature }, |
42 { certificate::kOrganizationalUnit, NULL, &kStringSignature }, | 36 { certificate::kOrganizationalUnit, NULL, &kStringSignature }, |
43 { NULL } | 37 { NULL } |
44 }; | 38 }; |
45 | 39 |
46 const OncFieldSignature certificate_pattern_fields[] = { | 40 const OncFieldSignature certificate_pattern_fields[] = { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 const OncFieldSignature certificate_fields[] = { | 223 const OncFieldSignature certificate_fields[] = { |
230 { kGUID, flimflam::kGuidProperty, &kStringSignature }, | 224 { kGUID, flimflam::kGuidProperty, &kStringSignature }, |
231 { certificate::kPKCS12, NULL, &kStringSignature }, | 225 { certificate::kPKCS12, NULL, &kStringSignature }, |
232 { kRemove, NULL, &kBoolSignature }, | 226 { kRemove, NULL, &kBoolSignature }, |
233 { certificate::kTrust, NULL, &kStringListSignature }, | 227 { certificate::kTrust, NULL, &kStringListSignature }, |
234 { kType, NULL, &kStringSignature }, | 228 { kType, NULL, &kStringSignature }, |
235 { certificate::kX509, NULL, &kStringSignature }, | 229 { certificate::kX509, NULL, &kStringSignature }, |
236 { NULL } | 230 { NULL } |
237 }; | 231 }; |
238 | 232 |
239 const OncFieldSignature unencrypted_configuration_fields[] = { | 233 const OncFieldSignature toplevel_configuration_fields[] = { |
240 { kCertificates, NULL, &kCertificateListSignature }, | 234 { kCertificates, NULL, &kCertificateListSignature }, |
241 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, | 235 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, |
242 { kType, NULL, &kStringSignature }, | 236 { kType, NULL, &kStringSignature }, |
| 237 { encrypted::kCipher, NULL, &kStringSignature }, |
| 238 { encrypted::kCiphertext, NULL, &kStringSignature }, |
| 239 { encrypted::kHMAC, NULL, &kStringSignature }, |
| 240 { encrypted::kHMACMethod, NULL, &kStringSignature }, |
| 241 { encrypted::kIV, NULL, &kStringSignature }, |
| 242 { encrypted::kIterations, NULL, &kIntegerSignature }, |
| 243 { encrypted::kSalt, NULL, &kStringSignature }, |
| 244 { encrypted::kStretch, NULL, &kStringSignature }, |
243 { NULL } | 245 { NULL } |
244 }; | 246 }; |
245 | 247 |
246 } // namespace | 248 } // namespace |
247 | 249 |
248 const OncValueSignature kRecommendedSignature = { | 250 const OncValueSignature kRecommendedSignature = { |
249 Value::TYPE_LIST, NULL, &kStringSignature | 251 Value::TYPE_LIST, NULL, &kStringSignature |
250 }; | 252 }; |
251 const OncValueSignature kEAPSignature = { | 253 const OncValueSignature kEAPSignature = { |
252 Value::TYPE_DICTIONARY, eap_fields, NULL | 254 Value::TYPE_DICTIONARY, eap_fields, NULL |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 }; | 288 }; |
287 const OncValueSignature kWiFiSignature = { | 289 const OncValueSignature kWiFiSignature = { |
288 Value::TYPE_DICTIONARY, wifi_fields, NULL | 290 Value::TYPE_DICTIONARY, wifi_fields, NULL |
289 }; | 291 }; |
290 const OncValueSignature kCertificateSignature = { | 292 const OncValueSignature kCertificateSignature = { |
291 Value::TYPE_DICTIONARY, certificate_fields, NULL | 293 Value::TYPE_DICTIONARY, certificate_fields, NULL |
292 }; | 294 }; |
293 const OncValueSignature kNetworkConfigurationSignature = { | 295 const OncValueSignature kNetworkConfigurationSignature = { |
294 Value::TYPE_DICTIONARY, network_configuration_fields, NULL | 296 Value::TYPE_DICTIONARY, network_configuration_fields, NULL |
295 }; | 297 }; |
296 const OncValueSignature kUnencryptedConfigurationSignature = { | 298 const OncValueSignature kCertificateListSignature = { |
297 Value::TYPE_DICTIONARY, unencrypted_configuration_fields, NULL | 299 Value::TYPE_LIST, NULL, &kCertificateSignature |
| 300 }; |
| 301 const OncValueSignature kNetworkConfigurationListSignature = { |
| 302 Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature |
| 303 }; |
| 304 const OncValueSignature kToplevelConfigurationSignature = { |
| 305 Value::TYPE_DICTIONARY, toplevel_configuration_fields, NULL |
298 }; | 306 }; |
299 | 307 |
300 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature, | 308 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature, |
301 const std::string& onc_field_name) { | 309 const std::string& onc_field_name) { |
302 if (!signature.fields) | 310 if (!signature.fields) |
303 return NULL; | 311 return NULL; |
304 for (const OncFieldSignature* field_signature = signature.fields; | 312 for (const OncFieldSignature* field_signature = signature.fields; |
305 field_signature->onc_field_name != NULL; ++field_signature) { | 313 field_signature->onc_field_name != NULL; ++field_signature) { |
306 if (onc_field_name == field_signature->onc_field_name) | 314 if (onc_field_name == field_signature->onc_field_name) |
307 return field_signature; | 315 return field_signature; |
308 } | 316 } |
309 return NULL; | 317 return NULL; |
310 } | 318 } |
311 | 319 |
312 } // namespace onc | 320 } // namespace onc |
313 } // namespace chromeos | 321 } // namespace chromeos |
OLD | NEW |