Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chromeos/network/onc/onc_signature.cc

Issue 12390017: Separating ONC<->Shill translation from the ONC signature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed browser tests. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/onc/onc_signature.h ('k') | chromeos/network/onc/onc_translation_tables.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
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 31
32 const OncFieldSignature issuer_subject_pattern_fields[] = { 32 const OncFieldSignature issuer_subject_pattern_fields[] = {
33 { certificate::kCommonName, NULL, &kStringSignature }, 33 { certificate::kCommonName, &kStringSignature },
34 { certificate::kLocality, NULL, &kStringSignature }, 34 { certificate::kLocality, &kStringSignature },
35 { certificate::kOrganization, NULL, &kStringSignature }, 35 { certificate::kOrganization, &kStringSignature },
36 { certificate::kOrganizationalUnit, NULL, &kStringSignature }, 36 { certificate::kOrganizationalUnit, &kStringSignature },
37 { NULL } 37 { NULL }
38 }; 38 };
39 39
40 // CertificatePattern is converted with function CreateUIData(...) to UIData
41 // stored in Shill.
42 const OncFieldSignature certificate_pattern_fields[] = { 40 const OncFieldSignature certificate_pattern_fields[] = {
43 { kRecommended, NULL, &kRecommendedSignature }, 41 { kRecommended, &kRecommendedSignature },
44 { certificate::kEnrollmentURI, NULL, &kStringListSignature }, 42 { certificate::kEnrollmentURI, &kStringListSignature },
45 { certificate::kIssuer, NULL, &kIssuerSubjectPatternSignature }, 43 { certificate::kIssuer, &kIssuerSubjectPatternSignature },
46 { certificate::kIssuerCARef, NULL, &kStringListSignature }, 44 { certificate::kIssuerCARef, &kStringListSignature },
47 { certificate::kSubject, NULL, &kIssuerSubjectPatternSignature }, 45 { certificate::kSubject, &kIssuerSubjectPatternSignature },
48 { NULL } 46 { NULL }
49 }; 47 };
50 48
51 const OncFieldSignature eap_fields[] = { 49 const OncFieldSignature eap_fields[] = {
52 { kRecommended, NULL, &kRecommendedSignature }, 50 { kRecommended, &kRecommendedSignature },
53 { eap::kAnonymousIdentity, flimflam::kEapAnonymousIdentityProperty, 51 { eap::kAnonymousIdentity, &kStringSignature },
54 &kStringSignature }, 52 { eap::kClientCertPattern, &kCertificatePatternSignature },
55 { eap::kClientCertPattern, NULL, &kCertificatePatternSignature }, 53 { eap::kClientCertRef, &kStringSignature },
56 { eap::kClientCertRef, NULL, &kStringSignature }, 54 { eap::kClientCertType, &kStringSignature },
57 { eap::kClientCertType, NULL, &kStringSignature }, 55 { eap::kIdentity, &kStringSignature },
58 { eap::kIdentity, flimflam::kEapIdentityProperty, &kStringSignature }, 56 { eap::kInner, &kStringSignature },
59 // This field is converted during translation, see onc_translator_*. 57 { eap::kOuter, &kStringSignature },
60 { eap::kInner, NULL, &kStringSignature }, 58 { eap::kPassword, &kStringSignature },
61 // This field is converted during translation, see onc_translator_*. 59 { eap::kSaveCredentials, &kBoolSignature },
62 { eap::kOuter, NULL, &kStringSignature }, 60 { eap::kServerCARef, &kStringSignature },
63 { eap::kPassword, flimflam::kEapPasswordProperty, &kStringSignature }, 61 { eap::kUseSystemCAs, &kBoolSignature },
64 { eap::kSaveCredentials, flimflam::kSaveCredentialsProperty,
65 &kBoolSignature },
66 { eap::kServerCARef, flimflam::kEapCaCertNssProperty, &kStringSignature },
67 { eap::kUseSystemCAs, flimflam::kEapUseSystemCasProperty, &kBoolSignature },
68 { NULL } 62 { NULL }
69 }; 63 };
70 64
71 const OncFieldSignature ipsec_fields[] = { 65 const OncFieldSignature ipsec_fields[] = {
72 { kRecommended, NULL, &kRecommendedSignature }, 66 { kRecommended, &kRecommendedSignature },
73 // Ignored by Shill, not necessary to synchronize. 67 { vpn::kAuthenticationType, &kStringSignature },
74 // Would be: flimflam::kL2tpIpsecAuthenticationType 68 { vpn::kClientCertPattern, &kCertificatePatternSignature },
75 { vpn::kAuthenticationType, NULL, &kStringSignature }, 69 { vpn::kClientCertRef, &kStringSignature },
76 { vpn::kClientCertPattern, NULL, &kCertificatePatternSignature }, 70 { vpn::kClientCertType, &kStringSignature },
77 { vpn::kClientCertRef, NULL, &kStringSignature }, 71 { vpn::kGroup, &kStringSignature },
78 { vpn::kClientCertType, NULL, &kStringSignature }, 72 { vpn::kIKEVersion, &kIntegerSignature },
79 { vpn::kGroup, flimflam::kL2tpIpsecGroupNameProperty, &kStringSignature }, 73 { vpn::kPSK, &kStringSignature },
80 // Ignored by Shill, not necessary to synchronize. 74 { vpn::kSaveCredentials, &kBoolSignature },
81 // Would be: flimflam::kL2tpIpsecIkeVersion 75 { vpn::kServerCARef, &kStringSignature },
82 { vpn::kIKEVersion, NULL, &kIntegerSignature },
83 { vpn::kPSK, flimflam::kL2tpIpsecPskProperty, &kStringSignature },
84 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty,
85 &kBoolSignature },
86 { vpn::kServerCARef, flimflam::kL2tpIpsecCaCertNssProperty,
87 &kStringSignature },
88 // Not yet supported. 76 // Not yet supported.
89 // { vpn::kEAP, NULL, &kEAPSignature }, 77 // { vpn::kEAP, &kEAPSignature },
90 // { vpn::kXAUTH, NULL, &kXAUTHSignature }, 78 // { vpn::kXAUTH, &kXAUTHSignature },
91 { NULL } 79 { NULL }
92 }; 80 };
93 81
94 const OncFieldSignature l2tp_fields[] = { 82 const OncFieldSignature l2tp_fields[] = {
95 { kRecommended, NULL, &kRecommendedSignature }, 83 { kRecommended, &kRecommendedSignature },
96 { vpn::kPassword, flimflam::kL2tpIpsecPasswordProperty, &kStringSignature }, 84 { vpn::kPassword, &kStringSignature },
97 // We don't synchronize l2tp's SaveCredentials field for now, as Shill doesn't 85 { vpn::kSaveCredentials, &kBoolSignature },
98 // support separate settings for ipsec and l2tp. 86 { vpn::kUsername, &kStringSignature },
99 { vpn::kSaveCredentials, NULL, &kBoolSignature },
100 { vpn::kUsername, flimflam::kL2tpIpsecUserProperty, &kStringSignature },
101 { NULL } 87 { NULL }
102 }; 88 };
103 89
104 const OncFieldSignature openvpn_fields[] = { 90 const OncFieldSignature openvpn_fields[] = {
105 { kRecommended, NULL, &kRecommendedSignature }, 91 { kRecommended, &kRecommendedSignature },
106 { vpn::kAuth, flimflam::kOpenVPNAuthProperty, &kStringSignature }, 92 { vpn::kAuth, &kStringSignature },
107 { vpn::kAuthNoCache, flimflam::kOpenVPNAuthNoCacheProperty, &kBoolSignature }, 93 { vpn::kAuthNoCache, &kBoolSignature },
108 { vpn::kAuthRetry, flimflam::kOpenVPNAuthRetryProperty, &kStringSignature }, 94 { vpn::kAuthRetry, &kStringSignature },
109 { vpn::kCipher, flimflam::kOpenVPNCipherProperty, &kStringSignature }, 95 { vpn::kCipher, &kStringSignature },
110 { vpn::kClientCertPattern, NULL, &kCertificatePatternSignature }, 96 { vpn::kClientCertPattern, &kCertificatePatternSignature },
111 { vpn::kClientCertRef, NULL, &kStringSignature }, 97 { vpn::kClientCertRef, &kStringSignature },
112 { vpn::kClientCertType, NULL, &kStringSignature }, 98 { vpn::kClientCertType, &kStringSignature },
113 { vpn::kCompLZO, flimflam::kOpenVPNCompLZOProperty, &kStringSignature }, 99 { vpn::kCompLZO, &kStringSignature },
114 { vpn::kCompNoAdapt, flimflam::kOpenVPNCompNoAdaptProperty, &kBoolSignature }, 100 { vpn::kCompNoAdapt, &kBoolSignature },
115 { vpn::kKeyDirection, flimflam::kOpenVPNKeyDirectionProperty, 101 { vpn::kKeyDirection, &kStringSignature },
116 &kStringSignature }, 102 { vpn::kNsCertType, &kStringSignature },
117 { vpn::kNsCertType, flimflam::kOpenVPNNsCertTypeProperty, &kStringSignature }, 103 { vpn::kPassword, &kStringSignature },
118 { vpn::kPassword, flimflam::kOpenVPNPasswordProperty, &kStringSignature }, 104 { vpn::kPort, &kIntegerSignature },
119 { vpn::kPort, flimflam::kOpenVPNPortProperty, &kIntegerSignature }, 105 { vpn::kProto, &kStringSignature },
120 { vpn::kProto, flimflam::kOpenVPNProtoProperty, &kStringSignature }, 106 { vpn::kPushPeerInfo, &kBoolSignature },
121 { vpn::kPushPeerInfo, flimflam::kOpenVPNPushPeerInfoProperty, 107 { vpn::kRemoteCertEKU, &kStringSignature },
122 &kBoolSignature }, 108 { vpn::kRemoteCertKU, &kStringListSignature },
123 { vpn::kRemoteCertEKU, flimflam::kOpenVPNRemoteCertEKUProperty, 109 { vpn::kRemoteCertTLS, &kStringSignature },
124 &kStringSignature }, 110 { vpn::kRenegSec, &kIntegerSignature },
125 // This field is converted during translation, see onc_translator_*. 111 { vpn::kSaveCredentials, &kBoolSignature },
126 { vpn::kRemoteCertKU, NULL, &kStringListSignature }, 112 { vpn::kServerCARef, &kStringSignature },
127 { vpn::kRemoteCertTLS, flimflam::kOpenVPNRemoteCertTLSProperty, 113 // Not supported, yet.
128 &kStringSignature }, 114 { vpn::kServerCertRef, &kStringSignature },
129 { vpn::kRenegSec, flimflam::kOpenVPNRenegSecProperty, &kIntegerSignature }, 115 { vpn::kServerPollTimeout, &kIntegerSignature },
130 { vpn::kSaveCredentials, flimflam::kSaveCredentialsProperty, 116 { vpn::kShaper, &kIntegerSignature },
131 &kBoolSignature }, 117 { vpn::kStaticChallenge, &kStringSignature },
132 { vpn::kServerCARef, flimflam::kOpenVPNCaCertNSSProperty, &kStringSignature }, 118 { vpn::kTLSAuthContents, &kStringSignature },
133 // Not supported, yet. 119 { vpn::kTLSRemote, &kStringSignature },
134 { vpn::kServerCertRef, NULL, &kStringSignature }, 120 { vpn::kUsername, &kStringSignature },
135 { vpn::kServerPollTimeout, flimflam::kOpenVPNServerPollTimeoutProperty, 121 // Not supported, yet.
136 &kIntegerSignature }, 122 { vpn::kVerb, &kStringSignature },
137 { vpn::kShaper, flimflam::kOpenVPNShaperProperty, &kIntegerSignature },
138 { vpn::kStaticChallenge, flimflam::kOpenVPNStaticChallengeProperty,
139 &kStringSignature },
140 { vpn::kTLSAuthContents, flimflam::kOpenVPNTLSAuthContentsProperty,
141 &kStringSignature },
142 { vpn::kTLSRemote, flimflam::kOpenVPNTLSRemoteProperty, &kStringSignature },
143 { vpn::kUsername, flimflam::kOpenVPNUserProperty, &kStringSignature },
144 // Not supported, yet.
145 { vpn::kVerb, NULL, &kStringSignature },
146 { NULL } 123 { NULL }
147 }; 124 };
148 125
149 const OncFieldSignature vpn_fields[] = { 126 const OncFieldSignature vpn_fields[] = {
150 { kRecommended, NULL, &kRecommendedSignature }, 127 { kRecommended, &kRecommendedSignature },
151 { vpn::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, 128 { vpn::kAutoConnect, &kBoolSignature },
152 { vpn::kHost, flimflam::kProviderHostProperty, &kStringSignature }, 129 { vpn::kHost, &kStringSignature },
153 { vpn::kIPsec, NULL, &kIPsecSignature }, 130 { vpn::kIPsec, &kIPsecSignature },
154 { vpn::kL2TP, NULL, &kL2TPSignature }, 131 { vpn::kL2TP, &kL2TPSignature },
155 { vpn::kOpenVPN, NULL, &kOpenVPNSignature }, 132 { vpn::kOpenVPN, &kOpenVPNSignature },
156 // This field is converted during translation, see onc_translator_*. 133 { vpn::kType, &kStringSignature },
157 { vpn::kType, NULL, &kStringSignature },
158 { NULL } 134 { NULL }
159 }; 135 };
160 136
161 const OncFieldSignature ethernet_fields[] = { 137 const OncFieldSignature ethernet_fields[] = {
162 { kRecommended, NULL, &kRecommendedSignature }, 138 { kRecommended, &kRecommendedSignature },
163 // Not supported, yet. 139 // Not supported, yet.
164 { ethernet::kAuthentication, NULL, &kStringSignature }, 140 { ethernet::kAuthentication, &kStringSignature },
165 { ethernet::kEAP, NULL, &kEAPSignature }, 141 { ethernet::kEAP, &kEAPSignature },
166 { NULL } 142 { NULL }
167 }; 143 };
168 144
169 // Not supported, yet. 145 // Not supported, yet.
170 const OncFieldSignature ipconfig_fields[] = { 146 const OncFieldSignature ipconfig_fields[] = {
171 { ipconfig::kGateway, NULL, &kStringSignature }, 147 { ipconfig::kGateway, &kStringSignature },
172 { ipconfig::kIPAddress, NULL, &kStringSignature }, 148 { ipconfig::kIPAddress, &kStringSignature },
173 { network_config::kNameServers, NULL, &kStringSignature }, 149 { network_config::kNameServers, &kStringSignature },
174 { ipconfig::kRoutingPrefix, NULL, &kIntegerSignature }, 150 { ipconfig::kRoutingPrefix, &kIntegerSignature },
175 { network_config::kSearchDomains, NULL, &kStringListSignature }, 151 { network_config::kSearchDomains, &kStringListSignature },
176 { ipconfig::kType, NULL, &kStringSignature }, 152 { ipconfig::kType, &kStringSignature },
177 { NULL } 153 { NULL }
178 }; 154 };
179 155
180 const OncFieldSignature proxy_location_fields[] = { 156 const OncFieldSignature proxy_location_fields[] = {
181 { proxy::kHost, NULL, &kStringSignature }, 157 { proxy::kHost, &kStringSignature },
182 { proxy::kPort, NULL, &kIntegerSignature }, 158 { proxy::kPort, &kIntegerSignature },
183 { NULL } 159 { NULL }
184 }; 160 };
185 161
186 const OncFieldSignature proxy_manual_fields[] = { 162 const OncFieldSignature proxy_manual_fields[] = {
187 { proxy::kFtp, NULL, &kProxyLocationSignature }, 163 { proxy::kFtp, &kProxyLocationSignature },
188 { proxy::kHttp, NULL, &kProxyLocationSignature }, 164 { proxy::kHttp, &kProxyLocationSignature },
189 { proxy::kHttps, NULL, &kProxyLocationSignature }, 165 { proxy::kHttps, &kProxyLocationSignature },
190 { proxy::kSocks, NULL, &kProxyLocationSignature }, 166 { proxy::kSocks, &kProxyLocationSignature },
191 { NULL } 167 { NULL }
192 }; 168 };
193 169
194 // Proxy settings are converted to Shill by
195 // function ConvertOncProxySettingsToProxyConfig(...).
196 const OncFieldSignature proxy_settings_fields[] = { 170 const OncFieldSignature proxy_settings_fields[] = {
197 { kRecommended, NULL, &kRecommendedSignature }, 171 { kRecommended, &kRecommendedSignature },
198 { proxy::kExcludeDomains, NULL, &kStringListSignature }, 172 { proxy::kExcludeDomains, &kStringListSignature },
199 { proxy::kManual, NULL, &kProxyManualSignature }, 173 { proxy::kManual, &kProxyManualSignature },
200 { proxy::kPAC, NULL, &kStringSignature }, 174 { proxy::kPAC, &kStringSignature },
201 { proxy::kType, NULL, &kStringSignature }, 175 { proxy::kType, &kStringSignature },
202 { NULL } 176 { NULL }
203 }; 177 };
204 178
205 const OncFieldSignature wifi_fields[] = { 179 const OncFieldSignature wifi_fields[] = {
206 { kRecommended, NULL, &kRecommendedSignature }, 180 { kRecommended, &kRecommendedSignature },
207 { wifi::kAutoConnect, flimflam::kAutoConnectProperty, &kBoolSignature }, 181 { wifi::kAutoConnect, &kBoolSignature },
208 // This field is read only, and only converted if translating from Shill->ONC. 182 { wifi::kEAP, &kEAPSignature },
209 { wifi::kBSSID, NULL, &kStringSignature }, 183 { wifi::kHiddenSSID, &kBoolSignature },
210 { wifi::kEAP, NULL, &kEAPSignature }, 184 { wifi::kPassphrase, &kStringSignature },
211 { wifi::kHiddenSSID, flimflam::kWifiHiddenSsid, &kBoolSignature }, 185 { wifi::kSSID, &kStringSignature },
212 { wifi::kPassphrase, flimflam::kPassphraseProperty, &kStringSignature }, 186 { wifi::kSecurity, &kStringSignature },
213 { wifi::kSSID, flimflam::kSSIDProperty, &kStringSignature }, 187 { NULL }
214 // This field is converted during translation, see onc_translator_*. 188 };
215 { wifi::kSecurity, NULL, &kStringSignature }, 189
216 { NULL } 190 const OncFieldSignature wifi_with_state_fields[] = {
217 }; 191 { wifi::kBSSID, &kStringSignature },
218 192 { wifi::kSignalStrength, &kIntegerSignature },
219 const OncFieldSignature cellular_fields[] = { 193 { NULL }
220 { kRecommended, NULL, &kRecommendedSignature }, 194 };
221 { cellular::kActivateOverNonCellularNetwork, 195
222 shill::kActivateOverNonCellularNetworkProperty, &kStringSignature }, 196 const OncFieldSignature cellular_with_state_fields[] = {
223 { cellular::kActivationState, 197 { kRecommended, &kRecommendedSignature },
224 flimflam::kActivationStateProperty, &kStringSignature }, 198 { cellular::kActivateOverNonCellularNetwork, &kStringSignature },
225 { cellular::kAllowRoaming, 199 { cellular::kActivationState, &kStringSignature },
226 flimflam::kCellularAllowRoamingProperty, &kStringSignature }, 200 { cellular::kAllowRoaming, &kStringSignature },
227 { cellular::kAPN, flimflam::kApnProperty, &kStringSignature }, 201 { cellular::kAPN, &kStringSignature },
228 { cellular::kCarrier, flimflam::kCarrierProperty, &kStringSignature }, 202 { cellular::kCarrier, &kStringSignature },
229 { cellular::kESN, flimflam::kEsnProperty, &kStringSignature }, 203 { cellular::kESN, &kStringSignature },
230 { cellular::kFamily, flimflam::kTechnologyFamilyProperty, &kStringSignature }, 204 { cellular::kFamily, &kStringSignature },
231 { cellular::kFirmwareRevision, 205 { cellular::kFirmwareRevision, &kStringSignature },
232 flimflam::kFirmwareRevisionProperty, &kStringSignature }, 206 { cellular::kFoundNetworks, &kStringSignature },
233 { cellular::kFoundNetworks, 207 { cellular::kHardwareRevision, &kStringSignature },
234 flimflam::kFoundNetworksProperty, &kStringSignature }, 208 { cellular::kHomeProvider, &kStringSignature },
235 { cellular::kHardwareRevision, 209 { cellular::kICCID, &kStringSignature },
236 flimflam::kHardwareRevisionProperty, &kStringSignature }, 210 { cellular::kIMEI, &kStringSignature },
237 { cellular::kHomeProvider, 211 { cellular::kIMSI, &kStringSignature },
238 flimflam::kHomeProviderProperty, &kStringSignature }, 212 { cellular::kManufacturer, &kStringSignature },
239 { cellular::kICCID, flimflam::kIccidProperty, &kStringSignature }, 213 { cellular::kMDN, &kStringSignature },
240 { cellular::kIMEI, flimflam::kImeiProperty, &kStringSignature }, 214 { cellular::kMEID, &kStringSignature },
241 { cellular::kIMSI, flimflam::kImsiProperty, &kStringSignature }, 215 { cellular::kMIN, &kStringSignature },
242 { cellular::kManufacturer, 216 { cellular::kModelID, &kStringSignature },
243 flimflam::kManufacturerProperty, &kStringSignature }, 217 { cellular::kNetworkTechnology, &kStringSignature },
244 { cellular::kMDN, flimflam::kMdnProperty, &kStringSignature }, 218 { cellular::kOperatorCode, &kStringSignature },
245 { cellular::kMEID, flimflam::kMeidProperty, &kStringSignature }, 219 { cellular::kOperatorName, &kStringSignature },
246 { cellular::kMIN, flimflam::kMinProperty, &kStringSignature }, 220 { cellular::kPRLVersion, &kStringSignature },
247 { cellular::kModelID, flimflam::kModelIDProperty, &kStringSignature }, 221 { cellular::kProviderRequiresRoaming, &kStringSignature },
248 { cellular::kNetworkTechnology, 222 { cellular::kRoamingState, &kStringSignature },
249 flimflam::kNetworkTechnologyProperty, &kStringSignature }, 223 { cellular::kSelectedNetwork, &kStringSignature },
250 { cellular::kOperatorCode, 224 { cellular::kServingOperator, &kStringSignature },
251 flimflam::kOperatorCodeProperty, &kStringSignature }, 225 { cellular::kSIMLockStatus, &kStringSignature },
252 { cellular::kOperatorName, 226 { cellular::kSIMPresent, &kStringSignature },
253 flimflam::kOperatorNameProperty, &kStringSignature }, 227 { cellular::kSupportedCarriers, &kStringSignature },
254 { cellular::kPRLVersion, flimflam::kPRLVersionProperty, &kStringSignature }, 228 { cellular::kSupportNetworkScan, &kStringSignature },
255 { cellular::kProviderRequiresRoaming,
256 shill::kProviderRequiresRoamingProperty, &kStringSignature },
257 { cellular::kRoamingState,
258 flimflam::kRoamingStateProperty, &kStringSignature },
259 { cellular::kSelectedNetwork,
260 flimflam::kSelectedNetworkProperty, &kStringSignature },
261 { cellular::kServingOperator,
262 flimflam::kServingOperatorProperty, &kStringSignature },
263 { cellular::kSIMLockStatus,
264 flimflam::kSIMLockStatusProperty, &kStringSignature },
265 { cellular::kSIMPresent, shill::kSIMPresentProperty, &kStringSignature },
266 { cellular::kSupportedCarriers,
267 shill::kSupportedCarriersProperty, &kStringSignature },
268 { cellular::kSupportNetworkScan,
269 flimflam::kSupportNetworkScanProperty, &kStringSignature },
270 { NULL } 229 { NULL }
271 }; 230 };
272 231
273 const OncFieldSignature network_configuration_fields[] = { 232 const OncFieldSignature network_configuration_fields[] = {
274 { kRecommended, NULL, &kRecommendedSignature }, 233 { kRecommended, &kRecommendedSignature },
275 { network_config::kEthernet, NULL, &kEthernetSignature }, 234 { network_config::kEthernet, &kEthernetSignature },
276 { network_config::kGUID, flimflam::kGuidProperty, &kStringSignature }, 235 { network_config::kGUID, &kStringSignature },
277 { network_config::kIPConfigs, NULL, &kIPConfigListSignature }, 236 // Not supported, yet.
278 // Shill doesn't allow setting the name for non-VPN networks. 237 { network_config::kIPConfigs, &kIPConfigListSignature },
279 // This field is conditionally translated, see onc_translator_*. 238 { network_config::kName, &kStringSignature },
280 { network_config::kName, NULL, &kStringSignature }, 239 // Not supported, yet.
281 // Not supported, yet. 240 { network_config::kNameServers, &kStringListSignature },
282 { network_config::kNameServers, NULL, &kStringListSignature }, 241 { network_config::kProxySettings, &kProxySettingsSignature },
283 { network_config::kProxySettings, NULL, &kProxySettingsSignature }, 242 { kRemove, &kBoolSignature },
284 // No need to translate. 243 // Not supported, yet.
285 { kRemove, NULL, &kBoolSignature }, 244 { network_config::kSearchDomains, &kStringListSignature },
286 // Not supported, yet. 245 { network_config::kType, &kStringSignature },
287 { network_config::kSearchDomains, NULL, &kStringListSignature }, 246 { network_config::kVPN, &kVPNSignature },
288 // This field is converted during translation, see onc_translator_*. 247 { network_config::kWiFi, &kWiFiSignature },
289 { network_config::kType, NULL, &kStringSignature }, 248 { NULL }
290 { network_config::kVPN, NULL, &kVPNSignature }, 249 };
291 { network_config::kWiFi, NULL, &kWiFiSignature }, 250
292 { network_config::kCellular, NULL, &kCellularSignature }, 251 const OncFieldSignature network_with_state_fields[] = {
293 // This field is converted during translation, see onc_translator_*. 252 { network_config::kCellular, &kCellularWithStateSignature },
294 // It is only converted when going from Shill->ONC, and ignored otherwise. 253 { network_config::kConnectionState, &kStringSignature },
295 { network_config::kConnectionState, NULL, &kStringSignature}, 254 { network_config::kWiFi, &kWiFiWithStateSignature },
296 { NULL } 255 { NULL }
297 }; 256 };
298 257
299 // Certificates are not translated to Shill.
300 const OncFieldSignature certificate_fields[] = { 258 const OncFieldSignature certificate_fields[] = {
301 { certificate::kGUID, NULL, &kStringSignature }, 259 { certificate::kGUID, &kStringSignature },
302 { certificate::kPKCS12, NULL, &kStringSignature }, 260 { certificate::kPKCS12, &kStringSignature },
303 { kRemove, NULL, &kBoolSignature }, 261 { kRemove, &kBoolSignature },
304 { certificate::kTrust, NULL, &kStringListSignature }, 262 { certificate::kTrust, &kStringListSignature },
305 { certificate::kType, NULL, &kStringSignature }, 263 { certificate::kType, &kStringSignature },
306 { certificate::kX509, NULL, &kStringSignature }, 264 { certificate::kX509, &kStringSignature },
307 { NULL } 265 { NULL }
308 }; 266 };
309 267
310 const OncFieldSignature toplevel_configuration_fields[] = { 268 const OncFieldSignature toplevel_configuration_fields[] = {
311 { toplevel_config::kCertificates, NULL, &kCertificateListSignature }, 269 { toplevel_config::kCertificates, &kCertificateListSignature },
312 { toplevel_config::kNetworkConfigurations, NULL, 270 { toplevel_config::kNetworkConfigurations,
313 &kNetworkConfigurationListSignature }, 271 &kNetworkConfigurationListSignature },
314 { toplevel_config::kType, NULL, &kStringSignature }, 272 { toplevel_config::kType, &kStringSignature },
315 { encrypted::kCipher, NULL, &kStringSignature }, 273 { encrypted::kCipher, &kStringSignature },
316 { encrypted::kCiphertext, NULL, &kStringSignature }, 274 { encrypted::kCiphertext, &kStringSignature },
317 { encrypted::kHMAC, NULL, &kStringSignature }, 275 { encrypted::kHMAC, &kStringSignature },
318 { encrypted::kHMACMethod, NULL, &kStringSignature }, 276 { encrypted::kHMACMethod, &kStringSignature },
319 { encrypted::kIV, NULL, &kStringSignature }, 277 { encrypted::kIV, &kStringSignature },
320 { encrypted::kIterations, NULL, &kIntegerSignature }, 278 { encrypted::kIterations, &kIntegerSignature },
321 { encrypted::kSalt, NULL, &kStringSignature }, 279 { encrypted::kSalt, &kStringSignature },
322 { encrypted::kStretch, NULL, &kStringSignature }, 280 { encrypted::kStretch, &kStringSignature },
323 { NULL } 281 { NULL }
324 }; 282 };
325 283
326 } // namespace 284 } // namespace
327 285
328 const OncValueSignature kRecommendedSignature = { 286 const OncValueSignature kRecommendedSignature = {
329 Value::TYPE_LIST, NULL, &kStringSignature 287 Value::TYPE_LIST, NULL, &kStringSignature
330 }; 288 };
331 const OncValueSignature kEAPSignature = { 289 const OncValueSignature kEAPSignature = {
332 Value::TYPE_DICTIONARY, eap_fields, NULL 290 Value::TYPE_DICTIONARY, eap_fields, NULL
333 }; 291 };
334 const OncValueSignature kIssuerSubjectPatternSignature = { 292 const OncValueSignature kIssuerSubjectPatternSignature = {
335 Value::TYPE_DICTIONARY, issuer_subject_pattern_fields, NULL 293 Value::TYPE_DICTIONARY, issuer_subject_pattern_fields, NULL
(...skipping 24 matching lines...) Expand all
360 }; 318 };
361 const OncValueSignature kProxyManualSignature = { 319 const OncValueSignature kProxyManualSignature = {
362 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL 320 Value::TYPE_DICTIONARY, proxy_manual_fields, NULL
363 }; 321 };
364 const OncValueSignature kProxySettingsSignature = { 322 const OncValueSignature kProxySettingsSignature = {
365 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL 323 Value::TYPE_DICTIONARY, proxy_settings_fields, NULL
366 }; 324 };
367 const OncValueSignature kWiFiSignature = { 325 const OncValueSignature kWiFiSignature = {
368 Value::TYPE_DICTIONARY, wifi_fields, NULL 326 Value::TYPE_DICTIONARY, wifi_fields, NULL
369 }; 327 };
370 const OncValueSignature kCellularSignature = {
371 Value::TYPE_DICTIONARY, cellular_fields, NULL
372 };
373 const OncValueSignature kCertificateSignature = { 328 const OncValueSignature kCertificateSignature = {
374 Value::TYPE_DICTIONARY, certificate_fields, NULL 329 Value::TYPE_DICTIONARY, certificate_fields, NULL
375 }; 330 };
376 const OncValueSignature kNetworkConfigurationSignature = { 331 const OncValueSignature kNetworkConfigurationSignature = {
377 Value::TYPE_DICTIONARY, network_configuration_fields, NULL 332 Value::TYPE_DICTIONARY, network_configuration_fields, NULL
378 }; 333 };
379 const OncValueSignature kCertificateListSignature = { 334 const OncValueSignature kCertificateListSignature = {
380 Value::TYPE_LIST, NULL, &kCertificateSignature 335 Value::TYPE_LIST, NULL, &kCertificateSignature
381 }; 336 };
382 const OncValueSignature kNetworkConfigurationListSignature = { 337 const OncValueSignature kNetworkConfigurationListSignature = {
383 Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature 338 Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature
384 }; 339 };
385 const OncValueSignature kToplevelConfigurationSignature = { 340 const OncValueSignature kToplevelConfigurationSignature = {
386 Value::TYPE_DICTIONARY, toplevel_configuration_fields, NULL 341 Value::TYPE_DICTIONARY, toplevel_configuration_fields, NULL
387 }; 342 };
388 343
344 // Derived "ONC with State" signatures.
345 const OncValueSignature kNetworkWithStateSignature = {
346 Value::TYPE_DICTIONARY, network_with_state_fields, NULL,
347 &kNetworkConfigurationSignature
348 };
349 const OncValueSignature kWiFiWithStateSignature = {
350 Value::TYPE_DICTIONARY, wifi_with_state_fields, NULL, &kWiFiSignature
351 };
352 const OncValueSignature kCellularWithStateSignature = {
353 Value::TYPE_DICTIONARY, cellular_with_state_fields, NULL
354 };
355
389 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature, 356 const OncFieldSignature* GetFieldSignature(const OncValueSignature& signature,
390 const std::string& onc_field_name) { 357 const std::string& onc_field_name) {
391 if (!signature.fields) 358 if (!signature.fields)
392 return NULL; 359 return NULL;
393 for (const OncFieldSignature* field_signature = signature.fields; 360 for (const OncFieldSignature* field_signature = signature.fields;
394 field_signature->onc_field_name != NULL; ++field_signature) { 361 field_signature->onc_field_name != NULL; ++field_signature) {
395 if (onc_field_name == field_signature->onc_field_name) 362 if (onc_field_name == field_signature->onc_field_name)
396 return field_signature; 363 return field_signature;
397 } 364 }
365 if (signature.base_signature)
366 return GetFieldSignature(*signature.base_signature, onc_field_name);
398 return NULL; 367 return NULL;
399 } 368 }
400 369
401 } // namespace onc 370 } // namespace onc
402 } // namespace chromeos 371 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_signature.h ('k') | chromeos/network/onc/onc_translation_tables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698