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