Chromium Code Reviews| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 // Not supported, yet. | 162 // Not supported, yet. |
| 163 { ethernet::kAuthentication, NULL, &kStringSignature }, | 163 { ethernet::kAuthentication, NULL, &kStringSignature }, |
| 164 { ethernet::kEAP, NULL, &kEAPSignature }, | 164 { ethernet::kEAP, NULL, &kEAPSignature }, |
| 165 { NULL } | 165 { NULL } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 // Not supported, yet. | 168 // Not supported, yet. |
| 169 const OncFieldSignature ipconfig_fields[] = { | 169 const OncFieldSignature ipconfig_fields[] = { |
| 170 { ipconfig::kGateway, NULL, &kStringSignature }, | 170 { ipconfig::kGateway, NULL, &kStringSignature }, |
| 171 { ipconfig::kIPAddress, NULL, &kStringSignature }, | 171 { ipconfig::kIPAddress, NULL, &kStringSignature }, |
| 172 { kNameServers, NULL, &kStringSignature }, | 172 { network_config::kNameServers, NULL, &kStringSignature }, |
| 173 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, | 173 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, |
| 174 { kSearchDomains, NULL, &kStringListSignature }, | 174 { network_config::kSearchDomains, NULL, &kStringListSignature }, |
| 175 { ipconfig::kType, NULL, &kStringSignature }, | 175 { ipconfig::kType, NULL, &kStringSignature }, |
| 176 { NULL } | 176 { NULL } |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 const OncFieldSignature proxy_location_fields[] = { | 179 const OncFieldSignature proxy_location_fields[] = { |
| 180 { proxy::kHost, NULL, &kStringSignature }, | 180 { proxy::kHost, NULL, &kStringSignature }, |
| 181 { proxy::kPort, NULL, &kIntegerSignature }, | 181 { proxy::kPort, NULL, &kIntegerSignature }, |
| 182 { NULL } | 182 { NULL } |
| 183 }; | 183 }; |
| 184 | 184 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 197 { proxy::kExcludeDomains, NULL, &kStringListSignature }, | 197 { proxy::kExcludeDomains, NULL, &kStringListSignature }, |
| 198 { proxy::kManual, NULL, &kProxyManualSignature }, | 198 { proxy::kManual, NULL, &kProxyManualSignature }, |
| 199 { proxy::kPAC, NULL, &kStringSignature }, | 199 { proxy::kPAC, NULL, &kStringSignature }, |
| 200 { proxy::kType, NULL, &kStringSignature }, | 200 { proxy::kType, NULL, &kStringSignature }, |
| 201 { NULL } | 201 { NULL } |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 const OncFieldSignature wifi_fields[] = { | 204 const OncFieldSignature wifi_fields[] = { |
| 205 { kRecommended, NULL, &kRecommendedSignature }, | 205 { kRecommended, NULL, &kRecommendedSignature }, |
| 206 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, | 206 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, |
| 207 { wifi::kBSSID, flimflam::kWifiBSsid, &kStringSignature }, | |
|
pneubeck (no reviews)
2013/01/21 09:26:40
the BSSID should be read-only (according to shill'
Greg Spencer (Chromium)
2013/01/22 19:10:54
Done.
| |
| 207 { wifi::kEAP, NULL, &kEAPSignature }, | 208 { wifi::kEAP, NULL, &kEAPSignature }, |
| 208 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, | 209 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, |
| 209 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, | 210 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, |
| 210 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, | 211 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, |
| 211 // This field is converted during translation, see onc_translator_*. | 212 // This field is converted during translation, see onc_translator_*. |
| 212 { wifi::kSecurity, NULL, &kStringSignature }, | 213 { wifi::kSecurity, NULL, &kStringSignature }, |
| 213 { NULL } | 214 { NULL } |
| 214 }; | 215 }; |
| 215 | 216 |
| 217 const OncFieldSignature cellular_fields[] = { | |
| 218 { kRecommended, NULL, &kRecommendedSignature }, | |
| 219 { cellular::kActivateOverNonCellularNetwork, | |
| 220 shill::kActivateOverNonCellularNetworkProperty, &kStringSignature }, | |
| 221 { cellular::kActivationState, | |
| 222 flimflam::kActivationStateProperty, &kStringSignature }, | |
| 223 { cellular::kAllowRoaming, | |
| 224 flimflam::kCellularAllowRoamingProperty, &kStringSignature }, | |
| 225 { cellular::kAPN, flimflam::kApnProperty, &kStringSignature }, | |
| 226 { cellular::kCarrier, flimflam::kCarrierProperty, &kStringSignature }, | |
| 227 { cellular::kESN, flimflam::kEsnProperty, &kStringSignature }, | |
| 228 { cellular::kFamily, flimflam::kTechnologyFamilyProperty, &kStringSignature }, | |
| 229 { cellular::kFirmwareRevision, | |
| 230 flimflam::kFirmwareRevisionProperty, &kStringSignature }, | |
| 231 { cellular::kFoundNetworks, | |
| 232 flimflam::kFoundNetworksProperty, &kStringSignature }, | |
| 233 { cellular::kHardwareRevision, | |
| 234 flimflam::kHardwareRevisionProperty, &kStringSignature }, | |
| 235 { cellular::kHomeProvider, | |
| 236 flimflam::kHomeProviderProperty, &kStringSignature }, | |
| 237 { cellular::kICCID, flimflam::kIccidProperty, &kStringSignature }, | |
| 238 { cellular::kIMEI, flimflam::kImeiProperty, &kStringSignature }, | |
| 239 { cellular::kIMSI, flimflam::kImsiProperty, &kStringSignature }, | |
| 240 { cellular::kManufacturer, | |
| 241 flimflam::kManufacturerProperty, &kStringSignature }, | |
| 242 { cellular::kMDN, flimflam::kMdnProperty, &kStringSignature }, | |
| 243 { cellular::kMEID, flimflam::kMeidProperty, &kStringSignature }, | |
| 244 { cellular::kMIN, flimflam::kMinProperty, &kStringSignature }, | |
| 245 { cellular::kModelID, flimflam::kModelIDProperty, &kStringSignature }, | |
| 246 { cellular::kNetworkTechnology, | |
| 247 flimflam::kNetworkTechnologyProperty, &kStringSignature }, | |
| 248 { cellular::kOperatorCode, | |
| 249 flimflam::kOperatorCodeProperty, &kStringSignature }, | |
| 250 { cellular::kOperatorName, | |
| 251 flimflam::kOperatorNameProperty, &kStringSignature }, | |
| 252 { cellular::kPRLVersion, flimflam::kPRLVersionProperty, &kStringSignature }, | |
| 253 { cellular::kProviderRequiresRoaming, | |
| 254 shill::kProviderRequiresRoamingProperty, &kStringSignature }, | |
| 255 { cellular::kRoamingState, | |
| 256 flimflam::kRoamingStateProperty, &kStringSignature }, | |
| 257 { cellular::kSelectedNetwork, | |
| 258 flimflam::kSelectedNetworkProperty, &kStringSignature }, | |
| 259 { cellular::kServingOperator, | |
| 260 flimflam::kServingOperatorProperty, &kStringSignature }, | |
| 261 { cellular::kSIMLockStatus, | |
| 262 flimflam::kSIMLockStatusProperty, &kStringSignature }, | |
| 263 { cellular::kSIMPresent, shill::kSIMPresentProperty, &kStringSignature }, | |
| 264 { cellular::kSupportedCarriers, | |
| 265 shill::kSupportedCarriersProperty, &kStringSignature }, | |
| 266 { cellular::kSupportNetworkScan, | |
| 267 flimflam::kSupportNetworkScanProperty, &kStringSignature }, | |
| 268 { NULL } | |
| 269 }; | |
| 270 | |
| 216 const OncFieldSignature network_configuration_fields[] = { | 271 const OncFieldSignature network_configuration_fields[] = { |
| 217 { kRecommended, NULL, &kRecommendedSignature }, | 272 { kRecommended, NULL, &kRecommendedSignature }, |
| 218 { kEthernet, NULL, &kEthernetSignature }, | 273 { network_config::kEthernet, NULL, &kEthernetSignature }, |
| 219 { kGUID, flimflam::kGuidProperty, &kStringSignature }, | 274 { network_config::kGUID, flimflam::kGuidProperty, &kStringSignature }, |
| 220 { kIPConfigs, NULL, &kIPConfigListSignature }, | 275 { network_config::kIPConfigs, NULL, &kIPConfigListSignature }, |
| 221 // Shill doesn't allow setting the name for non-VPN networks. | 276 // Shill doesn't allow setting the name for non-VPN networks. |
| 222 // This field is conditionally translated, see onc_translator_*. | 277 // This field is conditionally translated, see onc_translator_*. |
| 223 { kName, NULL, &kStringSignature }, | 278 { network_config::kName, NULL, &kStringSignature }, |
| 224 // Not supported, yet. | 279 // Not supported, yet. |
| 225 { kNameServers, NULL, &kStringListSignature }, | 280 { network_config::kNameServers, NULL, &kStringListSignature }, |
| 226 { kProxySettings, NULL, &kProxySettingsSignature }, | 281 { network_config::kProxySettings, NULL, &kProxySettingsSignature }, |
| 227 // No need to translate. | 282 // No need to translate. |
| 228 { kRemove, NULL, &kBoolSignature }, | 283 { kRemove, NULL, &kBoolSignature }, |
| 229 // Not supported, yet. | 284 // Not supported, yet. |
| 230 { kSearchDomains, NULL, &kStringListSignature }, | 285 { network_config::kSearchDomains, NULL, &kStringListSignature }, |
| 231 // This field is converted during translation, see onc_translator_*. | 286 // This field is converted during translation, see onc_translator_*. |
| 232 { kType, NULL, &kStringSignature }, | 287 { network_config::kType, NULL, &kStringSignature }, |
| 233 { kVPN, NULL, &kVPNSignature }, | 288 { network_config::kVPN, NULL, &kVPNSignature }, |
| 234 { kWiFi, NULL, &kWiFiSignature }, | 289 { network_config::kWiFi, NULL, &kWiFiSignature }, |
| 290 { network_config::kCellular, NULL, &kCellularSignature }, | |
| 291 // This field is converted during translation, see onc_translator_*. | |
| 292 // It is only converted when going from Shill->ONC, and ignored otherwise. | |
| 293 { network_config::kState, NULL, &kStringSignature}, | |
| 235 { NULL } | 294 { NULL } |
| 236 }; | 295 }; |
| 237 | 296 |
| 238 // Certificates are not translated to Shill. | 297 // Certificates are not translated to Shill. |
| 239 const OncFieldSignature certificate_fields[] = { | 298 const OncFieldSignature certificate_fields[] = { |
| 240 { kGUID, NULL, &kStringSignature }, | 299 { certificate::kGUID, NULL, &kStringSignature }, |
| 241 { certificate::kPKCS12, NULL, &kStringSignature }, | 300 { certificate::kPKCS12, NULL, &kStringSignature }, |
| 242 { kRemove, NULL, &kBoolSignature }, | 301 { kRemove, NULL, &kBoolSignature }, |
| 243 { certificate::kTrust, NULL, &kStringListSignature }, | 302 { certificate::kTrust, NULL, &kStringListSignature }, |
| 244 { certificate::kType, NULL, &kStringSignature }, | 303 { certificate::kType, NULL, &kStringSignature }, |
| 245 { certificate::kX509, NULL, &kStringSignature }, | 304 { certificate::kX509, NULL, &kStringSignature }, |
| 246 { NULL } | 305 { NULL } |
| 247 }; | 306 }; |
| 248 | 307 |
| 249 const OncFieldSignature toplevel_configuration_fields[] = { | 308 const OncFieldSignature toplevel_configuration_fields[] = { |
| 250 { kCertificates, NULL, &kCertificateListSignature }, | 309 { toplevel_config::kCertificates, NULL, &kCertificateListSignature }, |
| 251 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, | 310 { toplevel_config::kNetworkConfigurations, NULL, |
| 252 { kType, NULL, &kStringSignature }, | 311 &kNetworkConfigurationListSignature }, |
| 312 { toplevel_config::kType, NULL, &kStringSignature }, | |
| 253 { encrypted::kCipher, NULL, &kStringSignature }, | 313 { encrypted::kCipher, NULL, &kStringSignature }, |
| 254 { encrypted::kCiphertext, NULL, &kStringSignature }, | 314 { encrypted::kCiphertext, NULL, &kStringSignature }, |
| 255 { encrypted::kHMAC, NULL, &kStringSignature }, | 315 { encrypted::kHMAC, NULL, &kStringSignature }, |
| 256 { encrypted::kHMACMethod, NULL, &kStringSignature }, | 316 { encrypted::kHMACMethod, NULL, &kStringSignature }, |
| 257 { encrypted::kIV, NULL, &kStringSignature }, | 317 { encrypted::kIV, NULL, &kStringSignature }, |
| 258 { encrypted::kIterations, NULL, &kIntegerSignature }, | 318 { encrypted::kIterations, NULL, &kIntegerSignature }, |
| 259 { encrypted::kSalt, NULL, &kStringSignature }, | 319 { encrypted::kSalt, NULL, &kStringSignature }, |
| 260 { encrypted::kStretch, NULL, &kStringSignature }, | 320 { encrypted::kStretch, NULL, &kStringSignature }, |
| 261 { NULL } | 321 { NULL } |
| 262 }; | 322 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 }; | 358 }; |
| 299 const OncValueSignature kProxyManualSignature = { | 359 const OncValueSignature kProxyManualSignature = { |
| 300 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL | 360 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL |
| 301 }; | 361 }; |
| 302 const OncValueSignature kProxySettingsSignature = { | 362 const OncValueSignature kProxySettingsSignature = { |
| 303 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL | 363 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL |
| 304 }; | 364 }; |
| 305 const OncValueSignature kWiFiSignature = { | 365 const OncValueSignature kWiFiSignature = { |
| 306 Value::TYPE_DICTIONARY, wifi_fields, NULL | 366 Value::TYPE_DICTIONARY, wifi_fields, NULL |
| 307 }; | 367 }; |
| 368 const OncValueSignature kCellularSignature = { | |
| 369 Value::TYPE_DICTIONARY, cellular_fields, NULL | |
| 370 }; | |
| 308 const OncValueSignature kCertificateSignature = { | 371 const OncValueSignature kCertificateSignature = { |
| 309 Value::TYPE_DICTIONARY, certificate_fields, NULL | 372 Value::TYPE_DICTIONARY, certificate_fields, NULL |
| 310 }; | 373 }; |
| 311 const OncValueSignature kNetworkConfigurationSignature = { | 374 const OncValueSignature kNetworkConfigurationSignature = { |
| 312 Value::TYPE_DICTIONARY, network_configuration_fields, NULL | 375 Value::TYPE_DICTIONARY, network_configuration_fields, NULL |
| 313 }; | 376 }; |
| 314 const OncValueSignature kCertificateListSignature = { | 377 const OncValueSignature kCertificateListSignature = { |
| 315 Value::TYPE_LIST, NULL, &kCertificateSignature | 378 Value::TYPE_LIST, NULL, &kCertificateSignature |
| 316 }; | 379 }; |
| 317 const OncValueSignature kNetworkConfigurationListSignature = { | 380 const OncValueSignature kNetworkConfigurationListSignature = { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 328 for (const OncFieldSignature* field_signature = signature.fields; | 391 for (const OncFieldSignature* field_signature = signature.fields; |
| 329 field_signature->onc_field_name != NULL; ++field_signature) { | 392 field_signature->onc_field_name != NULL; ++field_signature) { |
| 330 if (onc_field_name == field_signature->onc_field_name) | 393 if (onc_field_name == field_signature->onc_field_name) |
| 331 return field_signature; | 394 return field_signature; |
| 332 } | 395 } |
| 333 return NULL; | 396 return NULL; |
| 334 } | 397 } |
| 335 | 398 |
| 336 } // namespace onc | 399 } // namespace onc |
| 337 } // namespace chromeos | 400 } // namespace chromeos |
| OLD | NEW |