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 }, | |
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[] = { | |
pneubeck (no reviews)
2013/01/18 10:27:41
We'll need documentation for these fields. I'll se
Greg Spencer (Chromium)
2013/01/18 22:27:44
OK. I think almost all of them are read-only fiel
| |
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_*. | |
pneubeck (no reviews)
2013/01/18 10:27:41
mention that it is read-only and/or converted only
Greg Spencer (Chromium)
2013/01/18 22:27:44
Done.
| |
292 { network_config::kState, NULL, &kStringSignature}, | |
235 { NULL } | 293 { NULL } |
236 }; | 294 }; |
237 | 295 |
238 // Certificates are not translated to Shill. | 296 // Certificates are not translated to Shill. |
239 const OncFieldSignature certificate_fields[] = { | 297 const OncFieldSignature certificate_fields[] = { |
240 { kGUID, NULL, &kStringSignature }, | 298 { network_config::kGUID, NULL, &kStringSignature }, |
pneubeck (no reviews)
2013/01/18 10:27:41
(onc::)kGUID
Greg Spencer (Chromium)
2013/01/18 22:27:44
Changed to certificate::kGUID.
| |
241 { certificate::kPKCS12, NULL, &kStringSignature }, | 299 { certificate::kPKCS12, NULL, &kStringSignature }, |
242 { kRemove, NULL, &kBoolSignature }, | 300 { kRemove, NULL, &kBoolSignature }, |
243 { certificate::kTrust, NULL, &kStringListSignature }, | 301 { certificate::kTrust, NULL, &kStringListSignature }, |
244 { certificate::kType, NULL, &kStringSignature }, | 302 { certificate::kType, NULL, &kStringSignature }, |
245 { certificate::kX509, NULL, &kStringSignature }, | 303 { certificate::kX509, NULL, &kStringSignature }, |
246 { NULL } | 304 { NULL } |
247 }; | 305 }; |
248 | 306 |
249 const OncFieldSignature toplevel_configuration_fields[] = { | 307 const OncFieldSignature toplevel_configuration_fields[] = { |
250 { kCertificates, NULL, &kCertificateListSignature }, | 308 { kCertificates, NULL, &kCertificateListSignature }, |
251 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, | 309 { kNetworkConfigurations, NULL, &kNetworkConfigurationListSignature }, |
252 { kType, NULL, &kStringSignature }, | 310 { encrypted::kType, NULL, &kStringSignature }, |
pneubeck (no reviews)
2013/01/18 10:27:41
toplevel_config::kType
Greg Spencer (Chromium)
2013/01/18 22:27:44
Done.
| |
253 { encrypted::kCipher, NULL, &kStringSignature }, | 311 { encrypted::kCipher, NULL, &kStringSignature }, |
254 { encrypted::kCiphertext, NULL, &kStringSignature }, | 312 { encrypted::kCiphertext, NULL, &kStringSignature }, |
255 { encrypted::kHMAC, NULL, &kStringSignature }, | 313 { encrypted::kHMAC, NULL, &kStringSignature }, |
256 { encrypted::kHMACMethod, NULL, &kStringSignature }, | 314 { encrypted::kHMACMethod, NULL, &kStringSignature }, |
257 { encrypted::kIV, NULL, &kStringSignature }, | 315 { encrypted::kIV, NULL, &kStringSignature }, |
258 { encrypted::kIterations, NULL, &kIntegerSignature }, | 316 { encrypted::kIterations, NULL, &kIntegerSignature }, |
259 { encrypted::kSalt, NULL, &kStringSignature }, | 317 { encrypted::kSalt, NULL, &kStringSignature }, |
260 { encrypted::kStretch, NULL, &kStringSignature }, | 318 { encrypted::kStretch, NULL, &kStringSignature }, |
261 { NULL } | 319 { NULL } |
262 }; | 320 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 }; | 356 }; |
299 const OncValueSignature kProxyManualSignature = { | 357 const OncValueSignature kProxyManualSignature = { |
300 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL | 358 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL |
301 }; | 359 }; |
302 const OncValueSignature kProxySettingsSignature = { | 360 const OncValueSignature kProxySettingsSignature = { |
303 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL | 361 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL |
304 }; | 362 }; |
305 const OncValueSignature kWiFiSignature = { | 363 const OncValueSignature kWiFiSignature = { |
306 Value::TYPE_DICTIONARY, wifi_fields, NULL | 364 Value::TYPE_DICTIONARY, wifi_fields, NULL |
307 }; | 365 }; |
366 const OncValueSignature kCellularSignature = { | |
367 Value::TYPE_DICTIONARY, cellular_fields, NULL | |
368 }; | |
308 const OncValueSignature kCertificateSignature = { | 369 const OncValueSignature kCertificateSignature = { |
309 Value::TYPE_DICTIONARY, certificate_fields, NULL | 370 Value::TYPE_DICTIONARY, certificate_fields, NULL |
310 }; | 371 }; |
311 const OncValueSignature kNetworkConfigurationSignature = { | 372 const OncValueSignature kNetworkConfigurationSignature = { |
312 Value::TYPE_DICTIONARY, network_configuration_fields, NULL | 373 Value::TYPE_DICTIONARY, network_configuration_fields, NULL |
313 }; | 374 }; |
314 const OncValueSignature kCertificateListSignature = { | 375 const OncValueSignature kCertificateListSignature = { |
315 Value::TYPE_LIST, NULL, &kCertificateSignature | 376 Value::TYPE_LIST, NULL, &kCertificateSignature |
316 }; | 377 }; |
317 const OncValueSignature kNetworkConfigurationListSignature = { | 378 const OncValueSignature kNetworkConfigurationListSignature = { |
(...skipping 10 matching lines...) Expand all Loading... | |
328 for (const OncFieldSignature* field_signature = signature.fields; | 389 for (const OncFieldSignature* field_signature = signature.fields; |
329 field_signature->onc_field_name != NULL; ++field_signature) { | 390 field_signature->onc_field_name != NULL; ++field_signature) { |
330 if (onc_field_name == field_signature->onc_field_name) | 391 if (onc_field_name == field_signature->onc_field_name) |
331 return field_signature; | 392 return field_signature; |
332 } | 393 } |
333 return NULL; | 394 return NULL; |
334 } | 395 } |
335 | 396 |
336 } // namespace onc | 397 } // namespace onc |
337 } // namespace chromeos | 398 } // namespace chromeos |
OLD | NEW |