blob: 83081122fa45fdf03168c257661fd46224206c31 [file] [log] [blame]
Thieu Le3426c8f2012-01-11 17:35:11 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewart0af98bf2011-05-10 17:38:08 -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_DEVICE_INFO_H_
6#define SHILL_DEVICE_INFO_H_
Paul Stewart0af98bf2011-05-10 17:38:08 -07007
Darin Petkove6193c02011-08-11 12:42:40 -07008#include <map>
Ben Chancd477322014-10-17 14:19:30 -07009#include <memory>
mukesh agrawal8f317b62011-07-15 11:53:23 -070010#include <set>
11#include <string>
Paul Stewart9a908082011-08-31 12:18:48 -070012#include <vector>
mukesh agrawal8f317b62011-07-15 11:53:23 -070013
Eric Shienbrood3e20a232012-02-16 11:35:56 -050014#include <base/callback.h>
Paul Stewart050cfc02012-07-06 20:38:54 -070015#include <base/cancelable_callback.h>
Ben Chana0ddf462014-02-06 11:32:42 -080016#include <base/files/file_path.h>
Paul Stewartb50f0b92011-05-16 16:31:42 -070017#include <base/memory/ref_counted.h>
Darin Petkov5a850472012-06-06 15:44:24 +020018#include <base/memory/weak_ptr.h>
Darin Petkov0828f5f2011-08-11 10:18:52 -070019#include <gtest/gtest_prod.h> // for FRIEND_TEST
Paul Stewart0af98bf2011-05-10 17:38:08 -070020
Chris Masone9be4a9d2011-05-16 15:44:09 -070021#include "shill/device.h"
Peter Qiu8d6b5972014-10-28 15:33:34 -070022#include "shill/net/byte_string.h"
23#include "shill/net/ip_address.h"
24#include "shill/net/rtnl_listener.h"
25#include "shill/net/shill_time.h"
Paul Stewartcba0f7f2012-02-29 16:33:05 -080026#include "shill/technology.h"
Paul Stewart0af98bf2011-05-10 17:38:08 -070027
28namespace shill {
29
Paul Stewartb50f0b92011-05-16 16:31:42 -070030class Manager;
Thieu Le3426c8f2012-01-11 17:35:11 -080031class Metrics;
Paul Stewart8c116a92012-05-02 18:30:03 -070032class RoutingTable;
Paul Stewart9a908082011-08-31 12:18:48 -070033class RTNLHandler;
Chris Masone2aa97072011-08-09 17:35:08 -070034class RTNLMessage;
Gary Morain41780232012-07-31 15:08:31 -070035class Sockets;
Paul Stewartb50f0b92011-05-16 16:31:42 -070036
Peter Qiu1a72f542015-04-14 16:31:36 -070037#if !defined(DISABLE_WIFI)
38class NetlinkManager;
39class Nl80211Message;
40#endif // DISABLE_WIFI
41
Darin Petkov5a850472012-06-06 15:44:24 +020042class DeviceInfo : public base::SupportsWeakPtr<DeviceInfo> {
Paul Stewart0af98bf2011-05-10 17:38:08 -070043 public:
Paul Stewart9a908082011-08-31 12:18:48 -070044 struct AddressData {
45 AddressData()
Paul Stewart7355ce12011-09-02 10:47:01 -070046 : address(IPAddress::kFamilyUnknown), flags(0), scope(0) {}
Paul Stewarta794cd62015-06-16 13:13:10 -070047 AddressData(const IPAddress& address_in,
Paul Stewart9a908082011-08-31 12:18:48 -070048 unsigned char flags_in,
49 unsigned char scope_in)
50 : address(address_in), flags(flags_in), scope(scope_in) {}
51 IPAddress address;
52 unsigned char flags;
53 unsigned char scope;
54 };
55
Jason Glasgowabc54032012-04-20 16:08:32 -040056 // Device name prefix for modem pseudo devices used in testing.
57 static const char kModemPseudoDeviceNamePrefix[];
Christopher Wileye049cc52012-09-10 14:36:57 -070058 // Device name prefix for virtual ethernet devices used in testing.
59 static const char kEthernetPseudoDeviceNamePrefix[];
Paul Stewart83d62562015-02-09 19:57:47 -080060 // Device name prefix for virtual ethernet devices that should be ignored.
61 static const char kIgnoredDeviceNamePrefix[];
Ben Chanb061f892013-02-27 17:46:55 -080062 // Time interval for polling for link statistics.
63 static const int kRequestLinkStatisticsIntervalMilliseconds;
Jason Glasgowabc54032012-04-20 16:08:32 -040064
Paul Stewarta794cd62015-06-16 13:13:10 -070065 DeviceInfo(ControlInterface* control_interface,
66 EventDispatcher* dispatcher,
67 Metrics* metrics,
68 Manager* manager);
Darin Petkov5a850472012-06-06 15:44:24 +020069 virtual ~DeviceInfo();
Darin Petkov887f2982011-07-14 16:10:17 -070070
Paul Stewarta794cd62015-06-16 13:13:10 -070071 virtual void AddDeviceToBlackList(const std::string& device_name);
72 virtual void RemoveDeviceFromBlackList(const std::string& device_name);
73 virtual bool IsDeviceBlackListed(const std::string& device_name);
Paul Stewart0af98bf2011-05-10 17:38:08 -070074 void Start();
75 void Stop();
Darin Petkov887f2982011-07-14 16:10:17 -070076
Ben Chan5086b972013-01-15 21:51:38 -080077 std::vector<std::string> GetUninitializedTechnologies() const;
78
Darin Petkov6f9eaa32011-08-09 15:26:44 -070079 // Adds |device| to this DeviceInfo instance so that we can handle its link
80 // messages, and registers it with the manager.
Paul Stewarta794cd62015-06-16 13:13:10 -070081 virtual void RegisterDevice(const DeviceRefPtr& device);
Darin Petkov6f9eaa32011-08-09 15:26:44 -070082
Jason Glasgowe9089492012-02-23 17:57:37 -050083 // Remove |device| from this DeviceInfo. This function should only
84 // be called for cellular devices because the lifetime of the
85 // cellular devices is controlled by the Modem object and its
86 // communication to modem manager, rather than by RTNL messages.
Paul Stewarta794cd62015-06-16 13:13:10 -070087 virtual void DeregisterDevice(const DeviceRefPtr& device);
Jason Glasgowe9089492012-02-23 17:57:37 -050088
Paul Stewartc8f4bef2011-12-13 09:45:51 -080089 virtual DeviceRefPtr GetDevice(int interface_index) const;
Paul Stewarta794cd62015-06-16 13:13:10 -070090 virtual bool GetMACAddress(int interface_index, ByteString* address) const;
Gary Morainbf74a672012-07-30 16:27:19 -070091
92 // Queries the kernel for a MAC address for |interface_index|. Returns an
93 // empty ByteString on failure.
94 virtual ByteString GetMACAddressFromKernel(int interface_index) const;
Gary Morain41780232012-07-31 15:08:31 -070095
Paul Stewart6950ba52013-12-05 08:28:14 -080096 // Queries the kernel for the MAC address of |peer| on |interface_index|.
97 // Returns true and populates |mac_address| on success, otherwise returns
98 // false.
99 virtual bool GetMACAddressOfPeer(int interface_index,
Paul Stewarta794cd62015-06-16 13:13:10 -0700100 const IPAddress& peer,
101 ByteString* mac_address) const;
Paul Stewart6950ba52013-12-05 08:28:14 -0800102
Paul Stewarta794cd62015-06-16 13:13:10 -0700103 virtual bool GetFlags(int interface_index, unsigned int* flags) const;
Paul Stewart1ac4e842012-07-10 12:58:12 -0700104 virtual bool GetByteCounts(int interface_index,
Paul Stewarta794cd62015-06-16 13:13:10 -0700105 uint64_t* rx_bytes, uint64_t* tx_bytes) const;
Paul Stewart9a908082011-08-31 12:18:48 -0700106 virtual bool GetAddresses(int interface_index,
Paul Stewarta794cd62015-06-16 13:13:10 -0700107 std::vector<AddressData>* addresses) const;
Paul Stewarta0db0ff2013-12-09 09:48:47 -0800108
Paul Stewart05a42c22012-08-02 16:47:21 -0700109 // Flush all addresses associated with |interface_index|.
Paul Stewart9a908082011-08-31 12:18:48 -0700110 virtual void FlushAddresses(int interface_index) const;
Paul Stewart05a42c22012-08-02 16:47:21 -0700111 // Returns whether this interface does not have |this_address|
112 // but has another non-temporary address of the same family.
113 virtual bool HasOtherAddress(
Paul Stewarta794cd62015-06-16 13:13:10 -0700114 int interface_index, const IPAddress& this_address) const;
Paul Stewartd55f6ae2014-04-24 16:34:21 -0700115
116 // Get the preferred globally scoped IPv6 address for |interface_index|.
117 // This method returns true and sets |address| if a primary IPv6 address
118 // exists. Otherwise it returns false and leaves |address| unmodified.
Paul Stewarta794cd62015-06-16 13:13:10 -0700119 virtual bool GetPrimaryIPv6Address(int interface_index, IPAddress* address);
Paul Stewartd55f6ae2014-04-24 16:34:21 -0700120
Peter Qiu98551702014-07-28 13:28:53 -0700121 // Get the IPv6 DNS server addresses for |interface_index|. This method
122 // returns true and sets |address_list| and |life_time_seconds| if the IPv6
123 // DNS server addresses exists. Otherwise, it returns false and leave
124 // |address_list| and |life_time_seconds| unmodified. |life_time_seconds|
125 // indicates the number of the seconds the DNS server is still valid for at
126 // the time of this function call. Value of 0 means the DNS server is not
127 // valid anymore, and value of 0xFFFFFFFF means the DNS server is valid
128 // forever.
129 virtual bool GetIPv6DnsServerAddresses(int interface_index,
Paul Stewarta794cd62015-06-16 13:13:10 -0700130 std::vector<IPAddress>* address_list,
131 uint32_t* life_time_seconds);
Peter Qiu98551702014-07-28 13:28:53 -0700132
Paul Stewarta0db0ff2013-12-09 09:48:47 -0800133 // Returns true if any of the addresses on |interface_index| are on the
134 // same network prefix as |address|.
135 virtual bool HasDirectConnectivityTo(
Paul Stewarta794cd62015-06-16 13:13:10 -0700136 int interface_index, const IPAddress& address) const;
Paul Stewarta0db0ff2013-12-09 09:48:47 -0800137
Paul Stewarta794cd62015-06-16 13:13:10 -0700138 virtual bool CreateTunnelInterface(std::string* interface_name) const;
139 virtual int OpenTunnelInterface(const std::string& interface_name) const;
Paul Stewartca6abd42012-03-01 15:45:29 -0800140 virtual bool DeleteInterface(int interface_index) const;
Paul Stewart0af98bf2011-05-10 17:38:08 -0700141
Darin Petkovf8046b82012-04-24 16:29:23 +0200142 // Returns the interface index for |interface_name| or -1 if unknown.
Paul Stewarta794cd62015-06-16 13:13:10 -0700143 virtual int GetIndex(const std::string& interface_name) const;
Darin Petkovf8046b82012-04-24 16:29:23 +0200144
Paul Stewart208a97e2015-05-13 09:11:12 -0700145 // Sets the system hostname to |hostname|.
Paul Stewarta794cd62015-06-16 13:13:10 -0700146 virtual bool SetHostname(const std::string& hostname) const;
Paul Stewart208a97e2015-05-13 09:11:12 -0700147
Paul Stewart0af98bf2011-05-10 17:38:08 -0700148 private:
Paul Stewart050cfc02012-07-06 20:38:54 -0700149 friend class DeviceInfoDelayedCreationTest;
Paul Stewartca876ee2012-04-21 08:55:58 -0700150 friend class DeviceInfoTechnologyTest;
Darin Petkov887f2982011-07-14 16:10:17 -0700151 friend class DeviceInfoTest;
Darin Petkov0828f5f2011-08-11 10:18:52 -0700152 FRIEND_TEST(CellularTest, StartLinked);
Ben Chan4b285862012-10-10 22:52:16 -0700153 FRIEND_TEST(DeviceInfoTest, CreateDeviceWiMax);
Peter Qiu9f5159e2014-09-12 16:50:14 -0700154 FRIEND_TEST(DeviceInfoTest, DeviceRemovedEvent);
Ben Chan5086b972013-01-15 21:51:38 -0800155 FRIEND_TEST(DeviceInfoTest, GetUninitializedTechnologies);
Thieu Leb27beee2012-04-20 09:19:06 -0700156 FRIEND_TEST(DeviceInfoTest, HasSubdir); // For HasSubdir.
Paul Stewartd55f6ae2014-04-24 16:34:21 -0700157 FRIEND_TEST(DeviceInfoTest, IPv6AddressChanged); // For infos_.
Paul Stewart1ac4e842012-07-10 12:58:12 -0700158 FRIEND_TEST(DeviceInfoTest, RequestLinkStatistics);
Paul Stewart8c116a92012-05-02 18:30:03 -0700159 FRIEND_TEST(DeviceInfoTest, StartStop);
Peter Qiu98551702014-07-28 13:28:53 -0700160 FRIEND_TEST(DeviceInfoTest, IPv6DnsServerAddressesChanged); // For infos_.
Darin Petkov887f2982011-07-14 16:10:17 -0700161
Darin Petkove6193c02011-08-11 12:42:40 -0700162 struct Info {
Ben Chan5086b972013-01-15 21:51:38 -0800163 Info()
164 : flags(0),
165 rx_bytes(0),
166 tx_bytes(0),
167 has_addresses_only(false),
168 technology(Technology::kUnknown)
169 {}
Darin Petkove6193c02011-08-11 12:42:40 -0700170
171 DeviceRefPtr device;
Darin Petkovf8046b82012-04-24 16:29:23 +0200172 std::string name;
Paul Stewart32852962011-08-30 14:06:53 -0700173 ByteString mac_address;
Paul Stewart9a908082011-08-31 12:18:48 -0700174 std::vector<AddressData> ip_addresses;
Peter Qiu98551702014-07-28 13:28:53 -0700175 std::vector<IPAddress> ipv6_dns_server_addresses;
Ben Chan7fab8972014-08-10 17:14:46 -0700176 uint32_t ipv6_dns_server_lifetime_seconds;
Peter Qiu98551702014-07-28 13:28:53 -0700177 time_t ipv6_dns_server_received_time_seconds;
Darin Petkove6193c02011-08-11 12:42:40 -0700178 unsigned int flags;
Ben Chan7fab8972014-08-10 17:14:46 -0700179 uint64_t rx_bytes;
180 uint64_t tx_bytes;
Paul Stewart1ac4e842012-07-10 12:58:12 -0700181
Paul Stewart8c116a92012-05-02 18:30:03 -0700182 // This flag indicates that link information has not been retrieved yet;
183 // only the ip_addresses field is valid.
184 bool has_addresses_only;
Ben Chan5086b972013-01-15 21:51:38 -0800185
186 Technology::Identifier technology;
Darin Petkove6193c02011-08-11 12:42:40 -0700187 };
188
Paul Stewartca876ee2012-04-21 08:55:58 -0700189 // Root of the kernel sysfs directory holding network device info.
190 static const char kDeviceInfoRoot[];
Ben Chan4e64d2d2012-05-16 00:02:25 -0700191 // Name of the "cdc_ether" driver. This driver is not included in the
192 // kModemDrivers list because we need to do additional checking.
193 static const char kDriverCdcEther[];
Ben Chan4eb4ddf2013-06-20 22:16:56 -0700194 // Name of the "cdc_ncm" driver. This driver is not included in the
195 // kModemDrivers list because we need to do additional checking.
196 static const char kDriverCdcNcm[];
Ben Chan4e64d2d2012-05-16 00:02:25 -0700197 // Name of the GDM WiMAX driver.
198 static const char kDriverGdmWiMax[];
mukesh agrawal93a29ed2012-04-17 16:13:01 -0700199 // Name of the virtio network driver.
200 static const char kDriverVirtioNet[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700201 // Sysfs path to a device uevent file.
Paul Stewartbf1861b2011-08-23 15:45:35 -0700202 static const char kInterfaceUevent[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700203 // Content of a device uevent file that indicates it is a wifi device.
Paul Stewart9364c4c2011-12-06 17:12:42 -0800204 static const char kInterfaceUeventWifiSignature[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700205 // Sysfs path to a device via its interface name.
206 static const char kInterfaceDevice[];
207 // Sysfs path to the driver of a device via its interface name.
Paul Stewartbf1861b2011-08-23 15:45:35 -0700208 static const char kInterfaceDriver[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700209 // Sysfs path to the file that is used to determine if this is tun device.
Paul Stewartcba0f7f2012-02-29 16:33:05 -0800210 static const char kInterfaceTunFlags[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700211 // Sysfs path to the file that is used to determine if a wifi device is
212 // operating in monitor mode.
Paul Stewart2001a422011-12-15 10:20:09 -0800213 static const char kInterfaceType[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700214 // Modem drivers that we support.
Paul Stewarta794cd62015-06-16 13:13:10 -0700215 static const char* kModemDrivers[];
Thieu Le8f1c8352012-04-16 11:02:12 -0700216 // Path to the tun device.
Paul Stewartcba0f7f2012-02-29 16:33:05 -0800217 static const char kTunDeviceName[];
Paul Stewart050cfc02012-07-06 20:38:54 -0700218 // Time to wait before registering devices which need extra time to detect.
219 static const int kDelayedDeviceCreationSeconds;
Paul Stewartb50f0b92011-05-16 16:31:42 -0700220
Paul Stewart8c116a92012-05-02 18:30:03 -0700221 // Create a Device object for the interface named |linkname|, with a
222 // string-form MAC address |address|, whose kernel interface index
223 // is |interface_index| and detected technology is |technology|.
Paul Stewarta794cd62015-06-16 13:13:10 -0700224 virtual DeviceRefPtr CreateDevice(const std::string& link_name,
225 const std::string& address,
Paul Stewart050cfc02012-07-06 20:38:54 -0700226 int interface_index,
227 Technology::Identifier technology);
Paul Stewart8c116a92012-05-02 18:30:03 -0700228
Paul Stewartca876ee2012-04-21 08:55:58 -0700229 // Return the FilePath for a given |path_name| in the device sysinfo for
230 // a specific interface |iface_name|.
Paul Stewarta794cd62015-06-16 13:13:10 -0700231 base::FilePath GetDeviceInfoPath(const std::string& iface_name,
232 const std::string& path_name);
Paul Stewartca876ee2012-04-21 08:55:58 -0700233 // Return the contents of the device info file |path_name| for interface
234 // |iface_name| in output parameter |contents_out|. Returns true if file
235 // read succeeded, false otherwise.
Paul Stewarta794cd62015-06-16 13:13:10 -0700236 bool GetDeviceInfoContents(const std::string& iface_name,
237 const std::string& path_name,
238 std::string* contents_out);
Paul Stewartca876ee2012-04-21 08:55:58 -0700239
240 // Return the filepath for the target of the device info symbolic link
241 // |path_name| for interface |iface_name| in output parameter |path_out|.
242 // Returns true if symbolic link read succeeded, false otherwise.
Paul Stewarta794cd62015-06-16 13:13:10 -0700243 bool GetDeviceInfoSymbolicLink(const std::string& iface_name,
244 const std::string& path_name,
245 base::FilePath* path_out);
Paul Stewartca876ee2012-04-21 08:55:58 -0700246 // Classify the device named |iface_name|, and return an identifier
247 // indicating its type.
Paul Stewart050cfc02012-07-06 20:38:54 -0700248 virtual Technology::Identifier GetDeviceTechnology(
Paul Stewarta794cd62015-06-16 13:13:10 -0700249 const std::string& iface_name);
Thieu Le8f1c8352012-04-16 11:02:12 -0700250 // Checks the device specified by |iface_name| to see if it's a modem device.
251 // This method assumes that |iface_name| has already been determined to be
Ben Chan4eb4ddf2013-06-20 22:16:56 -0700252 // using the cdc_ether / cdc_ncm driver.
Paul Stewarta794cd62015-06-16 13:13:10 -0700253 bool IsCdcEthernetModemDevice(const std::string& iface_name);
Thieu Leb27beee2012-04-20 09:19:06 -0700254 // Returns true if |base_dir| has a subdirectory named |subdir|.
255 // |subdir| can be an immediate subdirectory of |base_dir| or can be
256 // several levels deep.
Paul Stewarta794cd62015-06-16 13:13:10 -0700257 static bool HasSubdir(const base::FilePath& base_dir,
258 const base::FilePath& subdir);
Darin Petkov6f9eaa32011-08-09 15:26:44 -0700259
Paul Stewarta794cd62015-06-16 13:13:10 -0700260 void AddLinkMsgHandler(const RTNLMessage& msg);
261 void DelLinkMsgHandler(const RTNLMessage& msg);
262 void LinkMsgHandler(const RTNLMessage& msg);
263 void AddressMsgHandler(const RTNLMessage& msg);
264 void RdnssMsgHandler(const RTNLMessage& msg);
Paul Stewart0af98bf2011-05-10 17:38:08 -0700265
Paul Stewarta794cd62015-06-16 13:13:10 -0700266 const Info* GetInfo(int interface_index) const;
Darin Petkove6193c02011-08-11 12:42:40 -0700267 void RemoveInfo(int interface_index);
Paul Stewart050cfc02012-07-06 20:38:54 -0700268 void DelayDeviceCreation(int interface_index);
269 void DelayedDeviceCreationTask();
Paul Stewarta794cd62015-06-16 13:13:10 -0700270 void RetrieveLinkStatistics(int interface_index, const RTNLMessage& msg);
Paul Stewart1ac4e842012-07-10 12:58:12 -0700271 void RequestLinkStatistics();
Darin Petkov67d8ecf2011-07-26 16:03:30 -0700272
Peter Qiu1a72f542015-04-14 16:31:36 -0700273#if !defined(DISABLE_WIFI)
Paul Stewart2ddf2c62013-04-16 09:47:34 -0700274 // Use nl80211 to get information on |interface_index|.
275 void GetWiFiInterfaceInfo(int interface_index);
Paul Stewarta794cd62015-06-16 13:13:10 -0700276 void OnWiFiInterfaceInfoReceived(const Nl80211Message& message);
Peter Qiu1a72f542015-04-14 16:31:36 -0700277#endif // DISABLE_WIFI
Paul Stewart2ddf2c62013-04-16 09:47:34 -0700278
Gary Morain41780232012-07-31 15:08:31 -0700279 void set_sockets(Sockets* sockets) { sockets_.reset(sockets); }
280
Paul Stewarta794cd62015-06-16 13:13:10 -0700281 ControlInterface* control_interface_;
282 EventDispatcher* dispatcher_;
283 Metrics* metrics_;
284 Manager* manager_;
Darin Petkovf8046b82012-04-24 16:29:23 +0200285
286 std::map<int, Info> infos_; // Maps interface index to Info.
287 std::map<std::string, int> indices_; // Maps interface name to index.
288
Paul Stewarta794cd62015-06-16 13:13:10 -0700289 base::Callback<void(const RTNLMessage&)> link_callback_;
290 base::Callback<void(const RTNLMessage&)> address_callback_;
291 base::Callback<void(const RTNLMessage&)> rdnss_callback_;
Ben Chancd477322014-10-17 14:19:30 -0700292 std::unique_ptr<RTNLListener> link_listener_;
293 std::unique_ptr<RTNLListener> address_listener_;
294 std::unique_ptr<RTNLListener> rdnss_listener_;
mukesh agrawal8f317b62011-07-15 11:53:23 -0700295 std::set<std::string> black_list_;
Albert Chaulk0e1cdea2013-02-27 15:32:55 -0800296 base::FilePath device_info_root_;
Darin Petkove6193c02011-08-11 12:42:40 -0700297
Paul Stewart1ac4e842012-07-10 12:58:12 -0700298 // Keep track of devices that require a delayed call to CreateDevice().
Paul Stewart050cfc02012-07-06 20:38:54 -0700299 base::CancelableClosure delayed_devices_callback_;
300 std::set<int> delayed_devices_;
301
Paul Stewart1ac4e842012-07-10 12:58:12 -0700302 // Maintain a callback for the periodic link statistics poll task.
303 base::CancelableClosure request_link_statistics_callback_;
304
Paul Stewart8c116a92012-05-02 18:30:03 -0700305 // Cache copy of singleton pointers.
Paul Stewarta794cd62015-06-16 13:13:10 -0700306 RoutingTable* routing_table_;
307 RTNLHandler* rtnl_handler_;
Peter Qiu1a72f542015-04-14 16:31:36 -0700308#if !defined(DISABLE_WIFI)
Paul Stewarta794cd62015-06-16 13:13:10 -0700309 NetlinkManager* netlink_manager_;
Peter Qiu1a72f542015-04-14 16:31:36 -0700310#endif // DISABLE_WIFI
Paul Stewart9a908082011-08-31 12:18:48 -0700311
Gary Morain41780232012-07-31 15:08:31 -0700312 // A member of the class so that a mock can be injected for testing.
Ben Chancd477322014-10-17 14:19:30 -0700313 std::unique_ptr<Sockets> sockets_;
Gary Morain41780232012-07-31 15:08:31 -0700314
Paul Stewarta794cd62015-06-16 13:13:10 -0700315 Time* time_;
Peter Qiu98551702014-07-28 13:28:53 -0700316
Darin Petkove6193c02011-08-11 12:42:40 -0700317 DISALLOW_COPY_AND_ASSIGN(DeviceInfo);
Paul Stewart0af98bf2011-05-10 17:38:08 -0700318};
319
Paul Stewart0af98bf2011-05-10 17:38:08 -0700320} // namespace shill
321
Ben Chanc45688b2014-07-02 23:50:45 -0700322#endif // SHILL_DEVICE_INFO_H_