blob: 3a6d6e84dd6d084532b77a6d6563ec99844064ce [file] [log] [blame]
Darin Petkovc64fe5e2012-01-11 12:46:13 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewart75897df2011-04-27 09:05:53 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_DEVICE_
6#define SHILL_DEVICE_
7
Chris Masone46eaaf52011-05-24 13:08:30 -07008#include <string>
Chris Masone9be4a9d2011-05-16 15:44:09 -07009#include <vector>
10
Chris Masone8fe2c7e2011-06-09 15:51:19 -070011#include <base/basictypes.h>
Chris Masone487b8bf2011-05-13 16:27:57 -070012#include <base/memory/ref_counted.h>
Paul Stewartb50f0b92011-05-16 16:31:42 -070013#include <base/memory/scoped_ptr.h>
Eric Shienbrood9a245532012-03-07 14:20:39 -050014#include <base/memory/weak_ptr.h>
Darin Petkovafa6fc42011-06-21 16:21:08 -070015#include <gtest/gtest_prod.h> // for FRIEND_TEST
Paul Stewartd5843772011-05-11 15:40:42 -070016
Eric Shienbrood9a245532012-03-07 14:20:39 -050017#include "shill/adaptor_interfaces.h"
18#include "shill/callbacks.h"
Paul Stewart26b327e2011-10-19 11:38:09 -070019#include "shill/event_dispatcher.h"
Paul Stewart2bf1d352011-12-06 15:02:55 -080020#include "shill/ip_address.h"
Darin Petkovafa6fc42011-06-21 16:21:08 -070021#include "shill/ipconfig.h"
Paul Stewart20088d82012-02-16 06:58:55 -080022#include "shill/portal_detector.h"
Chris Masoneb925cc82011-06-22 15:39:57 -070023#include "shill/property_store.h"
Chris Masone2b105542011-06-22 10:58:09 -070024#include "shill/refptr_types.h"
Paul Stewart03dba0b2011-08-22 16:32:45 -070025#include "shill/service.h"
Paul Stewartfdd16072011-09-16 12:41:35 -070026#include "shill/technology.h"
Paul Stewart75897df2011-04-27 09:05:53 -070027
28namespace shill {
29
Chris Masone9be4a9d2011-05-16 15:44:09 -070030class ControlInterface;
Darin Petkov77cb6812011-08-15 16:19:41 -070031class DHCPProvider;
Chris Masone9be4a9d2011-05-16 15:44:09 -070032class DeviceAdaptorInterface;
Paul Stewartf1ce5d22011-05-19 13:10:20 -070033class Endpoint;
Chris Masone8fe2c7e2011-06-09 15:51:19 -070034class Error;
35class EventDispatcher;
Paul Stewartf1ce5d22011-05-19 13:10:20 -070036class Manager;
Thieu Le3426c8f2012-01-11 17:35:11 -080037class Metrics;
Thieu Lefb46caf2012-03-08 11:57:15 -080038class RoutingTable;
39class RTNLHandler;
Chris Masone9be4a9d2011-05-16 15:44:09 -070040
Paul Stewart75897df2011-04-27 09:05:53 -070041// Device superclass. Individual network interfaces types will inherit from
42// this class.
Chris Masone27c4aa52011-07-02 13:10:14 -070043class Device : public base::RefCounted<Device> {
Paul Stewart75897df2011-04-27 09:05:53 -070044 public:
Chris Masone9be4a9d2011-05-16 15:44:09 -070045 // A constructor for the Device object
46 Device(ControlInterface *control_interface,
Paul Stewartb50f0b92011-05-16 16:31:42 -070047 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080048 Metrics *metrics,
Paul Stewartf1ce5d22011-05-19 13:10:20 -070049 Manager *manager,
Darin Petkovafa6fc42011-06-21 16:21:08 -070050 const std::string &link_name,
Chris Masone626719f2011-08-18 16:58:48 -070051 const std::string &address,
Gaurav Shah435de2c2011-11-17 19:01:07 -080052 int interface_index,
53 Technology::Identifier technology);
Chris Masone9be4a9d2011-05-16 15:44:09 -070054 virtual ~Device();
55
Eric Shienbrood9a245532012-03-07 14:20:39 -050056 // Enable or disable the device.
57 virtual void SetEnabled(bool enable);
58 // Enable or disable the device, and save the setting in the profile.
59 // The setting is persisted before the enable or disable operation
60 // starts, so that even if it fails, the user's intent is still recorded
61 // for the next time shill restarts.
62 void SetEnabledPersistent(bool enable,
63 Error *error, const ResultCallback &callback);
Gaurav Shah435de2c2011-11-17 19:01:07 -080064
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040065 // Returns true if the underlying device reports that it is already enabled.
66 // Used when the device is registered with the Manager, so that shill can
67 // sync its state/ with the true state of the device. The default is to
68 // report false.
69 virtual bool IsUnderlyingDeviceEnabled() const;
70
Gaurav Shah435de2c2011-11-17 19:01:07 -080071 // TODO(gauravsh): We do not really need this since technology() can be used
72 // to get a device's technology for direct comparison.
Darin Petkovafa6fc42011-06-21 16:21:08 -070073 // Base method always returns false.
Paul Stewartfdd16072011-09-16 12:41:35 -070074 virtual bool TechnologyIs(const Technology::Identifier type) const;
Darin Petkovafa6fc42011-06-21 16:21:08 -070075
Paul Stewartf1ce5d22011-05-19 13:10:20 -070076 virtual void LinkEvent(unsigned flags, unsigned change);
Paul Stewart75897df2011-04-27 09:05:53 -070077
Darin Petkov9ae310f2011-08-30 15:41:13 -070078 // The default implementation sets |error| to kNotSupported.
Darin Petkovc0865312011-09-16 15:31:20 -070079 virtual void Scan(Error *error);
Eric Shienbrood9a245532012-03-07 14:20:39 -050080 virtual void RegisterOnNetwork(const std::string &network_id, Error *error,
81 const ResultCallback &callback);
82 virtual void RequirePIN(const std::string &pin, bool require,
83 Error *error, const ResultCallback &callback);
84 virtual void EnterPIN(const std::string &pin,
85 Error *error, const ResultCallback &callback);
Darin Petkove42e1012011-08-31 12:35:04 -070086 virtual void UnblockPIN(const std::string &unblock_code,
87 const std::string &pin,
Eric Shienbrood9a245532012-03-07 14:20:39 -050088 Error *error, const ResultCallback &callback);
Darin Petkove42e1012011-08-31 12:35:04 -070089 virtual void ChangePIN(const std::string &old_pin,
90 const std::string &new_pin,
Eric Shienbrood9a245532012-03-07 14:20:39 -050091 Error *error, const ResultCallback &callback);
Paul Stewart2bf1d352011-12-06 15:02:55 -080092 virtual void DisableIPv6();
93 virtual void EnableIPv6();
94 virtual void EnableIPv6Privacy();
Darin Petkov9ae310f2011-08-30 15:41:13 -070095
Paul Stewartc8f4bef2011-12-13 09:45:51 -080096 // Request the removal of reverse-path filtering for this interface.
97 // This will allow packets destined for this interface to be accepted,
98 // even if this is not the default route for such a packet to arrive.
99 virtual void DisableReversePathFilter();
100
101 // Request reverse-path filtering for this interface.
102 virtual void EnableReversePathFilter();
103
Gaurav Shah435de2c2011-11-17 19:01:07 -0800104 // Returns true if the selected service on the device (if any) is connected.
105 // Returns false if there is no selected service, or if the selected service
106 // is not connected.
107 bool IsConnected() const;
108
Paul Stewartc681fa02012-03-02 19:40:04 -0800109 // Requests that portal detection be done, if this device has the default
110 // connection. Returns true if portal detection was started.
111 virtual bool RequestPortalDetection();
112
Chris Masone27c4aa52011-07-02 13:10:14 -0700113 std::string GetRpcIdentifier();
Chris Masone5dec5f42011-07-22 14:07:55 -0700114 std::string GetStorageIdentifier();
Chris Masone8fe2c7e2011-06-09 15:51:19 -0700115
Chris Masone9d779932011-08-25 16:33:41 -0700116 const std::string &address() const { return hardware_address_; }
Darin Petkove0a312e2011-07-20 13:45:28 -0700117 const std::string &link_name() const { return link_name_; }
118 int interface_index() const { return interface_index_; }
Paul Stewarte6132022011-08-16 09:11:02 -0700119 const ConnectionRefPtr &connection() const { return connection_; }
Eric Shienbrood9a245532012-03-07 14:20:39 -0500120 bool enabled() const { return enabled_; }
121 bool enabled_persistent() const { return enabled_persistent_; }
Gaurav Shah435de2c2011-11-17 19:01:07 -0800122 virtual Technology::Identifier technology() const { return technology_; }
Jason Glasgowb5790052012-01-27 01:03:52 -0500123 std::string GetTechnologyString(Error *error);
Darin Petkove0a312e2011-07-20 13:45:28 -0700124
Darin Petkov31a2eca2012-03-14 11:07:18 +0100125 const IPConfigRefPtr &ipconfig() const { return ipconfig_; }
126 void set_ipconfig(const IPConfigRefPtr &config) { ipconfig_ = config; }
127
Chris Masone19e30402011-07-19 15:48:47 -0700128 const std::string &FriendlyName() const;
Chris Masone27c4aa52011-07-02 13:10:14 -0700129
Darin Petkovafa6fc42011-06-21 16:21:08 -0700130 // Returns a string that is guaranteed to uniquely identify this Device
131 // instance.
132 const std::string &UniqueName() const;
Chris Masonea82b7112011-05-25 15:16:29 -0700133
mukesh agrawalde29fa82011-09-16 16:16:36 -0700134 PropertyStore *mutable_store() { return &store_; }
135 const PropertyStore &store() const { return store_; }
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700136 RTNLHandler *rtnl_handler() { return rtnl_handler_; }
Chris Masone19e30402011-07-19 15:48:47 -0700137
Darin Petkovb05315f2011-11-07 10:14:25 +0100138 EventDispatcher *dispatcher() const { return dispatcher_; }
139
Paul Stewarta41e38d2011-11-11 07:47:29 -0800140 // Load configuration for the device from |storage|. This may include
141 // instantiating non-visible services for which configuration has been
142 // stored.
143 virtual bool Load(StoreInterface *storage);
144
145 // Save configuration for the device to |storage|.
Chris Masone877ff982011-09-21 16:18:24 -0700146 virtual bool Save(StoreInterface *storage);
Chris Masone5dec5f42011-07-22 14:07:55 -0700147
Darin Petkov77cb6812011-08-15 16:19:41 -0700148 void set_dhcp_provider(DHCPProvider *provider) { dhcp_provider_ = provider; }
149
Darin Petkov3cfbf212011-11-21 16:02:09 +0100150 DeviceAdaptorInterface *adaptor() const { return adaptor_.get(); }
151
Paul Stewartd5843772011-05-11 15:40:42 -0700152 protected:
Eric Shienbrood7fce52c2012-04-13 19:11:02 -0400153 FRIEND_TEST(CellularTest, ModemStateChangeDisable);
Paul Stewart2bf1d352011-12-06 15:02:55 -0800154 FRIEND_TEST(DeviceTest, AcquireIPConfig);
Darin Petkovafa6fc42011-06-21 16:21:08 -0700155 FRIEND_TEST(DeviceTest, DestroyIPConfig);
156 FRIEND_TEST(DeviceTest, DestroyIPConfigNULL);
Chris Masone95207da2011-06-29 16:50:49 -0700157 FRIEND_TEST(DeviceTest, GetProperties);
Chris Masone5dec5f42011-07-22 14:07:55 -0700158 FRIEND_TEST(DeviceTest, Save);
Paul Stewart03dba0b2011-08-22 16:32:45 -0700159 FRIEND_TEST(DeviceTest, SelectedService);
Paul Stewartc681fa02012-03-02 19:40:04 -0800160 FRIEND_TEST(DeviceTest, SetServiceConnectedState);
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700161 FRIEND_TEST(DeviceTest, Stop);
Eric Shienbrood9a245532012-03-07 14:20:39 -0500162 FRIEND_TEST(DeviceTest, OnEnabledStateChanged);
Paul Stewarta41e38d2011-11-11 07:47:29 -0800163 FRIEND_TEST(ManagerTest, DeviceRegistrationAndStart);
Gaurav Shah435de2c2011-11-17 19:01:07 -0800164 FRIEND_TEST(ManagerTest, ConnectedTechnologies);
165 FRIEND_TEST(ManagerTest, DefaultTechnology);
mukesh agrawal32399322011-09-01 10:53:43 -0700166 FRIEND_TEST(WiFiMainTest, Connect);
Darin Petkovafa6fc42011-06-21 16:21:08 -0700167
Eric Shienbrood9a245532012-03-07 14:20:39 -0500168 // Each device must implement this method to do the work needed to
169 // enable the device to operate for establishing network connections.
170 // The |error| argument, if not NULL,
171 // will refer to an Error that starts out with the value
172 // Error::kOperationInitiated. This reflects the assumption that
173 // enable (and disable) operations will usually be non-blocking,
174 // and their completion will be indicated by means of an asynchronous
175 // reply sometime later. There are two circumstances in which a
176 // device's Start() method may overwrite |error|:
177 //
178 // 1. If an early failure is detected, such that the non-blocking
179 // part of the operation never takes place, then |error| should
180 // be set to the appropriate value corresponding to the type
181 // of failure. This is the "immediate failure" case.
182 // 2. If the device is enabled without performing any non-blocking
183 // steps, then |error| should be Reset, i.e., its value set
184 // to Error::kSuccess. This is the "immediate success" case.
185 //
186 // In these two cases, because completion is immediate, |callback|
187 // is not used. If neither of these two conditions holds, then |error|
188 // should not be modified, and |callback| should be passed to the
189 // method that will initiate the non-blocking operation.
190 virtual void Start(Error *error,
191 const EnabledStateChangedCallback &callback) = 0;
192
193 // Each device must implement this method to do the work needed to
194 // disable the device, i.e., clear any running state, and make the
195 // device no longer capable of establishing network connections.
196 // The discussion for Start() regarding the use of |error| and
197 // |callback| apply to Stop() as well.
198 virtual void Stop(Error *error,
199 const EnabledStateChangedCallback &callback) = 0;
200
201 // The EnabledStateChangedCallback that gets passed to the device's
202 // Start() and Stop() methods is bound to this method. |callback|
203 // is the callback that was passed to SetEnabled().
204 void OnEnabledStateChanged(const ResultCallback &callback,
205 const Error &error);
206
Darin Petkovafa6fc42011-06-21 16:21:08 -0700207 // If there's an IP configuration in |ipconfig_|, releases the IP address and
208 // destroys the configuration instance.
209 void DestroyIPConfig();
210
211 // Creates a new DHCP IP configuration instance, stores it in |ipconfig_| and
212 // requests a new IP configuration. Registers a callback to
213 // IPConfigUpdatedCallback on IP configuration changes. Returns true if the IP
214 // request was successfully sent.
Paul Stewart2bf1d352011-12-06 15:02:55 -0800215 bool AcquireIPConfig();
Darin Petkovafa6fc42011-06-21 16:21:08 -0700216
Darin Petkov79d74c92012-03-07 17:20:32 +0100217 // Callback invoked on every IP configuration update.
218 void OnIPConfigUpdated(const IPConfigRefPtr &ipconfig, bool success);
219
Paul Stewarte6132022011-08-16 09:11:02 -0700220 // Maintain connection state (Routes, IP Addresses and DNS) in the OS.
221 void CreateConnection();
222
223 // Remove connection state
224 void DestroyConnection();
225
Paul Stewart03dba0b2011-08-22 16:32:45 -0700226 // Selects a service to be "current" -- i.e. link-state or configuration
227 // events that happen to the device are attributed to this service.
228 void SelectService(const ServiceRefPtr &service);
229
230 // Set the state of the selected service
231 void SetServiceState(Service::ConnectState state);
232
233 // Set the failure of the selected service (implicitly sets the state to
234 // "failure")
Eric Shienbroodcc95c5d2012-03-30 15:25:49 -0400235
Paul Stewart03dba0b2011-08-22 16:32:45 -0700236 void SetServiceFailure(Service::ConnectFailure failure_state);
237
Eric Shienbroodcc95c5d2012-03-30 15:25:49 -0400238 // Records the failure mode and time of the selected service, and
239 // sets the Service state of the selected service to "Idle".
240 // Avoids showing a failure mole in the UI.
241 void SetServiceFailureSilent(Service::ConnectFailure failure_state);
242
Paul Stewart20088d82012-02-16 06:58:55 -0800243 // Called by the Portal Detector whenever a trial completes. Device
244 // subclasses that choose unique mappings from portal results to connected
245 // states can override this method in order to do so.
246 virtual void PortalDetectorCallback(const PortalDetector::Result &result);
247
248 // Initiate portal detection, if enabled for this device type.
249 bool StartPortalDetection();
250
251 // Stop portal detection if it is running.
252 void StopPortalDetection();
253
254 // Set the state of the selected service, with checks to make sure
255 // the service is already in a connected state before doing so.
256 void SetServiceConnectedState(Service::ConnectState state);
257
Jason Glasgowb5790052012-01-27 01:03:52 -0500258 void HelpRegisterDerivedString(
259 const std::string &name,
260 std::string(Device::*get)(Error *),
261 void(Device::*set)(const std::string&, Error *));
Eric Shienbrood9a245532012-03-07 14:20:39 -0500262
263 void HelpRegisterDerivedStrings(
264 const std::string &name,
265 Strings(Device::*get)(Error *error),
266 void(Device::*set)(const Strings &value, Error *error));
Chris Masoneb925cc82011-06-22 15:39:57 -0700267
Jason Glasgow08afdff2012-04-03 10:22:26 -0400268 void HelpRegisterConstDerivedRpcIdentifiers(
269 const std::string &name,
270 RpcIdentifiers(Device::*get)(Error *));
271
Paul Stewartac4ac002011-08-26 12:04:26 -0700272 // Property getters reserved for subclasses
273 ControlInterface *control_interface() const { return control_interface_; }
Thieu Le3426c8f2012-01-11 17:35:11 -0800274 Metrics *metrics() const { return metrics_; }
Paul Stewartac4ac002011-08-26 12:04:26 -0700275 Manager *manager() const { return manager_; }
Paul Stewarta41e38d2011-11-11 07:47:29 -0800276 bool running() const { return running_; }
Paul Stewartd5843772011-05-11 15:40:42 -0700277
Paul Stewart75897df2011-04-27 09:05:53 -0700278 private:
Chris Masone413a3192011-05-09 17:10:05 -0700279 friend class DeviceAdaptorInterface;
Paul Stewartc681fa02012-03-02 19:40:04 -0800280 friend class DevicePortalDetectionTest;
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700281 friend class DeviceTest;
282 friend class CellularTest;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500283 friend class CellularCapabilityTest;
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700284 friend class WiFiMainTest;
Darin Petkovafa6fc42011-06-21 16:21:08 -0700285
Paul Stewart2bf1d352011-12-06 15:02:55 -0800286 static const char kIPFlagTemplate[];
287 static const char kIPFlagVersion4[];
288 static const char kIPFlagVersion6[];
289 static const char kIPFlagDisableIPv6[];
290 static const char kIPFlagUseTempAddr[];
291 static const char kIPFlagUseTempAddrUsedAndDefault[];
Paul Stewartc8f4bef2011-12-13 09:45:51 -0800292 static const char kIPFlagReversePathFilter[];
293 static const char kIPFlagReversePathFilterEnabled[];
294 static const char kIPFlagReversePathFilterLooseMode[];
Chris Masone5dec5f42011-07-22 14:07:55 -0700295 static const char kStoragePowered[];
296 static const char kStorageIPConfigs[];
297
Eric Shienbrood9a245532012-03-07 14:20:39 -0500298 void SetEnabledInternal(bool enable, bool persist,
299 Error *error, const ResultCallback &callback);
300
Chris Masone5dec5f42011-07-22 14:07:55 -0700301 // Right now, Devices reference IPConfigs directly when persisted to disk
302 // It's not clear that this makes sense long-term, but that's how it is now.
303 // This call generates a string in the right format for this persisting.
Chris Masone34af2182011-08-22 11:59:36 -0700304 // |suffix| is injected into the storage identifier used for the configs.
305 std::string SerializeIPConfigs(const std::string &suffix);
Chris Masone5dec5f42011-07-22 14:07:55 -0700306
Paul Stewart2bf1d352011-12-06 15:02:55 -0800307 // Set an IP configuration flag on the device. |ip_version| should be
308 // "ipv6" or "ipv4". |flag| should be the name of the flag to be set
309 // and |value| is what this flag should be set to.
310 bool SetIPFlag(IPAddress::Family family, const std::string &flag,
311 const std::string &value);
312
Gaurav Shah1b7a6162011-11-09 11:41:01 -0800313 std::vector<std::string> AvailableIPConfigs(Error *error);
Chris Masone4e851612011-07-01 10:46:53 -0700314 std::string GetRpcConnectionIdentifier();
315
Eric Shienbrood9a245532012-03-07 14:20:39 -0500316 // |enabled_persistent_| is the value of the Powered property, as
317 // read from the profile. If it is not found in the profile, it
318 // defaults to true. |enabled_| reflects the real-time state of
319 // the device, i.e., enabled or disabled. |enabled_pending_| reflects
320 // the target state of the device while an enable or disable operation
321 // is occurring.
322 //
323 // Some typical sequences for these state variables are shown below.
324 //
325 // Shill starts up, profile has been read:
326 // |enabled_persistent_|=true |enabled_|=false |enabled_pending_|=false
327 //
328 // Shill acts on the value of |enabled_persistent_|, calls SetEnabled(true):
329 // |enabled_persistent_|=true |enabled_|=false |enabled_pending_|=true
330 //
331 // SetEnabled completes successfully, device is enabled:
332 // |enabled_persistent_|=true |enabled_|=true |enabled_pending_|=true
333 //
334 // User presses "Disable" button, SetEnabled(false) is called:
335 // |enabled_persistent_|=false |enabled_|=true |enabled_pending_|=false
336 //
337 // SetEnabled completes successfully, device is disabled:
338 // |enabled_persistent_|=false |enabled_|=false |enabled_pending_|=false
339 bool enabled_;
340 bool enabled_persistent_;
341 bool enabled_pending_;
342
343 // Other properties
Paul Stewartac4ac002011-08-26 12:04:26 -0700344 bool reconnect_;
345 const std::string hardware_address_;
346
347 PropertyStore store_;
348
Paul Stewartac4ac002011-08-26 12:04:26 -0700349 const int interface_index_;
Paul Stewarta41e38d2011-11-11 07:47:29 -0800350 bool running_; // indicates whether the device is actually in operation
Paul Stewartac4ac002011-08-26 12:04:26 -0700351 const std::string link_name_;
352 const std::string unique_id_;
353 ControlInterface *control_interface_;
354 EventDispatcher *dispatcher_;
Thieu Le3426c8f2012-01-11 17:35:11 -0800355 Metrics *metrics_;
Paul Stewartac4ac002011-08-26 12:04:26 -0700356 Manager *manager_;
357 IPConfigRefPtr ipconfig_;
358 ConnectionRefPtr connection_;
Eric Shienbrood9a245532012-03-07 14:20:39 -0500359 base::WeakPtrFactory<Device> weak_ptr_factory_;
Darin Petkovafa6fc42011-06-21 16:21:08 -0700360 scoped_ptr<DeviceAdaptorInterface> adaptor_;
Paul Stewart20088d82012-02-16 06:58:55 -0800361 scoped_ptr<PortalDetector> portal_detector_;
Eric Shienbrood3e20a232012-02-16 11:35:56 -0500362 base::Callback<void(const PortalDetector::Result &)>
363 portal_detector_callback_;
Gaurav Shah435de2c2011-11-17 19:01:07 -0800364 Technology::Identifier technology_;
Thieu Le85e050b2012-03-13 15:04:38 -0700365 // The number of portal detection attempts from Connected to Online state.
366 // This includes all failure/timeout attempts and the final successful
367 // attempt.
368 int portal_attempts_to_online_;
Darin Petkovafa6fc42011-06-21 16:21:08 -0700369
Paul Stewart03dba0b2011-08-22 16:32:45 -0700370 // Maintain a reference to the connected / connecting service
371 ServiceRefPtr selected_service_;
372
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700373 // Cache singleton pointers for performance and test purposes.
Darin Petkov77cb6812011-08-15 16:19:41 -0700374 DHCPProvider *dhcp_provider_;
Thieu Lefb46caf2012-03-08 11:57:15 -0800375 RoutingTable *routing_table_;
mukesh agrawal5c4dd0b2011-09-14 13:53:14 -0700376 RTNLHandler *rtnl_handler_;
Darin Petkov77cb6812011-08-15 16:19:41 -0700377
Chris Masone9be4a9d2011-05-16 15:44:09 -0700378 DISALLOW_COPY_AND_ASSIGN(Device);
Paul Stewart75897df2011-04-27 09:05:53 -0700379};
380
Paul Stewart75897df2011-04-27 09:05:53 -0700381} // namespace shill
382
383#endif // SHILL_DEVICE_