blob: 489fe5c320d8892f99437201b933539bd2557a78 [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Chris Masoneb2e326b2011-07-12 13:28:51 -07005#include "shill/service.h"
6
Paul Stewart75897df2011-04-27 09:05:53 -07007#include <time.h>
Paul Stewart75897df2011-04-27 09:05:53 -07008#include <stdio.h>
Chris Masoneee929b72011-05-10 10:02:18 -07009
Chris Masone8fe2c7e2011-06-09 15:51:19 -070010#include <map>
Paul Stewart75897df2011-04-27 09:05:53 -070011#include <string>
Chris Masone8fe2c7e2011-06-09 15:51:19 -070012#include <vector>
Paul Stewart75897df2011-04-27 09:05:53 -070013
Chris Masoneee929b72011-05-10 10:02:18 -070014#include <base/logging.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070015#include <base/memory/scoped_ptr.h>
mukesh agrawal51a7e932011-07-27 16:18:26 -070016#include <base/string_number_conversions.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070017#include <chromeos/dbus/service_constants.h>
Chris Masoneee929b72011-05-10 10:02:18 -070018
Paul Stewart75897df2011-04-27 09:05:53 -070019#include "shill/control_interface.h"
Chris Masone8fe2c7e2011-06-09 15:51:19 -070020#include "shill/error.h"
Chris Masone6791a432011-07-12 13:23:19 -070021#include "shill/manager.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070022#include "shill/profile.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070023#include "shill/property_accessor.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070024#include "shill/refptr_types.h"
Chris Masoned7732e42011-05-20 11:08:56 -070025#include "shill/service_dbus_adaptor.h"
Darin Petkovba40dd32011-07-11 20:06:39 -070026#include "shill/store_interface.h"
Paul Stewart75897df2011-04-27 09:05:53 -070027
Chris Masone8fe2c7e2011-06-09 15:51:19 -070028using std::map;
Paul Stewart75897df2011-04-27 09:05:53 -070029using std::string;
Chris Masone8fe2c7e2011-06-09 15:51:19 -070030using std::vector;
Paul Stewart75897df2011-04-27 09:05:53 -070031
32namespace shill {
Darin Petkovba40dd32011-07-11 20:06:39 -070033
34const char Service::kCheckPortalAuto[] = "auto";
35const char Service::kCheckPortalFalse[] = "false";
36const char Service::kCheckPortalTrue[] = "true";
37
Paul Stewartac4ac002011-08-26 12:04:26 -070038const int Service::kPriorityNone = 0;
39
Darin Petkovba40dd32011-07-11 20:06:39 -070040const char Service::kStorageAutoConnect[] = "AutoConnect";
41const char Service::kStorageCheckPortal[] = "CheckPortal";
42const char Service::kStorageEapAnonymousIdentity[] = "EAP.AnonymousIdentity";
43const char Service::kStorageEapCACert[] = "EAP.CACert";
44const char Service::kStorageEapCACertID[] = "EAP.CACertID";
45const char Service::kStorageEapCertID[] = "EAP.CertID";
46const char Service::kStorageEapClientCert[] = "EAP.ClientCert";
47const char Service::kStorageEapEap[] = "EAP.EAP";
48const char Service::kStorageEapIdentity[] = "EAP.Identity";
49const char Service::kStorageEapInnerEap[] = "EAP.InnerEAP";
50const char Service::kStorageEapKeyID[] = "EAP.KeyID";
51const char Service::kStorageEapKeyManagement[] = "EAP.KeyMgmt";
52const char Service::kStorageEapPIN[] = "EAP.PIN";
53const char Service::kStorageEapPassword[] = "EAP.Password";
54const char Service::kStorageEapPrivateKey[] = "EAP.PrivateKey";
55const char Service::kStorageEapPrivateKeyPassword[] = "EAP.PrivateKeyPassword";
56const char Service::kStorageEapUseSystemCAs[] = "EAP.UseSystemCAs";
57const char Service::kStorageFavorite[] = "Favorite";
58const char Service::kStorageName[] = "Name";
59const char Service::kStoragePriority[] = "Priority";
60const char Service::kStorageProxyConfig[] = "ProxyConfig";
61const char Service::kStorageSaveCredentials[] = "SaveCredentials";
62
mukesh agrawal51a7e932011-07-27 16:18:26 -070063// static
64unsigned int Service::serial_number_ = 0;
65
Paul Stewart75897df2011-04-27 09:05:53 -070066Service::Service(ControlInterface *control_interface,
mukesh agrawalb54601c2011-06-07 17:39:22 -070067 EventDispatcher *dispatcher,
mukesh agrawal7a4e4002011-09-06 11:26:05 -070068 Manager *manager,
69 const string &type)
Paul Stewart03dba0b2011-08-22 16:32:45 -070070 : state_(kStateUnknown),
71 failure_(kFailureUnknown),
72 auto_connect_(false),
Darin Petkovba40dd32011-07-11 20:06:39 -070073 check_portal_(kCheckPortalAuto),
Chris Masone3bd3c8c2011-06-13 08:20:26 -070074 connectable_(false),
75 favorite_(false),
Darin Petkovba40dd32011-07-11 20:06:39 -070076 priority_(kPriorityNone),
Paul Stewart22aa71b2011-09-16 12:15:11 -070077 security_(0),
78 strength_(0),
Darin Petkovba40dd32011-07-11 20:06:39 -070079 save_credentials_(true),
mukesh agrawal7a4e4002011-09-06 11:26:05 -070080 type_(type),
Chris Masone3bd3c8c2011-06-13 08:20:26 -070081 dispatcher_(dispatcher),
mukesh agrawal51a7e932011-07-27 16:18:26 -070082 name_(base::UintToString(serial_number_++)),
Chris Masonea82b7112011-05-25 15:16:29 -070083 available_(false),
84 configured_(false),
Chris Masonea82b7112011-05-25 15:16:29 -070085 configuration_(NULL),
86 connection_(NULL),
Chris Masone6791a432011-07-12 13:23:19 -070087 adaptor_(control_interface->CreateServiceAdaptor(this)),
88 manager_(manager) {
Chris Masone3bd3c8c2011-06-13 08:20:26 -070089
Chris Masone27c4aa52011-07-02 13:10:14 -070090 store_.RegisterBool(flimflam::kAutoConnectProperty, &auto_connect_);
Chris Masone4d42df82011-07-02 17:09:39 -070091
92 // flimflam::kActivationStateProperty: Registered in CellularService
93 // flimflam::kCellularApnProperty: Registered in CellularService
94 // flimflam::kCellularLastGoodApnProperty: Registered in CellularService
95 // flimflam::kNetworkTechnologyProperty: Registered in CellularService
Darin Petkov3335b372011-08-22 11:05:32 -070096 // flimflam::kOperatorNameProperty: DEPRECATED
97 // flimflam::kOperatorCodeProperty: DEPRECATED
Chris Masone4d42df82011-07-02 17:09:39 -070098 // flimflam::kRoamingStateProperty: Registered in CellularService
Darin Petkov3335b372011-08-22 11:05:32 -070099 // flimflam::kServingOperatorProperty: Registered in CellularService
Chris Masone4d42df82011-07-02 17:09:39 -0700100 // flimflam::kPaymentURLProperty: Registered in CellularService
101
Chris Masone27c4aa52011-07-02 13:10:14 -0700102 store_.RegisterString(flimflam::kCheckPortalProperty, &check_portal_);
103 store_.RegisterConstBool(flimflam::kConnectableProperty, &connectable_);
104 HelpRegisterDerivedString(flimflam::kDeviceProperty,
105 &Service::GetDeviceRpcId,
106 NULL);
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700107
Chris Masoneb2e326b2011-07-12 13:28:51 -0700108 store_.RegisterString(flimflam::kEapIdentityProperty, &eap_.identity);
109 store_.RegisterString(flimflam::kEAPEAPProperty, &eap_.eap);
110 store_.RegisterString(flimflam::kEapPhase2AuthProperty, &eap_.inner_eap);
Chris Masone27c4aa52011-07-02 13:10:14 -0700111 store_.RegisterString(flimflam::kEapAnonymousIdentityProperty,
Chris Masoneb2e326b2011-07-12 13:28:51 -0700112 &eap_.anonymous_identity);
113 store_.RegisterString(flimflam::kEAPClientCertProperty, &eap_.client_cert);
114 store_.RegisterString(flimflam::kEAPCertIDProperty, &eap_.cert_id);
115 store_.RegisterString(flimflam::kEapPrivateKeyProperty, &eap_.private_key);
Chris Masone27c4aa52011-07-02 13:10:14 -0700116 store_.RegisterString(flimflam::kEapPrivateKeyPasswordProperty,
Chris Masoneb2e326b2011-07-12 13:28:51 -0700117 &eap_.private_key_password);
118 store_.RegisterString(flimflam::kEAPKeyIDProperty, &eap_.key_id);
119 store_.RegisterString(flimflam::kEapCaCertProperty, &eap_.ca_cert);
120 store_.RegisterString(flimflam::kEapCaCertIDProperty, &eap_.ca_cert_id);
121 store_.RegisterString(flimflam::kEAPPINProperty, &eap_.pin);
122 store_.RegisterString(flimflam::kEapPasswordProperty, &eap_.password);
123 store_.RegisterString(flimflam::kEapKeyMgmtProperty, &eap_.key_management);
124 store_.RegisterBool(flimflam::kEapUseSystemCAsProperty, &eap_.use_system_cas);
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700125
Chris Masone27c4aa52011-07-02 13:10:14 -0700126 store_.RegisterConstString(flimflam::kErrorProperty, &error_);
127 store_.RegisterConstBool(flimflam::kFavoriteProperty, &favorite_);
128 HelpRegisterDerivedBool(flimflam::kIsActiveProperty,
Chris Masoneb2e326b2011-07-12 13:28:51 -0700129 &Service::IsActive,
130 NULL);
Chris Masone4d42df82011-07-02 17:09:39 -0700131 // flimflam::kModeProperty: Registered in WiFiService
Chris Masone27c4aa52011-07-02 13:10:14 -0700132 store_.RegisterConstString(flimflam::kNameProperty, &name_);
Chris Masone4d42df82011-07-02 17:09:39 -0700133 // flimflam::kPassphraseProperty: Registered in WiFiService
134 // flimflam::kPassphraseRequiredProperty: Registered in WiFiService
Chris Masone27c4aa52011-07-02 13:10:14 -0700135 store_.RegisterInt32(flimflam::kPriorityProperty, &priority_);
136 HelpRegisterDerivedString(flimflam::kProfileProperty,
137 &Service::GetProfileRpcId,
138 NULL);
Chris Masone4d42df82011-07-02 17:09:39 -0700139 store_.RegisterString(flimflam::kProxyConfigProperty, &proxy_config_);
Chris Masone43b48a12011-07-01 13:37:07 -0700140 // TODO(cmasone): Create VPN Service with this property
Chris Masone27c4aa52011-07-02 13:10:14 -0700141 // store_.RegisterConstStringmap(flimflam::kProviderProperty, &provider_);
Chris Masone4d42df82011-07-02 17:09:39 -0700142
Chris Masoneb2e326b2011-07-12 13:28:51 -0700143 store_.RegisterBool(flimflam::kSaveCredentialsProperty, &save_credentials_);
mukesh agrawal7a4e4002011-09-06 11:26:05 -0700144 store_.RegisterConstString(flimflam::kTypeProperty, &type_);
Chris Masone4d42df82011-07-02 17:09:39 -0700145 // flimflam::kSecurityProperty: Registered in WiFiService
Chris Masone27c4aa52011-07-02 13:10:14 -0700146 HelpRegisterDerivedString(flimflam::kStateProperty,
147 &Service::CalculateState,
148 NULL);
Chris Masone4d42df82011-07-02 17:09:39 -0700149 // flimflam::kSignalStrengthProperty: Registered in WiFi/CellularService
150 // flimflam::kTypeProperty: Registered in all derived classes.
151 // flimflam::kWifiAuthMode: Registered in WiFiService
152 // flimflam::kWifiHiddenSsid: Registered in WiFiService
153 // flimflam::kWifiFrequency: Registered in WiFiService
154 // flimflam::kWifiPhyMode: Registered in WiFiService
155 // flimflam::kWifiHexSsid: Registered in WiFiService
Chris Masoneb07006b2011-05-14 16:10:04 -0700156 VLOG(2) << "Service initialized.";
Paul Stewart75897df2011-04-27 09:05:53 -0700157}
158
Paul Stewartba41b992011-05-26 07:02:46 -0700159Service::~Service() {}
Paul Stewart75897df2011-04-27 09:05:53 -0700160
mukesh agrawal1830fa12011-09-26 14:31:40 -0700161void Service::ActivateCellularModem(const std::string &/*carrier*/,
162 Error *error) {
Darin Petkovb100ae72011-08-24 16:19:45 -0700163 const string kMessage = "Service doesn't support cellular modem activation.";
164 LOG(ERROR) << kMessage;
165 CHECK(error);
166 error->Populate(Error::kInvalidArguments, kMessage);
Darin Petkovc408e692011-08-17 13:47:15 -0700167}
168
mukesh agrawal1830fa12011-09-26 14:31:40 -0700169bool Service::TechnologyIs(const Technology::Identifier /*type*/) const {
Paul Stewart22aa71b2011-09-16 12:15:11 -0700170 return false;
171}
172
Paul Stewart03dba0b2011-08-22 16:32:45 -0700173bool Service::IsActive() {
174 return state_ != kStateUnknown &&
175 state_ != kStateIdle &&
176 state_ != kStateFailure;
177}
178
179void Service::SetState(ConnectState state) {
180 if (state == state_) {
181 return;
182 }
183
184 state_ = state;
185 if (state != kStateFailure) {
186 failure_ = kFailureUnknown;
187 }
188 manager_->UpdateService(this);
mukesh agrawalf2f68a52011-09-01 12:15:48 -0700189 adaptor_->EmitStringChanged(flimflam::kStateProperty, CalculateState());
Paul Stewart03dba0b2011-08-22 16:32:45 -0700190}
191
192void Service::SetFailure(ConnectFailure failure) {
193 failure_ = failure;
194 SetState(kStateFailure);
195}
196
Chris Masone6791a432011-07-12 13:23:19 -0700197string Service::GetRpcIdentifier() const {
Chris Masone3c3f6a12011-07-01 10:01:41 -0700198 return adaptor_->GetRpcIdentifier();
199}
200
Chris Masone9d779932011-08-25 16:33:41 -0700201bool Service::Load(StoreInterface *storage) {
202 const string id = GetStorageIdentifier();
Chris Masone34af2182011-08-22 11:59:36 -0700203 if (!storage->ContainsGroup(id)) {
204 LOG(WARNING) << "Service is not available in the persistent store: " << id;
205 return false;
206 }
207 storage->GetBool(id, kStorageAutoConnect, &auto_connect_);
208 storage->GetString(id, kStorageCheckPortal, &check_portal_);
209 storage->GetBool(id, kStorageFavorite, &favorite_);
210 storage->GetInt(id, kStoragePriority, &priority_);
211 storage->GetString(id, kStorageProxyConfig, &proxy_config_);
212 storage->GetBool(id, kStorageSaveCredentials, &save_credentials_);
213
214 LoadEapCredentials(storage, id);
215
216 // TODO(petkov): Load these:
217
218 // "Name"
219 // "WiFi.HiddenSSID"
220 // "SSID"
221 // "Failure"
222 // "Modified"
223 // "LastAttempt"
224 // WiFiService: "Passphrase"
225 // "APN"
226 // "LastGoodAPN"
227
228 return true;
Darin Petkovba40dd32011-07-11 20:06:39 -0700229}
230
Chris Masone9d779932011-08-25 16:33:41 -0700231bool Service::Save(StoreInterface *storage) {
232 const string id = GetStorageIdentifier();
Chris Masone34af2182011-08-22 11:59:36 -0700233
234 // TODO(petkov): We could choose to simplify the saving code by removing most
235 // conditionals thus saving even default values.
236 if (favorite_) {
237 storage->SetBool(id, kStorageAutoConnect, auto_connect_);
238 }
239 if (check_portal_ == kCheckPortalAuto) {
240 storage->DeleteKey(id, kStorageCheckPortal);
241 } else {
242 storage->SetString(id, kStorageCheckPortal, check_portal_);
243 }
244 storage->SetBool(id, kStorageFavorite, favorite_);
245 storage->SetString(id, kStorageName, name_);
246 SaveString(storage, id, kStorageProxyConfig, proxy_config_, false, true);
247 if (priority_ != kPriorityNone) {
248 storage->SetInt(id, kStoragePriority, priority_);
249 } else {
250 storage->DeleteKey(id, kStoragePriority);
251 }
252 if (save_credentials_) {
253 storage->DeleteKey(id, kStorageSaveCredentials);
254 } else {
255 storage->SetBool(id, kStorageSaveCredentials, false);
256 }
257
258 SaveEapCredentials(storage, id);
259
260 // TODO(petkov): Save these:
261
262 // "WiFi.HiddenSSID"
263 // "SSID"
264 // "Failure"
265 // "Modified"
266 // "LastAttempt"
267 // WiFiService: "Passphrase"
268 // "APN"
269 // "LastGoodAPN"
270
271 return true;
272}
273
Paul Stewart22aa71b2011-09-16 12:15:11 -0700274bool Service::DecideBetween(int a, int b, bool *decision) {
275 if (a == b)
276 return false;
277 *decision = (a > b);
278 return true;
279}
280
281bool Service::Compare(ServiceRefPtr a,
282 ServiceRefPtr b,
283 const vector<Technology::Identifier> &tech_order) {
284 bool ret;
285
286 if (a->state() != b->state()) {
287 if (DecideBetween(a->IsConnected(), b->IsConnected(), &ret)) {
288 return ret;
289 }
290
291 // TODO(pstew): Services don't know about portal state yet
292
293 if (DecideBetween(a->IsConnecting(), b->IsConnecting(), &ret)) {
294 return ret;
295 }
296 }
297
298 if (DecideBetween(a->favorite(), b->favorite(), &ret) ||
299 DecideBetween(a->priority(), b->priority(), &ret)) {
300 return ret;
301 }
302
303 // TODO(pstew): Below this point we are making value judgements on
304 // services that are not related to anything intrinsic or
305 // user-specified. These heuristics should be richer (contain
306 // historical information, for example) and be subject to user
307 // customization.
308
309 for (vector<Technology::Identifier>::const_iterator it = tech_order.begin();
310 it != tech_order.end();
311 ++it) {
312 if (DecideBetween(a->TechnologyIs(*it), b->TechnologyIs(*it), &ret))
313 return ret;
314 }
315
316 if (DecideBetween(a->security(), b->security(), &ret) ||
317 DecideBetween(a->strength(), b->strength(), &ret)) {
318 return ret;
319 }
320
321 return a->UniqueName() < b->UniqueName();
322}
323
Chris Masone34af2182011-08-22 11:59:36 -0700324const ProfileRefPtr &Service::profile() const { return profile_; }
325
326void Service::set_profile(const ProfileRefPtr &p) { profile_ = p; }
327
mukesh agrawalf2f68a52011-09-01 12:15:48 -0700328string Service::CalculateState() {
329 switch (state_) {
330 case kStateConnected:
331 return flimflam::kStateReady;
332 default:
333 // TODO(quiche): provide strings for other states
334 return flimflam::kStateIdle;
335 }
336}
337
Chris Masone27c4aa52011-07-02 13:10:14 -0700338void Service::HelpRegisterDerivedBool(const string &name,
Chris Masone34af2182011-08-22 11:59:36 -0700339 bool(Service::*get)(void),
340 bool(Service::*set)(const bool&)) {
Chris Masone27c4aa52011-07-02 13:10:14 -0700341 store_.RegisterDerivedBool(
342 name,
343 BoolAccessor(new CustomAccessor<Service, bool>(this, get, set)));
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700344}
345
Chris Masone27c4aa52011-07-02 13:10:14 -0700346void Service::HelpRegisterDerivedString(const string &name,
Chris Masone34af2182011-08-22 11:59:36 -0700347 string(Service::*get)(void),
348 bool(Service::*set)(const string&)) {
Chris Masone27c4aa52011-07-02 13:10:14 -0700349 store_.RegisterDerivedString(
350 name,
351 StringAccessor(new CustomAccessor<Service, string>(this, get, set)));
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700352}
353
Darin Petkovba40dd32011-07-11 20:06:39 -0700354void Service::SaveString(StoreInterface *storage,
Chris Masone34af2182011-08-22 11:59:36 -0700355 const string &id,
Darin Petkovba40dd32011-07-11 20:06:39 -0700356 const string &key,
357 const string &value,
358 bool crypted,
359 bool save) {
360 if (value.empty() || !save) {
Chris Masone34af2182011-08-22 11:59:36 -0700361 storage->DeleteKey(id, key);
Darin Petkovba40dd32011-07-11 20:06:39 -0700362 return;
363 }
364 if (crypted) {
Chris Masone34af2182011-08-22 11:59:36 -0700365 storage->SetCryptedString(id, key, value);
Darin Petkovba40dd32011-07-11 20:06:39 -0700366 return;
367 }
Chris Masone34af2182011-08-22 11:59:36 -0700368 storage->SetString(id, key, value);
Darin Petkovba40dd32011-07-11 20:06:39 -0700369}
370
Chris Masone34af2182011-08-22 11:59:36 -0700371void Service::LoadEapCredentials(StoreInterface *storage, const string &id) {
Darin Petkovba40dd32011-07-11 20:06:39 -0700372 storage->GetCryptedString(id, kStorageEapIdentity, &eap_.identity);
373 storage->GetString(id, kStorageEapEap, &eap_.eap);
374 storage->GetString(id, kStorageEapInnerEap, &eap_.inner_eap);
375 storage->GetCryptedString(id,
376 kStorageEapAnonymousIdentity,
377 &eap_.anonymous_identity);
378 storage->GetString(id, kStorageEapClientCert, &eap_.client_cert);
379 storage->GetString(id, kStorageEapCertID, &eap_.cert_id);
380 storage->GetString(id, kStorageEapPrivateKey, &eap_.private_key);
381 storage->GetCryptedString(id,
382 kStorageEapPrivateKeyPassword,
383 &eap_.private_key_password);
384 storage->GetString(id, kStorageEapKeyID, &eap_.key_id);
385 storage->GetString(id, kStorageEapCACert, &eap_.ca_cert);
386 storage->GetString(id, kStorageEapCACertID, &eap_.ca_cert_id);
387 storage->GetBool(id, kStorageEapUseSystemCAs, &eap_.use_system_cas);
388 storage->GetString(id, kStorageEapPIN, &eap_.pin);
389 storage->GetCryptedString(id, kStorageEapPassword, &eap_.password);
390 storage->GetString(id, kStorageEapKeyManagement, &eap_.key_management);
391}
392
Chris Masone34af2182011-08-22 11:59:36 -0700393void Service::SaveEapCredentials(StoreInterface *storage, const string &id) {
Darin Petkovba40dd32011-07-11 20:06:39 -0700394 bool save = save_credentials_;
Chris Masone34af2182011-08-22 11:59:36 -0700395 SaveString(storage, id, kStorageEapIdentity, eap_.identity, true, save);
396 SaveString(storage, id, kStorageEapEap, eap_.eap, false, true);
397 SaveString(storage, id, kStorageEapInnerEap, eap_.inner_eap, false, true);
Darin Petkovba40dd32011-07-11 20:06:39 -0700398 SaveString(storage,
Chris Masone34af2182011-08-22 11:59:36 -0700399 id,
Darin Petkovba40dd32011-07-11 20:06:39 -0700400 kStorageEapAnonymousIdentity,
401 eap_.anonymous_identity,
402 true,
403 save);
Chris Masone34af2182011-08-22 11:59:36 -0700404 SaveString(storage, id, kStorageEapClientCert, eap_.client_cert, false, save);
405 SaveString(storage, id, kStorageEapCertID, eap_.cert_id, false, save);
406 SaveString(storage, id, kStorageEapPrivateKey, eap_.private_key, false, save);
Darin Petkovba40dd32011-07-11 20:06:39 -0700407 SaveString(storage,
Chris Masone34af2182011-08-22 11:59:36 -0700408 id,
Darin Petkovba40dd32011-07-11 20:06:39 -0700409 kStorageEapPrivateKeyPassword,
410 eap_.private_key_password,
411 true,
412 save);
Chris Masone34af2182011-08-22 11:59:36 -0700413 SaveString(storage, id, kStorageEapKeyID, eap_.key_id, false, save);
414 SaveString(storage, id, kStorageEapCACert, eap_.ca_cert, false, true);
415 SaveString(storage, id, kStorageEapCACertID, eap_.ca_cert_id, false, true);
416 storage->SetBool(id, kStorageEapUseSystemCAs, eap_.use_system_cas);
417 SaveString(storage, id, kStorageEapPIN, eap_.pin, false, save);
418 SaveString(storage, id, kStorageEapPassword, eap_.password, true, save);
Darin Petkovba40dd32011-07-11 20:06:39 -0700419 SaveString(storage,
Chris Masone34af2182011-08-22 11:59:36 -0700420 id,
Darin Petkovba40dd32011-07-11 20:06:39 -0700421 kStorageEapKeyManagement,
422 eap_.key_management,
423 false,
424 true);
425}
426
Paul Stewartac4ac002011-08-26 12:04:26 -0700427const string &Service::GetEAPKeyManagement() const {
428 return eap_.key_management;
429}
430
431void Service::SetEAPKeyManagement(const string &key_management) {
432 eap_.key_management = key_management;
433}
434
Paul Stewart75897df2011-04-27 09:05:53 -0700435} // namespace shill