Thieu Le | 94eed56 | 2012-02-21 15:57:29 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 2 | // 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_DHCP_CONFIG_ |
| 6 | #define SHILL_DHCP_CONFIG_ |
| 7 | |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 11 | #include <base/cancelable_callback.h> |
Ben Chan | a0ddf46 | 2014-02-06 11:32:42 -0800 | [diff] [blame] | 12 | #include <base/files/file_path.h> |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 13 | #include <base/memory/scoped_ptr.h> |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 14 | #include <base/memory/weak_ptr.h> |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 15 | #include <dbus-c++/types.h> |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 16 | #include <glib.h> |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 17 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 18 | |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 19 | #include "shill/ipconfig.h" |
Jorge Lucangeli Obes | ad43cc6 | 2012-04-11 16:25:43 -0700 | [diff] [blame] | 20 | #include "shill/minijail.h" |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 21 | |
| 22 | namespace shill { |
| 23 | |
Chris Masone | 19e3040 | 2011-07-19 15:48:47 -0700 | [diff] [blame] | 24 | class ControlInterface; |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 25 | class DHCPProvider; |
| 26 | class DHCPProxyInterface; |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 27 | class EventDispatcher; |
Darin Petkov | 3258a81 | 2011-06-23 11:28:45 -0700 | [diff] [blame] | 28 | class GLib; |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 29 | class ProxyFactory; |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 30 | |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 31 | // This class provides a DHCP client instance for the device |device_name|. |
| 32 | // If |request_hostname| is non-empty, it asks the DHCP server to register |
| 33 | // this hostname on our behalf, for purposes of administration or creating |
| 34 | // a dynamic DNS entry. |
| 35 | // |
| 36 | // The DHPCConfig instance asks the DHCP client to create a lease file |
| 37 | // containing the name |lease_file_suffix|. If this suffix is the same as |
| 38 | // |device_name|, the lease is considered to be ephemeral, and the lease |
| 39 | // file is removed whenever this DHCPConfig instance is no longer needed. |
| 40 | // Otherwise, the lease file persists and will be re-used in future attempts. |
Eric Shienbrood | 9a24553 | 2012-03-07 14:20:39 -0500 | [diff] [blame] | 41 | class DHCPConfig : public IPConfig { |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 42 | public: |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 43 | typedef std::map<std::string, DBus::Variant> Configuration; |
| 44 | |
Darin Petkov | 14c29ec | 2012-03-02 11:34:19 +0100 | [diff] [blame] | 45 | static const int kMinMTU; |
| 46 | |
Chris Masone | 19e3040 | 2011-07-19 15:48:47 -0700 | [diff] [blame] | 47 | DHCPConfig(ControlInterface *control_interface, |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 48 | EventDispatcher *dispatcher, |
Chris Masone | 19e3040 | 2011-07-19 15:48:47 -0700 | [diff] [blame] | 49 | DHCPProvider *provider, |
Darin Petkov | f65e928 | 2011-06-21 14:29:56 -0700 | [diff] [blame] | 50 | const std::string &device_name, |
Paul Stewart | d32f484 | 2012-01-11 16:08:13 -0800 | [diff] [blame] | 51 | const std::string &request_hostname, |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 52 | const std::string &lease_file_suffix, |
| 53 | bool arp_gateway, |
Paul Stewart | 75a68b9 | 2013-10-24 10:50:27 -0700 | [diff] [blame] | 54 | bool is_minimal_config, |
Darin Petkov | 3258a81 | 2011-06-23 11:28:45 -0700 | [diff] [blame] | 55 | GLib *glib); |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 56 | virtual ~DHCPConfig(); |
| 57 | |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 58 | // Inherited from IPConfig. |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 59 | virtual bool RequestIP(); |
| 60 | virtual bool RenewIP(); |
Paul Stewart | 217c61d | 2013-06-13 15:12:02 -0700 | [diff] [blame] | 61 | virtual bool ReleaseIP(ReleaseReason reason); |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 62 | |
| 63 | // If |proxy_| is not initialized already, sets it to a new D-Bus proxy to |
| 64 | // |service|. |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 65 | void InitProxy(const std::string &service); |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 66 | |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 67 | // Processes an Event signal from dhcpcd. |
| 68 | void ProcessEventSignal(const std::string &reason, |
| 69 | const Configuration &configuration); |
| 70 | |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 71 | protected: |
| 72 | // Overrides base clase implementation. |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 73 | virtual void UpdateProperties(const Properties &properties); |
| 74 | virtual void NotifyFailure(); |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 75 | |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 76 | private: |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 77 | friend class DHCPConfigTest; |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 78 | FRIEND_TEST(DHCPConfigCallbackTest, ProcessEventSignalFail); |
| 79 | FRIEND_TEST(DHCPConfigCallbackTest, ProcessEventSignalGatewayArp); |
| 80 | FRIEND_TEST(DHCPConfigCallbackTest, ProcessEventSignalGatewayArpNak); |
| 81 | FRIEND_TEST(DHCPConfigCallbackTest, ProcessEventSignalSuccess); |
| 82 | FRIEND_TEST(DHCPConfigCallbackTest, ProcessEventSignalUnknown); |
| 83 | FRIEND_TEST(DHCPConfigCallbackTest, RequestIPTimeout); |
| 84 | FRIEND_TEST(DHCPConfigCallbackTest, StartTimeout); |
Paul Stewart | 475c072 | 2014-04-18 08:52:00 -0700 | [diff] [blame] | 85 | FRIEND_TEST(DHCPConfigCallbackTest, StoppedDuringFailureCallback); |
| 86 | FRIEND_TEST(DHCPConfigCallbackTest, StoppedDuringSuccessCallback); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 87 | FRIEND_TEST(DHCPConfigTest, GetIPv4AddressString); |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 88 | FRIEND_TEST(DHCPConfigTest, InitProxy); |
Paul Stewart | 65bcd08 | 2012-11-16 09:37:14 -0800 | [diff] [blame] | 89 | FRIEND_TEST(DHCPConfigTest, ParseClasslessStaticRoutes); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 90 | FRIEND_TEST(DHCPConfigTest, ParseConfiguration); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 91 | FRIEND_TEST(DHCPConfigTest, ReleaseIP); |
Paul Stewart | a02ee49 | 2012-05-16 10:04:53 -0700 | [diff] [blame] | 92 | FRIEND_TEST(DHCPConfigTest, ReleaseIPArpGW); |
Paul Stewart | 217c61d | 2013-06-13 15:12:02 -0700 | [diff] [blame] | 93 | FRIEND_TEST(DHCPConfigTest, ReleaseIPStaticIPWithLease); |
| 94 | FRIEND_TEST(DHCPConfigTest, ReleaseIPStaticIPWithoutLease); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 95 | FRIEND_TEST(DHCPConfigTest, RenewIP); |
| 96 | FRIEND_TEST(DHCPConfigTest, RequestIP); |
| 97 | FRIEND_TEST(DHCPConfigTest, Restart); |
| 98 | FRIEND_TEST(DHCPConfigTest, RestartNoClient); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 99 | FRIEND_TEST(DHCPConfigTest, StartFail); |
Paul Stewart | d32f484 | 2012-01-11 16:08:13 -0800 | [diff] [blame] | 100 | FRIEND_TEST(DHCPConfigTest, StartWithHostname); |
Paul Stewart | 75a68b9 | 2013-10-24 10:50:27 -0700 | [diff] [blame] | 101 | FRIEND_TEST(DHCPConfigTest, StartWithMinimalConfig); |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 102 | FRIEND_TEST(DHCPConfigTest, StartWithoutArpGateway); |
Paul Stewart | d32f484 | 2012-01-11 16:08:13 -0800 | [diff] [blame] | 103 | FRIEND_TEST(DHCPConfigTest, StartWithoutHostname); |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 104 | FRIEND_TEST(DHCPConfigTest, StartWithoutLeaseSuffix); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 105 | FRIEND_TEST(DHCPConfigTest, Stop); |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 106 | FRIEND_TEST(DHCPConfigTest, StopDuringRequestIP); |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 107 | FRIEND_TEST(DHCPProviderTest, CreateConfig); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 108 | |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 109 | static const int kAcquisitionTimeoutSeconds; |
| 110 | |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 111 | static const char kConfigurationKeyBroadcastAddress[]; |
Paul Stewart | 65bcd08 | 2012-11-16 09:37:14 -0800 | [diff] [blame] | 112 | static const char kConfigurationKeyClasslessStaticRoutes[]; |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 113 | static const char kConfigurationKeyDNS[]; |
| 114 | static const char kConfigurationKeyDomainName[]; |
| 115 | static const char kConfigurationKeyDomainSearch[]; |
| 116 | static const char kConfigurationKeyIPAddress[]; |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 117 | static const char kConfigurationKeyLeaseTime[]; |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 118 | static const char kConfigurationKeyMTU[]; |
| 119 | static const char kConfigurationKeyRouters[]; |
| 120 | static const char kConfigurationKeySubnetCIDR[]; |
Paul Stewart | c3fdba9 | 2013-12-02 11:12:38 -0800 | [diff] [blame] | 121 | static const char kConfigurationKeyVendorEncapsulatedOptions[]; |
Paul Stewart | a63f521 | 2013-06-25 15:29:40 -0700 | [diff] [blame] | 122 | static const char kConfigurationKeyWebProxyAutoDiscoveryUrl[]; |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 123 | |
Thieu Le | 94eed56 | 2012-02-21 15:57:29 -0800 | [diff] [blame] | 124 | static const int kDHCPCDExitPollMilliseconds; |
| 125 | static const int kDHCPCDExitWaitMilliseconds; |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 126 | static const char kDHCPCDPath[]; |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 127 | static const char kDHCPCDPathFormatPID[]; |
Jorge Lucangeli Obes | ad43cc6 | 2012-04-11 16:25:43 -0700 | [diff] [blame] | 128 | static const char kDHCPCDUser[]; |
Paul Stewart | 75a68b9 | 2013-10-24 10:50:27 -0700 | [diff] [blame] | 129 | static const char kDHCPCDMinimalConfig[]; |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 130 | |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 131 | static const char kReasonBound[]; |
| 132 | static const char kReasonFail[]; |
Paul Stewart | 94571f1 | 2013-09-10 17:26:07 -0700 | [diff] [blame] | 133 | static const char kReasonGatewayArp[]; |
| 134 | static const char kReasonNak[]; |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 135 | static const char kReasonRebind[]; |
| 136 | static const char kReasonReboot[]; |
| 137 | static const char kReasonRenew[]; |
| 138 | |
Chris Masone | 0756f23 | 2011-07-21 17:24:00 -0700 | [diff] [blame] | 139 | static const char kType[]; |
| 140 | |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 141 | // Starts dhcpcd, returns true on success and false otherwise. |
| 142 | bool Start(); |
| 143 | |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 144 | // Stops dhcpcd if running. |
mukesh agrawal | 1835e77 | 2013-01-15 18:35:03 -0800 | [diff] [blame] | 145 | void Stop(const char *reason); |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 146 | |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 147 | // Stops dhcpcd if already running and then starts it. Returns true on success |
| 148 | // and false otherwise. |
| 149 | bool Restart(); |
| 150 | |
Paul Stewart | 65bcd08 | 2012-11-16 09:37:14 -0800 | [diff] [blame] | 151 | // Parses |classless_routes| into |properties|. Sets the default gateway |
| 152 | // if one is supplied and |properties| does not already contain one. It |
| 153 | // also sets the "routes" parameter of the IPConfig properties for all |
| 154 | // routes not converted into the default gateway. Returns true on |
| 155 | // success, and false otherwise. |
| 156 | static bool ParseClasslessStaticRoutes(const std::string &classless_routes, |
| 157 | IPConfig::Properties *properties); |
| 158 | |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 159 | // Parses |configuration| into |properties|. Returns true on success, and |
| 160 | // false otherwise. |
mukesh agrawal | 28fd88e | 2013-05-02 14:06:10 -0700 | [diff] [blame] | 161 | static bool ParseConfiguration(const Configuration &configuration, |
| 162 | IPConfig::Properties *properties); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 163 | |
| 164 | // Returns the string representation of the IP address |address|, or an |
| 165 | // empty string on failure. |
mukesh agrawal | 28fd88e | 2013-05-02 14:06:10 -0700 | [diff] [blame] | 166 | static std::string GetIPv4AddressString(unsigned int address); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 167 | |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 168 | // Called when the dhcpcd client process exits. |
| 169 | static void ChildWatchCallback(GPid pid, gint status, gpointer data); |
| 170 | |
Darin Petkov | 98dd6a0 | 2011-06-10 15:12:57 -0700 | [diff] [blame] | 171 | // Cleans up remaining state from a running client, if any, including freeing |
| 172 | // its GPid, exit watch callback, and state files. |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 173 | void CleanupClientState(); |
| 174 | |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 175 | // Initialize a callback that will invoke ProcessAcquisitionTimeout if we |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 176 | // do not get a lease in a reasonable amount of time. |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 177 | void StartAcquisitionTimeout(); |
| 178 | // Cancel callback created by StartAcquisitionTimeout. One-liner included |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 179 | // for symmetry. |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 180 | void StopAcquisitionTimeout(); |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 181 | // Called if we do not get a DHCP lease in a reasonable amount of time. |
| 182 | // Informs upper layers of the failure. |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 183 | void ProcessAcquisitionTimeout(); |
| 184 | |
| 185 | // Initialize a callback that will invoke ProcessExpirationTimeout if we |
| 186 | // do not renew a lease in a |lease_duration_seconds|. |
| 187 | void StartExpirationTimeout(uint32 lease_duration_seconds); |
| 188 | // Cancel callback created by StartExpirationTimeout. One-liner included |
| 189 | // for symmetry. |
| 190 | void StopExpirationTimeout(); |
| 191 | // Called if we do not renew a DHCP lease by the time the lease expires. |
| 192 | // Informs upper layers of the expiration and restarts the DHCP client. |
| 193 | void ProcessExpirationTimeout(); |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 194 | |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 195 | // Kills DHCP client process. |
Darin Petkov | 3fe1766 | 2013-02-04 14:19:08 +0100 | [diff] [blame] | 196 | void KillClient(); |
| 197 | |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 198 | // Store cached copies of singletons for speed/ease of testing. |
| 199 | ProxyFactory *proxy_factory_; |
| 200 | |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 201 | DHCPProvider *provider_; |
| 202 | |
Paul Stewart | d32f484 | 2012-01-11 16:08:13 -0800 | [diff] [blame] | 203 | // Hostname to be used in the request. This will be passed to the DHCP |
| 204 | // server in the request. |
| 205 | std::string request_hostname_; |
| 206 | |
Paul Stewart | d408fdf | 2012-05-07 17:15:57 -0700 | [diff] [blame] | 207 | // DHCP lease file suffix, used to differentiate the lease of one interface |
| 208 | // or network from another. |
| 209 | std::string lease_file_suffix_; |
| 210 | |
| 211 | // Specifies whether to supply an argument to the DHCP client to validate |
| 212 | // the acquired IP address using an ARP request to the gateway IP address. |
| 213 | bool arp_gateway_; |
| 214 | |
Paul Stewart | 75a68b9 | 2013-10-24 10:50:27 -0700 | [diff] [blame] | 215 | // Specifies whether to configure the the DHCP client to request the bare |
| 216 | // minimum of options in order to escape any MTU issues with the packet size |
| 217 | // of the DHCP server's reply. |
| 218 | bool is_minimal_config_; |
| 219 | |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 220 | // The PID of the spawned DHCP client. May be 0 if no client has been spawned |
| 221 | // yet or the client has died. |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 222 | int pid_; |
| 223 | |
| 224 | // Child exit watch callback source tag. |
| 225 | unsigned int child_watch_tag_; |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 226 | |
Paul Stewart | 217c61d | 2013-06-13 15:12:02 -0700 | [diff] [blame] | 227 | // Whether a lease has been acquired from the DHCP server or gateway ARP. |
| 228 | bool is_lease_active_; |
| 229 | |
Paul Stewart | 94571f1 | 2013-09-10 17:26:07 -0700 | [diff] [blame] | 230 | // Whether it is valid to retain the lease acquired via gateway ARP. |
| 231 | bool is_gateway_arp_active_; |
| 232 | |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 233 | // The proxy for communicating with the DHCP client. |
| 234 | scoped_ptr<DHCPProxyInterface> proxy_; |
| 235 | |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 236 | // Called if we fail to get a DHCP lease in a timely manner. |
| 237 | base::CancelableClosure lease_acquisition_timeout_callback_; |
| 238 | |
| 239 | // Time to wait for a DHCP lease. Represented as field so that it |
| 240 | // can be overriden in tests. |
| 241 | unsigned int lease_acquisition_timeout_seconds_; |
| 242 | |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 243 | // Called if a DHCP lease expires. |
| 244 | base::CancelableClosure lease_expiration_callback_; |
| 245 | |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 246 | // Root file path, used for testing. |
Albert Chaulk | 0e1cdea | 2013-02-27 15:32:55 -0800 | [diff] [blame] | 247 | base::FilePath root_; |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 248 | |
mukesh agrawal | cc0fded | 2012-05-09 13:40:58 -0700 | [diff] [blame] | 249 | base::WeakPtrFactory<DHCPConfig> weak_ptr_factory_; |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 250 | EventDispatcher *dispatcher_; |
Darin Petkov | 3258a81 | 2011-06-23 11:28:45 -0700 | [diff] [blame] | 251 | GLib *glib_; |
Darin Petkov | f7897bc | 2011-06-08 17:13:36 -0700 | [diff] [blame] | 252 | |
Jorge Lucangeli Obes | ad43cc6 | 2012-04-11 16:25:43 -0700 | [diff] [blame] | 253 | Minijail *minijail_; |
| 254 | |
Darin Petkov | 50308cd | 2011-06-01 18:25:07 -0700 | [diff] [blame] | 255 | DISALLOW_COPY_AND_ASSIGN(DHCPConfig); |
| 256 | }; |
| 257 | |
| 258 | } // namespace shill |
| 259 | |
| 260 | #endif // SHILL_DHCP_CONFIG_ |