blob: 74236be59c44d35dcd6fc285c1775de01cfc7a8c [file] [log] [blame]
mukesh agrawal8a3188d2011-12-01 20:56:44 +00001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
mukesh agrawalb54601c2011-06-07 17:39:22 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ben Chanc45688b2014-07-02 23:50:45 -07005#ifndef SHILL_WIFI_SERVICE_H_
6#define SHILL_WIFI_SERVICE_H_
mukesh agrawalb54601c2011-06-07 17:39:22 -07007
mukesh agrawal261daca2011-12-02 18:56:56 +00008#include <set>
mukesh agrawalb54601c2011-06-07 17:39:22 -07009#include <string>
10#include <vector>
11
Paul Stewart5baebb72013-03-14 11:43:29 -070012#include <base/memory/scoped_ptr.h>
13
Paul Stewarta283e4e2013-10-22 20:50:14 -070014#include "shill/dbus_properties.h"
Alex Vakulenkoa41ab512014-07-23 14:24:23 -070015#include "shill/dbus_proxies/supplicant-interface.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070016#include "shill/event_dispatcher.h"
Paul Stewart71a4d3b2013-01-18 18:12:56 -080017#include "shill/key_value_store.h"
Chris Masone2b105542011-06-22 10:58:09 -070018#include "shill/refptr_types.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070019#include "shill/service.h"
mukesh agrawalb54601c2011-06-07 17:39:22 -070020
21namespace shill {
22
Paul Stewart5baebb72013-03-14 11:43:29 -070023class CertificateFile;
Chris Masone6791a432011-07-12 13:23:19 -070024class ControlInterface;
25class EventDispatcher;
mukesh agrawal1a056262011-10-05 14:36:54 -070026class Error;
Chris Masone6791a432011-07-12 13:23:19 -070027class Manager;
Thieu Le3426c8f2012-01-11 17:35:11 -080028class Metrics;
Paul Stewart3c504012013-01-17 17:49:58 -080029class WiFiProvider;
Chris Masone6791a432011-07-12 13:23:19 -070030
mukesh agrawalb54601c2011-06-07 17:39:22 -070031class WiFiService : public Service {
32 public:
Paul Stewart0756db92012-01-27 08:34:47 -080033 // TODO(pstew): Storage constants shouldn't need to be public
Paul Stewartee6b3d72013-07-12 16:07:51 -070034 // crbug.com/208736
Paul Stewart0756db92012-01-27 08:34:47 -080035 static const char kStorageHiddenSSID[];
36 static const char kStorageMode[];
37 static const char kStoragePassphrase[];
38 static const char kStorageSecurity[];
Paul Stewart71a4d3b2013-01-18 18:12:56 -080039 static const char kStorageSecurityClass[];
Paul Stewart0756db92012-01-27 08:34:47 -080040 static const char kStorageSSID[];
41
mukesh agrawalb54601c2011-06-07 17:39:22 -070042 WiFiService(ControlInterface *control_interface,
43 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080044 Metrics *metrics,
Chris Masone6791a432011-07-12 13:23:19 -070045 Manager *manager,
Paul Stewart3c504012013-01-17 17:49:58 -080046 WiFiProvider *provider,
mukesh agrawal7ec71312011-11-10 02:08:26 +000047 const std::vector<uint8_t> &ssid,
Chris Masone092df3e2011-08-22 09:41:39 -070048 const std::string &mode,
Paul Stewartced6a0b2011-11-08 15:32:04 -080049 const std::string &security,
50 bool hidden_ssid);
mukesh agrawalb54601c2011-06-07 17:39:22 -070051 ~WiFiService();
Darin Petkov4d6d9412011-08-24 13:19:54 -070052
53 // Inherited from Service.
mukesh agrawaldc7b8442012-09-27 13:48:14 -070054 virtual void Connect(Error *error, const char *reason);
Samuel Tan0d061192014-07-07 15:45:15 -070055 virtual void Disconnect(Error *error, const char *reason);
Paul Stewart81426132012-05-16 10:05:10 -070056 virtual bool Is8021x() const;
57
Paul Stewart3c504012013-01-17 17:49:58 -080058 virtual void AddEndpoint(const WiFiEndpointConstRefPtr &endpoint);
59 virtual void RemoveEndpoint(const WiFiEndpointConstRefPtr &endpoint);
60 virtual int GetEndpointCount() const { return endpoints_.size(); }
mukesh agrawale1d90e92012-02-15 17:36:08 -080061
mukesh agrawalb20776f2012-02-10 16:00:36 -080062 // Called to update the identity of the currently connected endpoint.
mukesh agrawale1d90e92012-02-15 17:36:08 -080063 // To indicate that there is no currently connect endpoint, call with
64 // |endpoint| set to NULL.
Paul Stewart3c504012013-01-17 17:49:58 -080065 virtual void NotifyCurrentEndpoint(const WiFiEndpointConstRefPtr &endpoint);
mukesh agrawalb20776f2012-02-10 16:00:36 -080066 // Called to inform of changes in the properties of an endpoint.
67 // (Not necessarily the currently connected endpoint.)
Paul Stewart3c504012013-01-17 17:49:58 -080068 virtual void NotifyEndpointUpdated(const WiFiEndpointConstRefPtr &endpoint);
mukesh agrawal261daca2011-12-02 18:56:56 +000069
Chris Masone34af2182011-08-22 11:59:36 -070070 // wifi_<MAC>_<BSSID>_<mode_string>_<security_string>
Chris Masone6515aab2011-10-12 16:19:09 -070071 std::string GetStorageIdentifier() const;
Paul Stewarta41e38d2011-11-11 07:47:29 -080072 static bool ParseStorageIdentifier(const std::string &storage_name,
73 std::string *address,
74 std::string *mode,
75 std::string *security);
Chris Masone34af2182011-08-22 11:59:36 -070076
Paul Stewart85aea152013-01-22 09:31:56 -080077 // Iterate over |storage| looking for WiFi servces with "old-style"
78 // properties that don't include explicit type/mode/security, and add
79 // these properties. Returns true if any entries were fixed.
80 static bool FixupServiceEntries(StoreInterface *storage);
81
Paul Stewartd2e1c362013-03-03 19:06:07 -080082 // Validate |mode| against all valid and supported service modes.
83 static bool IsValidMode(const std::string &mode);
84
Paul Stewart3c504012013-01-17 17:49:58 -080085 // Validate |method| against all valid and supported security methods.
86 static bool IsValidSecurityMethod(const std::string &method);
87
Thieu Le48e6d6d2011-12-06 00:40:27 +000088 const std::string &mode() const { return mode_; }
89 const std::string &key_management() const { return GetEAPKeyManagement(); }
90 const std::vector<uint8_t> &ssid() const { return ssid_; }
Christopher Wiley1057cd72013-02-28 15:21:29 -080091 const std::string &bssid() const { return bssid_; }
Ben Chan7fab8972014-08-10 17:14:46 -070092 const std::vector<uint16_t> &frequency_list() const {
93 return frequency_list_;
94 }
95 uint16_t physical_mode() const { return physical_mode_; }
96 uint16_t frequency() const { return frequency_; }
mukesh agrawalb54601c2011-06-07 17:39:22 -070097
Paul Stewarte7de2942013-04-25 17:07:31 -070098 // WiFi services can load from profile entries other than their current
99 // storage identifier. Override the methods from the parent Service
100 // class which pertain to whether this service may be loaded from |storage|.
101 virtual std::string GetLoadableStorageIdentifier(
102 const StoreInterface &storage) const;
103 virtual bool IsLoadableFrom(const StoreInterface &storage) const;
104
Paul Stewartd08f4432011-11-04 07:48:20 -0700105 // Overrride Load and Save from parent Service class. We will call
106 // the parent method.
Paul Stewartd08f4432011-11-04 07:48:20 -0700107 virtual bool Load(StoreInterface *storage);
108 virtual bool Save(StoreInterface *storage);
Paul Stewart65512e12012-03-26 18:01:08 -0700109 virtual bool Unload();
Paul Stewartd08f4432011-11-04 07:48:20 -0700110
Paul Stewart7cc90682014-05-30 17:01:56 -0700111 // Override SetState from parent Service class. We will call the
112 // parent method.
113 virtual void SetState(ConnectState state) override;
114
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000115 virtual bool HasEndpoints() const { return !endpoints_.empty(); }
Paul Stewartcca85b12014-05-30 13:56:35 -0700116 virtual bool IsVisible() const override;
Paul Stewart6ab23a92011-11-09 17:17:47 -0800117 bool IsSecurityMatch(const std::string &security) const;
Paul Stewartbca08f82013-07-09 16:32:37 -0700118
119 // Used by WiFi objects to indicate that the credentials for this network
120 // have been called into question. This method returns true if given this
121 // suspicion, if it is probable that indeed these credentials are likely
122 // to be incorrect. Credentials that have never been used before are
123 // considered suspect by default, while those which have been used
124 // successfully in the past must have this method called a number of times
125 // since the last time ResetSuspectedCredentialsFailures() was called.
126 virtual bool AddSuspectedCredentialFailure();
127 virtual void ResetSuspectedCredentialFailures();
128
Paul Stewartced6a0b2011-11-08 15:32:04 -0800129 bool hidden_ssid() const { return hidden_ssid_; }
Paul Stewarta5e7d5f2013-01-09 18:06:15 -0800130 bool ieee80211w_required() const { return ieee80211w_required_; }
Paul Stewartced6a0b2011-11-08 15:32:04 -0800131
mukesh agrawal6cfe53f2013-08-13 13:39:01 -0700132 void InitializeCustomMetrics() const;
Thieu Leb84ba342012-03-02 15:15:19 -0800133 virtual void SendPostReadyStateMetrics(
Ben Chan7fab8972014-08-10 17:14:46 -0700134 int64_t time_resume_to_ready_milliseconds) const;
Thieu Le48e6d6d2011-12-06 00:40:27 +0000135
Paul Stewart835934a2012-12-06 19:27:09 -0800136 // Clear any cached credentials stored in wpa_supplicant related to |this|.
137 // This will disconnect this service if it is currently connected.
138 void ClearCachedCredentials();
139
Gaurav Shah10109f22011-11-11 20:16:22 -0800140 // Override from parent Service class to correctly update connectability
141 // when the EAP credentials change for 802.1x networks.
Paul Stewartc43cbbe2013-04-11 06:29:30 -0700142 void OnEapCredentialsChanged();
Gaurav Shah10109f22011-11-11 20:16:22 -0800143
Rebecca Silbersteinb6df8b12014-07-10 16:07:08 -0700144 // Called by WiFiService to reset state associated with prior success
145 // of a connection with particular EAP credentials or a passphrase.
146 void OnCredentialChange();
147
Paul Stewart4357f4e2012-04-26 17:39:26 -0700148 // Override from parent Service class to register hidden services once they
149 // have been configured.
150 virtual void OnProfileConfigured();
151
Paul Stewart3c504012013-01-17 17:49:58 -0800152 // Called by WiFiProvider to reset the WiFi device reference on shutdown.
153 virtual void ResetWiFi();
154
Paul Stewarta283e4e2013-10-22 20:50:14 -0700155 // Called by WiFi to retrieve configuration parameters for wpa_supplicant.
156 virtual DBusPropertiesMap GetSupplicantConfigurationParameters() const;
157
Paul Stewart08a54eb2013-03-11 12:07:36 -0700158 // "wpa", "rsn" and "psk" are equivalent from a configuration perspective.
159 // This function maps them all into "psk".
160 static std::string GetSecurityClass(const std::string &security);
161
Peter Qiu574996a2014-04-04 10:55:47 -0700162 virtual bool IsAutoConnectable(const char **reason) const;
163
Wade Guthrie9ec08062013-09-25 15:22:24 -0700164 // Signal level in dBm. If no current endpoint, returns
165 // std::numeric_limits<int>::min().
Ben Chan7fab8972014-08-10 17:14:46 -0700166 int16_t SignalLevel() const;
Wade Guthrie9ec08062013-09-25 15:22:24 -0700167
Peter Qiu49438222014-03-14 14:21:09 -0700168 void set_expecting_disconnect(bool val) { expecting_disconnect_ = val; }
169 bool expecting_disconnect() const { return expecting_disconnect_; }
170
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000171 protected:
mukesh agrawal43970a22013-02-15 16:00:07 -0800172 virtual void SetEAPKeyManagement(const std::string &key_management);
Paul Stewartfa11e282013-12-02 22:04:25 -0800173 virtual std::string GetTethering(Error *error) const override;
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000174
mukesh agrawalb54601c2011-06-07 17:39:22 -0700175 private:
Paul Stewartd08f4432011-11-04 07:48:20 -0700176 friend class WiFiServiceSecurityTest;
Paul Stewart0b950442012-09-11 13:10:08 -0700177 friend class WiFiServiceTest; // SetPassphrase
mukesh agrawale1d90e92012-02-15 17:36:08 -0800178 friend class WiFiServiceUpdateFromEndpointsTest; // SignalToStrength
Thieu Lead1ec2c2012-01-05 23:39:48 +0000179 FRIEND_TEST(MetricsTest, WiFiServicePostReady);
Paul Stewarte4cedde2013-07-17 08:56:44 -0700180 FRIEND_TEST(MetricsTest, WiFiServicePostReadyAdHoc);
Paul Stewart21f40962013-03-01 14:27:28 -0800181 FRIEND_TEST(MetricsTest, WiFiServicePostReadyEAP);
Thieu Lee41a72d2012-02-06 20:46:51 +0000182 FRIEND_TEST(WiFiMainTest, CurrentBSSChangedUpdateServiceEndpoint);
Alex Vakulenko8a532292014-06-16 17:18:44 -0700183 FRIEND_TEST(WiFiProviderTest, OnEndpointAddedWithSecurity); // security_
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000184 FRIEND_TEST(WiFiServiceTest, AutoConnect);
mukesh agrawal8abd2f62012-01-30 14:56:14 -0800185 FRIEND_TEST(WiFiServiceTest, ClearWriteOnlyDerivedProperty); // passphrase_
mukesh agrawal43970a22013-02-15 16:00:07 -0800186 FRIEND_TEST(WiFiServiceTest, ComputeCipher8021x);
Gaurav Shah10109f22011-11-11 20:16:22 -0800187 FRIEND_TEST(WiFiServiceTest, ConnectTask8021x);
Gaurav Shah29d68882012-01-30 19:06:42 -0800188 FRIEND_TEST(WiFiServiceTest, ConnectTaskDynamicWEP);
Gaurav Shahf8721ee2011-11-07 09:12:46 -0800189 FRIEND_TEST(WiFiServiceTest, ConnectTaskPSK);
Gaurav Shah29d68882012-01-30 19:06:42 -0800190 FRIEND_TEST(WiFiServiceTest, ConnectTaskRSN);
Thieu Lef4cbda92011-11-10 23:41:24 +0000191 FRIEND_TEST(WiFiServiceTest, ConnectTaskWEP);
Gaurav Shah29d68882012-01-30 19:06:42 -0800192 FRIEND_TEST(WiFiServiceTest, ConnectTaskWPA);
Paul Stewarta5e7d5f2013-01-09 18:06:15 -0800193 FRIEND_TEST(WiFiServiceTest, ConnectTaskWPA80211w);
Paul Stewartfa11e282013-12-02 22:04:25 -0800194 FRIEND_TEST(WiFiServiceTest, GetTethering);
mukesh agrawal8a3188d2011-12-01 20:56:44 +0000195 FRIEND_TEST(WiFiServiceTest, IsAutoConnectable);
Paul Stewartd08f4432011-11-04 07:48:20 -0700196 FRIEND_TEST(WiFiServiceTest, LoadHidden);
Paul Stewartd8ad3c42012-01-09 12:39:38 -0800197 FRIEND_TEST(WiFiServiceTest, LoadAndUnloadPassphrase);
Paul Stewart6df20bd2013-03-13 19:31:25 -0700198 FRIEND_TEST(WiFiServiceTest, SecurityFromCurrentEndpoint); // GetSecurity
Rebecca Silbersteine99f6642014-07-09 14:04:31 -0700199 FRIEND_TEST(WiFiServiceTest, SetPassphraseResetHasEverConnected);
Paul Stewart835934a2012-12-06 19:27:09 -0800200 FRIEND_TEST(WiFiServiceTest, SetPassphraseRemovesCachedCredentials);
mukesh agrawale1d90e92012-02-15 17:36:08 -0800201 FRIEND_TEST(WiFiServiceTest, SignalToStrength); // SignalToStrength
Paul Stewartbca08f82013-07-09 16:32:37 -0700202 FRIEND_TEST(WiFiServiceTest, SuspectedCredentialFailure);
mukesh agrawal43970a22013-02-15 16:00:07 -0800203 FRIEND_TEST(WiFiServiceTest, UpdateSecurity); // SetEAPKeyManagement
Paul Stewartd08f4432011-11-04 07:48:20 -0700204
mukesh agrawalbf14e942012-03-02 14:36:34 -0800205 static const char kAutoConnNoEndpoint[];
Paul Stewart3c504012013-01-17 17:49:58 -0800206 static const char kAnyDeviceAddress[];
Paul Stewartbca08f82013-07-09 16:32:37 -0700207 static const int kSuspectedCredentialFailureThreshold;
mukesh agrawalbf14e942012-03-02 14:36:34 -0800208
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800209 // Override the base clase implementation, because we need to allow
210 // arguments that aren't base class methods.
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700211 void HelpRegisterConstDerivedString(
212 const std::string &name,
213 std::string(WiFiService::*get)(Error *error));
Paul Stewart6df20bd2013-03-13 19:31:25 -0700214 void HelpRegisterDerivedString(
215 const std::string &name,
216 std::string(WiFiService::*get)(Error *error),
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700217 bool(WiFiService::*set)(const std::string &value, Error *error));
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800218 void HelpRegisterWriteOnlyDerivedString(
Thieu Lef7709452011-11-15 01:13:19 +0000219 const std::string &name,
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700220 bool(WiFiService::*set)(const std::string &value, Error *error),
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800221 void(WiFiService::*clear)(Error *error),
222 const std::string *default_value);
Thieu Lef7709452011-11-15 01:13:19 +0000223
Paul Stewart1cf7eb82013-12-03 19:34:36 -0800224 std::string GetDeviceRpcId(Error *error) const;
mukesh agrawalf6b32092013-04-10 15:49:55 -0700225
mukesh agrawal292dc0f2012-01-26 18:02:46 -0800226 void ClearPassphrase(Error *error);
mukesh agrawal29c13a12011-11-24 00:09:19 +0000227 void UpdateConnectable();
mukesh agrawale1d90e92012-02-15 17:36:08 -0800228 void UpdateFromEndpoints();
mukesh agrawal43970a22013-02-15 16:00:07 -0800229 void UpdateSecurity();
Chris Masone95207da2011-06-29 16:50:49 -0700230
mukesh agrawal43970a22013-02-15 16:00:07 -0800231 static CryptoAlgorithm ComputeCipher8021x(
232 const std::set<WiFiEndpointConstRefPtr> &endpoints);
Thieu Lef4cbda92011-11-10 23:41:24 +0000233 static void ValidateWEPPassphrase(const std::string &passphrase,
234 Error *error);
235 static void ValidateWPAPassphrase(const std::string &passphrase,
236 Error *error);
237 static void ParseWEPPassphrase(const std::string &passphrase,
238 int *key_index,
Ben Chan7fab8972014-08-10 17:14:46 -0700239 std::vector<uint8_t> *password_bytes,
Thieu Lef4cbda92011-11-10 23:41:24 +0000240 Error *error);
mukesh agrawal1a056262011-10-05 14:36:54 -0700241 static bool CheckWEPIsHex(const std::string &passphrase, Error *error);
242 static bool CheckWEPKeyIndex(const std::string &passphrase, Error *error);
243 static bool CheckWEPPrefix(const std::string &passphrase, Error *error);
244
mukesh agrawal8f3f7752012-02-17 19:42:09 -0800245 // Maps a signal value, in dBm, to a "strength" value, from
246 // |Service::kStrengthMin| to |Service:kStrengthMax|.
Ben Chan7fab8972014-08-10 17:14:46 -0700247 static uint8_t SignalToStrength(int16_t signal_dbm);
mukesh agrawale1d90e92012-02-15 17:36:08 -0800248
Paul Stewart71a4d3b2013-01-18 18:12:56 -0800249 // Create a default group name for this WiFi service.
250 std::string GetDefaultStorageIdentifier() const;
251
Paul Stewart6df20bd2013-03-13 19:31:25 -0700252 // Return the security of this service. If connected, the security
253 // reported from the currently connected endpoint is returned. Otherwise
254 // the configured security for the service is returned.
255 std::string GetSecurity(Error *error);
256
Paul Stewartd08f4432011-11-04 07:48:20 -0700257 // Profile data for a WPA/RSN service can be stored under a number of
Paul Stewart71a4d3b2013-01-18 18:12:56 -0800258 // different security types. These functions create different storage
259 // property lists based on whether they are saved with their generic
260 // "psk" name or if they use the (legacy) specific "wpa" or "rsn" names.
261 KeyValueStore GetStorageProperties() const;
Paul Stewartd08f4432011-11-04 07:48:20 -0700262
Paul Stewart0b950442012-09-11 13:10:08 -0700263 // Validate then apply a passphrase for this service.
mukesh agrawalbebf1b82013-04-23 15:06:33 -0700264 bool SetPassphrase(const std::string &passphrase, Error *error);
Paul Stewart0b950442012-09-11 13:10:08 -0700265
Paul Stewart3c504012013-01-17 17:49:58 -0800266 // Select a WiFi device (e.g, for connecting a hidden service with no
267 // endpoints).
268 WiFiRefPtr ChooseDevice();
269
mukesh agrawalcbfb34e2013-04-17 19:33:25 -0700270 void SetWiFi(const WiFiRefPtr &new_wifi);
Paul Stewart3c504012013-01-17 17:49:58 -0800271
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700272 // Properties
273 std::string passphrase_;
274 bool need_passphrase_;
mukesh agrawalcbfb34e2013-04-17 19:33:25 -0700275 const std::string security_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700276 // TODO(cmasone): see if the below can be pulled from the endpoint associated
277 // with this service instead.
Chris Masone092df3e2011-08-22 09:41:39 -0700278 const std::string mode_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700279 std::string auth_mode_;
280 bool hidden_ssid_;
Ben Chan7fab8972014-08-10 17:14:46 -0700281 uint16_t frequency_;
282 std::vector<uint16_t> frequency_list_;
283 uint16_t physical_mode_;
Paul Stewart23b393a2012-09-25 21:21:06 -0700284 // The raw dBm signal strength from the associated endpoint.
Ben Chan7fab8972014-08-10 17:14:46 -0700285 int16_t raw_signal_strength_;
mukesh agrawal32399322011-09-01 10:53:43 -0700286 std::string hex_ssid_;
Paul Stewartd08f4432011-11-04 07:48:20 -0700287 std::string storage_identifier_;
mukesh agrawal923f14f2012-06-04 16:46:08 -0700288 std::string bssid_;
Paul Stewart72b2fdc2012-06-02 08:58:51 -0700289 Stringmap vendor_information_;
Paul Stewartbdbd3c32013-04-17 09:47:21 -0700290 // The country code reported by the current endpoint.
291 std::string country_code_;
mukesh agrawal43970a22013-02-15 16:00:07 -0800292 // If |security_| == kSecurity8021x, the crypto algorithm being used.
293 // (Otherwise, crypto algorithm is implied by |security_|.)
294 CryptoAlgorithm cipher_8021x_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -0700295
Paul Stewartbca08f82013-07-09 16:32:37 -0700296 // Track the number of consecutive times our current credentials have
297 // been called into question.
298 int suspected_credential_failures_;
299
mukesh agrawale1d90e92012-02-15 17:36:08 -0800300 // Track whether or not we've warned about large signal values.
301 // Used to avoid spamming the log.
302 static bool logged_signal_warning;
Paul Stewartbca08f82013-07-09 16:32:37 -0700303
Chris Masone2b105542011-06-22 10:58:09 -0700304 WiFiRefPtr wifi_;
mukesh agrawal261daca2011-12-02 18:56:56 +0000305 std::set<WiFiEndpointConstRefPtr> endpoints_;
mukesh agrawale1d90e92012-02-15 17:36:08 -0800306 WiFiEndpointConstRefPtr current_endpoint_;
mukesh agrawalb54601c2011-06-07 17:39:22 -0700307 const std::vector<uint8_t> ssid_;
Paul Stewarta5e7d5f2013-01-09 18:06:15 -0800308 // Track whether IEEE 802.11w (Protected Management Frame) support is
309 // mandated by one or more endpoints we have seen that provide this service.
310 bool ieee80211w_required_;
Peter Qiu49438222014-03-14 14:21:09 -0700311 // Flag indicating if service disconnect is initiated by user for
312 // connecting to other service.
313 bool expecting_disconnect_;
Paul Stewart5baebb72013-03-14 11:43:29 -0700314 scoped_ptr<CertificateFile> certificate_file_;
Paul Stewart3c504012013-01-17 17:49:58 -0800315 // Bare pointer is safe because WiFi service instances are owned by
316 // the WiFiProvider and are guaranteed to be deallocated by the time
317 // the WiFiProvider is.
318 WiFiProvider *provider_;
319
mukesh agrawalb54601c2011-06-07 17:39:22 -0700320 DISALLOW_COPY_AND_ASSIGN(WiFiService);
321};
322
323} // namespace shill
324
Ben Chanc45688b2014-07-02 23:50:45 -0700325#endif // SHILL_WIFI_SERVICE_H_