wake_on_wifi.h revision dda4da49919c0d10d84bf70ef4313837345cfb6c
1d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan// Copyright 2014 The Chromium OS Authors. All rights reserved. 2d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan// Use of this source code is governed by a BSD-style license that can be 3d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan// found in the LICENSE file. 4d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 5d6a8b519e3057f52313e502f502a4819a942e089Ben Chan#ifndef SHILL_WIFI_WAKE_ON_WIFI_H_ 6d6a8b519e3057f52313e502f502a4819a942e089Ben Chan#define SHILL_WIFI_WAKE_ON_WIFI_H_ 7d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 83a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include <linux/if_ether.h> 93a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include <netinet/ip.h> 103a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include <netinet/ip6.h> 113a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan 125f4b175bca4a997f186010c177c44489c8ae95b4Samuel Tan#include <set> 13cb3ecf321c52de1e72cdf037a459cd893b7c51dbSamuel Tan#include <string> 143a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include <utility> 153a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include <vector> 163a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan 173a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include <base/cancelable_callback.h> 183a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include <gtest/gtest_prod.h> // for FRIEND_TEST 193a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include <base/memory/ref_counted.h> 203a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include <base/memory/weak_ptr.h> 21787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan#include <components/timers/alarm_timer.h> 223a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 233a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include "shill/callbacks.h" 243a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan#include "shill/ip_address_store.h" 25ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan#include "shill/net/event_history.h" 268d6b59704591ba9fad57751858835dc332dbdd37Peter Qiu#include "shill/net/ip_address.h" 2702e3dc3bc6e9fdb475bd13944f1c6764c921abbbPeter Qiu#include "shill/net/netlink_manager.h" 283a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan#include "shill/refptr_types.h" 293a9c098afcd0456734092388d4aa7275716d33aaSamuel Tan 30d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tannamespace shill { 31d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 32d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tanclass ByteString; 33d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tanclass Error; 343a1bf99b484ad8a9a054518f49046221251d5612Samuel Tanclass EventDispatcher; 353a9c098afcd0456734092388d4aa7275716d33aaSamuel Tanclass GetWakeOnPacketConnMessage; 3666bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tanclass Metrics; 373a9c098afcd0456734092388d4aa7275716d33aaSamuel Tanclass Nl80211Message; 3896e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tanclass PropertyStore; 39d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tanclass SetWakeOnPacketConnMessage; 403a1bf99b484ad8a9a054518f49046221251d5612Samuel Tanclass WiFi; 413a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 423a1bf99b484ad8a9a054518f49046221251d5612Samuel Tanclass WakeOnWiFi { 433a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan public: 44a757752df1b85d8af4590b64d0946b7b2bb0779fSamuel Tan WakeOnWiFi(NetlinkManager *netlink_manager, EventDispatcher *dispatcher, 4566bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan Metrics *metrics); 46fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan virtual ~WakeOnWiFi(); 473a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 4896e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan // Registers |store| with properties related to wake on WiFi. 4996e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan void InitPropertyStore(PropertyStore *store); 5096e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan 5166bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan // Starts |metrics_timer_| so that wake on WiFi related metrics are 5266bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan // periodically collected. 5366bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan void StartMetricsTimer(); 5466bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan 553a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Types of triggers that can cause the NIC to wake the WiFi device. 56787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan enum WakeOnWiFiTrigger { kPattern, kDisconnect, kSSID }; 573a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 583a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Enable the NIC to wake on packets received from |ip_endpoint|. 593a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Note: The actual programming of the NIC only happens before the system 603a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // suspends, in |OnBeforeSuspend|. 6196bdaecf58097e1cc54c5459e3c165de25c82134Samuel Tan void AddWakeOnPacketConnection(const std::string &ip_endpoint, Error *error); 623a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Remove rule to wake on packets received from |ip_endpoint| from the NIC. 633a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Note: The actual programming of the NIC only happens before the system 643a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // suspends, in |OnBeforeSuspend|. 6596bdaecf58097e1cc54c5459e3c165de25c82134Samuel Tan void RemoveWakeOnPacketConnection(const std::string &ip_endpoint, 6696bdaecf58097e1cc54c5459e3c165de25c82134Samuel Tan Error *error); 673a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Remove all rules to wake on incoming packets from the NIC. 683a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Note: The actual programming of the NIC only happens before the system 693a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // suspends, in |OnBeforeSuspend|. 703a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void RemoveAllWakeOnPacketConnections(Error *error); 713a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Given a NL80211_CMD_NEW_WIPHY message |nl80211_message|, parses the 7296bdaecf58097e1cc54c5459e3c165de25c82134Samuel Tan // wake on WiFi capabilities of the NIC and set relevant members of this 733a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // WakeOnWiFi object to reflect the supported capbilities. 743a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void ParseWakeOnWiFiCapabilities(const Nl80211Message &nl80211_message); 753a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Given a NL80211_CMD_NEW_WIPHY message |nl80211_message|, parses the 763a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // wiphy index of the NIC and sets |wiphy_index_| with the parsed index. 773a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void ParseWiphyIndex(const Nl80211Message &nl80211_message); 783a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Performs pre-suspend actions relevant to wake on wireless functionality. 79787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Initiates DHCP lease renewal if there is a lease due to renewal soon, 80787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // then calls WakeOnWiFi::BeforeSuspendActions. 81787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // 82787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Arguments: 83787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |is_connected|: whether the WiFi device is connected. 84402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan // - |has_service_configured_for_autoconnect|: whether there exists at 85c420dd27964a85c8dec8f09d9049287ccba5f95aSamuel Tan // least one service (hidden or not) that is configured for auto-connect. 86787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |done_callback|: callback to invoke when suspend actions have 87787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // completed. 88787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |renew_dhcp_lease_callback|: callback to invoke to initiate DHCP lease 89787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal. 90787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |remove_supplicant_networks_callback|: callback to invoke 91787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // to remove all networks from WPA supplicant. 92787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |have_dhcp_lease|: whether or not there is a DHCP lease to renew. 93787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |time_to_next_lease_renewal|: number of seconds until next DHCP lease 94787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal is due. 95787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan virtual void OnBeforeSuspend( 96787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool is_connected, 97402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan bool has_service_configured_for_autoconnect, 98787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const ResultCallback &done_callback, 99787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &renew_dhcp_lease_callback, 100787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &remove_supplicant_networks_callback, 101787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool have_dhcp_lease, 102787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan uint32_t time_to_next_lease_renewal); 1033a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Performs post-resume actions relevant to wake on wireless functionality. 104fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan virtual void OnAfterResume(); 105787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Performs and post actions to be performed in dark resume. 106787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // When we wake up in dark resume and wake on WiFi is supported, we start a 107787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // timeout timer, and do one of two things depending on whether the WiFi 108787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // device is connected to a service: 109787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - If the WiFi device is connected before suspend, initiate DHCP lease 110787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal. 111787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - Otherwise, WiFi device is not connected, so initiate a scan. 112787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // There are two possible outcomes from these actions: 113787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - A DHCP lease is obtained, either because of connection to a network 114787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // or successful lease renewal. 115787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - The timer expires, so dark resume actions time out. 116787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // In either case, WakeOnWiFi::BeforeSuspendActions is invoked asynchronously. 117787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // If WiFi device is connected (in the case where we got the DHCP lease), 118787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // we start the lease renewal timer, disable wake on SSID, and enable wake on 119787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // disconnect. Otherwise, we stop the lease renewal timer, enable wake on 120787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // SSID, disable wake on disconnect, and remove all networks from WPA 121787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // supplicant. This is the same logic applied before regular suspend, and 122787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // should ensure that the correct actions are taken both before regular 123787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // suspend and suspend in dark resume to maintain connectivity. 124787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // 125787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Arguments: 126787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |is_connected|: whether the WiFi device is connected. 127402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan // - |has_service_configured_for_autoconnect|: whether there exists at 128c420dd27964a85c8dec8f09d9049287ccba5f95aSamuel Tan // least one service (hidden or not) that is configured for auto-connect. 129787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |done_callback|: callback to invoke when dark resume actions have 130787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // completed. 131787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |renew_dhcp_lease_callback|: callback to invoke to initiate DHCP lease 132787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal. 133787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |initate_scan_callback|: callback to invoke to initiate a scan. 134787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |remove_supplicant_networks_callback|: callback to invoke 135787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // to remove all networks from WPA supplicant. 136787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan virtual void OnDarkResume( 137787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool is_connected, 138402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan bool has_service_configured_for_autoconnect, 139787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const ResultCallback &done_callback, 140787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &renew_dhcp_lease_callback, 141787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &initiate_scan_callback, 142787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &remove_supplicant_networks_callback); 143787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Wrapper around WakeOnWiFi::BeforeSuspendActions that checks if shill is 144787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // currently in dark resume before invoking the function. 145787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan virtual void OnDHCPLeaseObtained(bool start_lease_renewal_timer, 146787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan uint32_t time_to_next_lease_renewal); 1471964b5de186ef06fa89a78b27c3a112686bc36f7Samuel Tan // Callback invoked to report whether this WiFi device is connected to 1481964b5de186ef06fa89a78b27c3a112686bc36f7Samuel Tan // a service after waking from suspend. 1491964b5de186ef06fa89a78b27c3a112686bc36f7Samuel Tan virtual void ReportConnectedToServiceAfterWake(bool is_connected); 150402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan // Called in WiFi::ScanDoneTask when there are no WiFi services available 151402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan // for auto-connect after a scan. 152402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan virtual void OnNoAutoConnectableServicesAfterScan( 153402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan bool has_service_configured_for_autoconnect, 154402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan const base::Closure &remove_supplicant_networks_callback); 1553a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 1560e0ac0de9ac592495f780d7c372ba1212d4d374cSamuel Tan bool in_dark_resume() { return in_dark_resume_; } 1570e0ac0de9ac592495f780d7c372ba1212d4d374cSamuel Tan 1583a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan private: 1593a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan friend class WakeOnWiFiTest; // access to several members for tests 1603a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan friend class WiFiObjectTest; // netlink_manager_ 161fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan // Tests that need kWakeOnWiFiDisabled. 162787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 163787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan WakeOnWiFiDisabled_AddWakeOnPacketConnection_ReturnsError); 164787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 165787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan WakeOnWiFiDisabled_RemoveWakeOnPacketConnection_ReturnsError); 166787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 167787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan WakeOnWiFiDisabled_RemoveAllWakeOnPacketConnections_ReturnsError); 168787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 169787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan ParseWiphyIndex_Success); // kDefaultWiphyIndex 170fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan // Tests that need kMaxSetWakeOnPacketRetries. 171787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 1723a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan RetrySetWakeOnPacketConnections_LessThanMaxRetries); 173787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 1743a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan RetrySetWakeOnPacketConnections_MaxAttemptsWithCallbackSet); 175787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 1763a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan RetrySetWakeOnPacketConnections_MaxAttemptsCallbackUnset); 177787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Tests that need WakeOnWiFi::kDarkResumeActionsTimeoutMilliseconds 178787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithMockDispatcher, 179787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan OnBeforeSuspend_DHCPLeaseRenewal); 180ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan // Tests that need WakeOnWiFi::kMaxDarkResumesPerPeriod 181ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithDispatcher, OnBeforeSuspend_ClearsEventHistory); 182ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan FRIEND_TEST(WakeOnWiFiTestWithDispatcher, OnDarkResume_NotConnected_Throttle); 1833a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 184fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan static const char kWakeOnIPAddressPatternsNotSupported[]; 185fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan static const char kWakeOnPacketDisabled[]; 186fb02175e039a683cf9ac875ba0924858de6a08ffSamuel Tan static const char kWakeOnWiFiDisabled[]; 1873a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static const uint32_t kDefaultWiphyIndex; 188f8c0b3bcc1b9e918400c1fe76a9f6991bc32b55bSamuel Tan static const int kVerifyWakeOnWiFiSettingsDelayMilliseconds; 1893a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static const int kMaxSetWakeOnPacketRetries; 19066bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan static const int kMetricsReportingFrequencySeconds; 1915768ad4f08851b73eddb3328794eaa0ab3094bd3Samuel Tan static const uint32_t kDefaultWakeToScanPeriodSeconds; 1927804df459a7f29a7463dbd7f0e8e2fea93ee766dSamuel Tan static const uint32_t kDefaultNetDetectScanPeriodSeconds; 193787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan static const uint32_t kImmediateDHCPLeaseRenewalThresholdSeconds; 194ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan static const int kDarkResumeFrequencySamplingPeriodMinutes; 195ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan static const int kMaxDarkResumesPerPeriod; 196787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan static int64_t DarkResumeActionsTimeoutMilliseconds; // non-const for testing 1973a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan 19896e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan std::string GetWakeOnWiFiFeaturesEnabled(Error *error); 19996e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan bool SetWakeOnWiFiFeaturesEnabled(const std::string &enabled, Error *error); 200740ee07e13d98ee9e0535ffea391326c8da13499Samuel Tan // Helper function to run and reset |suspend_actions_done_callback_|. 201740ee07e13d98ee9e0535ffea391326c8da13499Samuel Tan void RunAndResetSuspendActionsDoneCallback(const Error &error); 2023a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Used for comparison of ByteString pairs in a set. 2033a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool ByteStringPairIsLessThan( 2043a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const std::pair<ByteString, ByteString> &lhs, 2053a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const std::pair<ByteString, ByteString> &rhs); 2063a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates a mask which specifies which bytes in pattern of length 2073a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // |pattern_len| to match against. Bits |offset| to |pattern_len| - 1 are set, 2083a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // which bits 0 to bits 0 to |offset| - 1 are unset. This mask is saved in 2093a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // |mask|. 2103a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static void SetMask(ByteString *mask, uint32_t pattern_len, uint32_t offset); 2113a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates a pattern and mask for a NL80211 message that programs the NIC to 2123a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // wake on packets originating from IP address |ip_addr|. The pattern and mask 2133a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // are saved in |pattern| and |mask| respectively. Returns true iff the 2143a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // pattern and mask are successfully created and written to |pattern| and 2153a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // |mask| respectively. 2163a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool CreateIPAddressPatternAndMask(const IPAddress &ip_addr, 2173a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan ByteString *pattern, 2183a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan ByteString *mask); 2193a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static void CreateIPV4PatternAndMask(const IPAddress &ip_addr, 2203a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan ByteString *pattern, ByteString *mask); 2213a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static void CreateIPV6PatternAndMask(const IPAddress &ip_addr, 2223a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan ByteString *pattern, ByteString *mask); 2233a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates and sets an attribute in a NL80211 message |msg| which indicates 2243a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // the index of the wiphy interface to program. Returns true iff |msg| is 2253a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // successfully configured. 2263a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool ConfigureWiphyIndex(Nl80211Message *msg, int32_t index); 2273a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates and sets attributes in an SetWakeOnPacketConnMessage |msg| so that 2283a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // the message will disable wake-on-packet functionality of the NIC with wiphy 2293a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // index |wiphy_index|. Returns true iff |msg| is successfully configured. 2303a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NOTE: Assumes that |msg| has not been altered since construction. 2313a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool ConfigureDisableWakeOnWiFiMessage(SetWakeOnPacketConnMessage *msg, 2323a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan uint32_t wiphy_index, 2333a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan Error *error); 2343a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates and sets attributes in a SetWakeOnPacketConnMessage |msg| 2353a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // so that the message will program the NIC with wiphy index |wiphy_index| 2363a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // with wake on wireless triggers in |trigs|. If |trigs| contains the 237787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // kPattern trigger, the NIC is programmed to wake on packets from the 2383a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // IP addresses in |addrs|. Returns true iff |msg| is successfully configured. 2393a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NOTE: Assumes that |msg| has not been altered since construction. 2403a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool ConfigureSetWakeOnWiFiSettingsMessage( 2413a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan SetWakeOnPacketConnMessage *msg, const std::set<WakeOnWiFiTrigger> &trigs, 2423a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const IPAddressStore &addrs, uint32_t wiphy_index, Error *error); 2433a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Helper function to ConfigureSetWakeOnWiFiSettingsMessage that creates a 2443a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // single nested attribute inside the attribute list referenced by |patterns| 2453a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // representing a wake-on-packet pattern matching rule with index |patnum|. 2463a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Returns true iff the attribute is successfully created and set. 2473a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NOTE: |patterns| is assumed to reference the nested attribute list 2483a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NL80211_WOWLAN_TRIG_PKT_PATTERN. 2493a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NOTE: |patnum| should be unique across multiple calls to this function to 2503a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // prevent the formation of a erroneous nl80211 message or the overwriting of 2513a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // pattern matching rules. 2523a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool CreateSinglePattern(const IPAddress &ip_addr, 2533a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan AttributeListRefPtr patterns, uint8_t patnum, 2543a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan Error *error); 2553a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Creates and sets attributes in an GetWakeOnPacketConnMessage msg| so that 2563a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // the message will request for wake-on-packet settings information from the 2573a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NIC with wiphy index |wiphy_index|. Returns true iff |msg| is successfully 2583a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // configured. 2593a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NOTE: Assumes that |msg| has not been altered since construction. 2603a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool ConfigureGetWakeOnWiFiSettingsMessage( 2613a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan GetWakeOnPacketConnMessage *msg, uint32_t wiphy_index, Error *error); 2623a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Given a NL80211_CMD_GET_WOWLAN response or NL80211_CMD_SET_WOWLAN request 2633a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // |msg|, returns true iff the wake-on-wifi trigger settings in |msg| match 2643a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // those in |trigs|. Checks that source IP addresses in |msg| match those in 2653a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // |addrs| if the kIPAddress flag is in |trigs|. 2663a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static bool WakeOnWiFiSettingsMatch(const Nl80211Message &msg, 2673a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const std::set<WakeOnWiFiTrigger> &trigs, 2683a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const IPAddressStore &addrs); 269742866741cd8902bfabd3d9731ccc6b4d5052de6Samuel Tan // Handler for NL80211 message error responses from NIC wake on WiFi setting 270742866741cd8902bfabd3d9731ccc6b4d5052de6Samuel Tan // programming attempts. 271742866741cd8902bfabd3d9731ccc6b4d5052de6Samuel Tan void OnWakeOnWiFiSettingsErrorResponse( 272742866741cd8902bfabd3d9731ccc6b4d5052de6Samuel Tan NetlinkManager::AuxilliaryMessageType type, 273742866741cd8902bfabd3d9731ccc6b4d5052de6Samuel Tan const NetlinkMessage *raw_message); 2743a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Message handler for NL80211_CMD_SET_WOWLAN responses. 2753a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan static void OnSetWakeOnPacketConnectionResponse( 2763a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan const Nl80211Message &nl80211_message); 2773a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Request wake on WiFi settings for this WiFi device. 2783a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void RequestWakeOnPacketSettings(); 2793a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Verify that the wake on WiFi settings programmed into the NIC match 2803a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // those recorded locally for this device in |wake_on_packet_connections_| 2813a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // and |wake_on_wifi_triggers_|. 2823a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void VerifyWakeOnWiFiSettings(const Nl80211Message &nl80211_message); 2833a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Sends an NL80211 message to program the NIC with wake on WiFi settings 2843a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // configured in |wake_on_packet_connections_| and |wake_on_wifi_triggers_|. 2853a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // If |wake_on_wifi_triggers_| is empty, calls |DisableWakeOnWiFi|. 2863a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void ApplyWakeOnWiFiSettings(); 2873a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Helper function called by |ApplyWakeOnWiFiSettings| that sends an NL80211 2883a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // message to program the NIC to disable wake on WiFi. 2893a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void DisableWakeOnWiFi(); 2903a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Calls |ApplyWakeOnWiFiSettings| and counts this call as 2913a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // a retry. If |kMaxSetWakeOnPacketRetries| retries have already been 2923a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // performed, resets counter and returns. 2933a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan void RetrySetWakeOnPacketConnections(); 294cb3ecf321c52de1e72cdf037a459cd893b7c51dbSamuel Tan // Utility functions to check which wake on WiFi features are currently 295787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // enabled based on the descriptor |wake_on_wifi_features_enabled_| and 296787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // are supported by the NIC. 297787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool WakeOnPacketEnabledAndSupported(); 298787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool WakeOnSSIDEnabledAndSupported(); 29966bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan // Called by metrics_timer_ to reports metrics. 30066bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan void ReportMetrics(); 301787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Actions executed before normal suspend and dark resume suspend. 302787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // 303787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Arguments: 304787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |is_connected|: whether the WiFi device is connected. 305402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan // - |has_service_configured_for_autoconnect|: whether there exists at 306c420dd27964a85c8dec8f09d9049287ccba5f95aSamuel Tan // least one service (hidden or not) that is configured for auto-connect. 307787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |start_lease_renewal_timer|: whether or not to start the DHCP lease 308787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal timer. 309787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |time_to_next_lease_renewal|: number of seconds until next DHCP lease 310787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // renewal is due. 311787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // - |remove_supplicant_networks_callback|: callback to invoke 312787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // to remove all networks from WPA supplicant. 313787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan void BeforeSuspendActions( 314787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool is_connected, 315402bf2959e8b2c68627a7b66203ec84760bf2e03Samuel Tan bool has_service_configured_for_autoconnect, 316787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool start_lease_renewal_timer, 317787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan uint32_t time_to_next_lease_renewal, 318787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan const base::Closure &remove_supplicant_networks_callback); 319787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan 320787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Needed for |dhcp_lease_renewal_timer_| and |wake_to_scan_timer_| since 321787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // passing a empty base::Closure() causes a run-time DCHECK error when 322787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // AlarmTimer::Start or AlarmTimer::Reset are called. 323787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan void OnTimerWakeDoNothing() {} 32466bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan 3253a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Pointers to objects owned by the WiFi object that created this object. 3263a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan EventDispatcher *dispatcher_; 3273a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan NetlinkManager *netlink_manager_; 32866bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan Metrics *metrics_; 3293a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Executes after the NIC's wake-on-packet settings are configured via 3303a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // NL80211 messages to verify that the new configuration has taken effect. 3313a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Calls RequestWakeOnPacketSettings. 3323a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan base::CancelableClosure verify_wake_on_packet_settings_callback_; 333787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Callback to be invoked after all suspend actions finish executing both 334787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // before regular suspend and before suspend in dark resume. 3353a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan ResultCallback suspend_actions_done_callback_; 33666bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan // Callback to report wake on WiFi related metrics. 33766bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan base::CancelableClosure report_metrics_callback_; 3383a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Number of retry attempts to program the NIC's wake-on-packet settings. 3393a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan int num_set_wake_on_packet_retries_; 3403a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Keeps track of triggers that the NIC will be programmed to wake from 3413a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // while suspended. 3423a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan std::set<WakeOnWiFi::WakeOnWiFiTrigger> wake_on_wifi_triggers_; 3433a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Keeps track of what wake on wifi triggers this WiFi device supports. 3443a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan std::set<WakeOnWiFi::WakeOnWiFiTrigger> wake_on_wifi_triggers_supported_; 345dda4da49919c0d10d84bf70ef4313837345cfb6cSamuel Tan // Max number of patterns this WiFi device can be programmed to wake on at one 346dda4da49919c0d10d84bf70ef4313837345cfb6cSamuel Tan // time. 3473a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan size_t wake_on_wifi_max_patterns_; 348dda4da49919c0d10d84bf70ef4313837345cfb6cSamuel Tan // Max number of SSIDs this WiFi device can be programmed to wake on at one 349dda4da49919c0d10d84bf70ef4313837345cfb6cSamuel Tan // time. 350dda4da49919c0d10d84bf70ef4313837345cfb6cSamuel Tan uint32_t wake_on_wifi_max_ssids_; 3513a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // Keeps track of IP addresses whose packets this device will wake upon 3523a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan // receiving while the device is suspended. 3533a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan IPAddressStore wake_on_packet_connections_; 3543a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan uint32_t wiphy_index_; 3553a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan bool wiphy_index_received_; 35696e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan // Describes the wake on WiFi features that are currently enabled. 35796e35cf43e6d5aa2378cdae6fea507e5335d12bbSamuel Tan std::string wake_on_wifi_features_enabled_; 358787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Timer that wakes the system to renew DHCP leases. 359787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan timers::AlarmTimer dhcp_lease_renewal_timer_; 360787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Timer that wakes the system to scan for networks. 361787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan timers::AlarmTimer wake_to_scan_timer_; 362787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Executes when the dark resume actions timer expires. Calls 363787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // ScanTimerHandler. 364787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan base::CancelableClosure dark_resume_actions_timeout_callback_; 365787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan // Whether shill is currently in dark resume. 366787a1cebf2452c14bf392ab99902e686ea4a6fb4Samuel Tan bool in_dark_resume_; 3675768ad4f08851b73eddb3328794eaa0ab3094bd3Samuel Tan // Period (in seconds) between instances where the system wakes from suspend 3685768ad4f08851b73eddb3328794eaa0ab3094bd3Samuel Tan // to scan for networks in dark resume. 3695768ad4f08851b73eddb3328794eaa0ab3094bd3Samuel Tan uint32_t wake_to_scan_period_seconds_; 3707804df459a7f29a7463dbd7f0e8e2fea93ee766dSamuel Tan // Period (in seconds) between instances where the NIC performs Net Detect 3717804df459a7f29a7463dbd7f0e8e2fea93ee766dSamuel Tan // scans while the system is suspended. 3727804df459a7f29a7463dbd7f0e8e2fea93ee766dSamuel Tan uint32_t net_detect_scan_period_seconds_; 373ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan // Timestamps of dark resume wakes since the last suspend. 374ff59a1896ea250b4450b54db697692e0b1949528Samuel Tan EventHistory dark_resumes_since_last_suspend_; 37566bddc67c71dd197211ca08c5a4835bd6cfa5ed2Samuel Tan 3763a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan base::WeakPtrFactory<WakeOnWiFi> weak_ptr_factory_; 377d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 3783a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan DISALLOW_COPY_AND_ASSIGN(WakeOnWiFi); 3793a1bf99b484ad8a9a054518f49046221251d5612Samuel Tan}; 380d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 381d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan} // namespace shill 382d03b95db5d05928ea63fc9f8aac5151e93c43a2fSamuel Tan 383d6a8b519e3057f52313e502f502a4819a942e089Ben Chan#endif // SHILL_WIFI_WAKE_ON_WIFI_H_ 384