Thieu Le | caef893 | 2012-02-28 16:06:59 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -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 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 5 | #ifndef SHILL_IPCONFIG_H_ |
| 6 | #define SHILL_IPCONFIG_H_ |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 7 | |
Ben Chan | cd47732 | 2014-10-17 14:19:30 -0700 | [diff] [blame] | 8 | #include <memory> |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 9 | #include <string> |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 10 | #include <sys/time.h> |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 11 | #include <vector> |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 12 | |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 13 | #include <base/callback.h> |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 14 | #include <base/memory/ref_counted.h> |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 15 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 16 | |
Peter Qiu | 8d6b597 | 2014-10-28 15:33:34 -0700 | [diff] [blame] | 17 | #include "shill/net/ip_address.h" |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 18 | #include "shill/property_store.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 19 | #include "shill/refptr_types.h" |
Darin Petkov | 6059674 | 2012-03-05 12:17:17 +0100 | [diff] [blame] | 20 | #include "shill/routing_table_entry.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 21 | |
Chris Masone | c1e5041 | 2011-06-07 13:04:53 -0700 | [diff] [blame] | 22 | namespace shill { |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 23 | class ControlInterface; |
| 24 | class Error; |
| 25 | class IPConfigAdaptorInterface; |
Paul Stewart | 1062d9d | 2012-04-27 10:42:27 -0700 | [diff] [blame] | 26 | class StaticIPParameters; |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 27 | class Time; |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 28 | |
| 29 | // IPConfig superclass. Individual IP configuration types will inherit from this |
| 30 | // class. |
Chris Masone | 27c4aa5 | 2011-07-02 13:10:14 -0700 | [diff] [blame] | 31 | class IPConfig : public base::RefCounted<IPConfig> { |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 32 | public: |
Darin Petkov | 6059674 | 2012-03-05 12:17:17 +0100 | [diff] [blame] | 33 | struct Route { |
| 34 | std::string host; |
| 35 | std::string netmask; |
| 36 | std::string gateway; |
| 37 | }; |
| 38 | |
Paul Stewart | c39f113 | 2011-06-22 12:02:28 -0700 | [diff] [blame] | 39 | struct Properties { |
Paul Stewart | 7355ce1 | 2011-09-02 10:47:01 -0700 | [diff] [blame] | 40 | Properties() : address_family(IPAddress::kFamilyUnknown), |
Paul Stewart | 48100b0 | 2012-03-19 07:53:52 -0700 | [diff] [blame] | 41 | subnet_prefix(0), |
Peter Qiu | b255a76 | 2015-06-10 10:09:12 -0700 | [diff] [blame] | 42 | delegated_prefix_length(0), |
Prabhu Kaliamoorthi | 762bfb8 | 2015-02-06 13:17:08 +0100 | [diff] [blame] | 43 | user_traffic_only(false), |
Prabhu Kaliamoorthi | 1f58903 | 2015-02-23 13:28:20 +0100 | [diff] [blame] | 44 | default_route(true), |
Ben Chan | a016312 | 2012-09-25 15:10:52 -0700 | [diff] [blame] | 45 | blackhole_ipv6(false), |
Paul Stewart | 024a6c8 | 2015-01-23 14:59:40 -0800 | [diff] [blame] | 46 | mtu(kUndefinedMTU), |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 47 | lease_duration_seconds(0) {} |
Paul Stewart | c39f113 | 2011-06-22 12:02:28 -0700 | [diff] [blame] | 48 | |
Paul Stewart | 1d18e8c | 2011-07-15 11:00:31 -0700 | [diff] [blame] | 49 | IPAddress::Family address_family; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 50 | std::string address; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame] | 51 | int32_t subnet_prefix; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 52 | std::string broadcast_address; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 53 | std::vector<std::string> dns_servers; |
| 54 | std::string domain_name; |
Matthew Wein | 08add48 | 2015-04-20 13:26:48 -0700 | [diff] [blame] | 55 | std::string accepted_hostname; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 56 | std::vector<std::string> domain_search; |
Chris Masone | 43b48a1 | 2011-07-01 13:37:07 -0700 | [diff] [blame] | 57 | std::string gateway; |
| 58 | std::string method; |
| 59 | std::string peer_address; |
Peter Qiu | b255a76 | 2015-06-10 10:09:12 -0700 | [diff] [blame] | 60 | // IPv6 prefix delegated from a DHCPv6 server. |
| 61 | std::string delegated_prefix; |
| 62 | int32_t delegated_prefix_length; |
Prabhu Kaliamoorthi | 762bfb8 | 2015-02-06 13:17:08 +0100 | [diff] [blame] | 63 | // Set the flag when a secondary routing table should be used for less |
| 64 | // privileged user traffic which alone would be sent to the VPN client. A |
| 65 | // primary routing table will be used for traffic from privileged processes |
| 66 | // which will bypass VPN. |
| 67 | bool user_traffic_only; |
Prabhu Kaliamoorthi | 1f58903 | 2015-02-23 13:28:20 +0100 | [diff] [blame] | 68 | // Set the flag to true when the interface should be set as the default |
| 69 | // route. |
| 70 | bool default_route; |
Prabhu Kaliamoorthi | 762bfb8 | 2015-02-06 13:17:08 +0100 | [diff] [blame] | 71 | // A list of IP blocks in CIDR format that should be excluded from VPN. |
| 72 | std::vector<std::string> exclusion_list; |
Ben Chan | a016312 | 2012-09-25 15:10:52 -0700 | [diff] [blame] | 73 | bool blackhole_ipv6; |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame] | 74 | int32_t mtu; |
Darin Petkov | 6059674 | 2012-03-05 12:17:17 +0100 | [diff] [blame] | 75 | std::vector<Route> routes; |
Paul Stewart | c3fdba9 | 2013-12-02 11:12:38 -0800 | [diff] [blame] | 76 | // Vendor encapsulated option string gained from DHCP. |
| 77 | std::string vendor_encapsulated_options; |
Paul Stewart | a63f521 | 2013-06-25 15:29:40 -0700 | [diff] [blame] | 78 | // Web Proxy Auto Discovery (WPAD) URL gained from DHCP. |
| 79 | std::string web_proxy_auto_discovery; |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 80 | // Length of time the lease was granted. |
Ben Chan | 7fab897 | 2014-08-10 17:14:46 -0700 | [diff] [blame] | 81 | uint32_t lease_duration_seconds; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
Ben Chan | 26692bd | 2014-02-03 16:34:55 -0800 | [diff] [blame] | 84 | enum Method { |
| 85 | kMethodUnknown, |
| 86 | kMethodPPP, |
| 87 | kMethodStatic, |
| 88 | kMethodDHCP |
| 89 | }; |
| 90 | |
Paul Stewart | 217c61d | 2013-06-13 15:12:02 -0700 | [diff] [blame] | 91 | enum ReleaseReason { |
| 92 | kReleaseReasonDisconnect, |
| 93 | kReleaseReasonStaticIP |
| 94 | }; |
| 95 | |
Samuel Tan | 3c3c36a | 2014-12-16 16:53:19 -0800 | [diff] [blame] | 96 | typedef base::Callback<void(const IPConfigRefPtr&, bool)> UpdateCallback; |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 97 | typedef base::Callback<void(const IPConfigRefPtr&)> Callback; |
| 98 | |
Paul Stewart | 024a6c8 | 2015-01-23 14:59:40 -0800 | [diff] [blame] | 99 | // Define a default and a minimum viable MTU value. |
| 100 | static const int kDefaultMTU; |
| 101 | static const int kMinIPv4MTU; |
| 102 | static const int kMinIPv6MTU; |
| 103 | static const int kUndefinedMTU; |
| 104 | |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 105 | IPConfig(ControlInterface* control_interface, const std::string& device_name); |
| 106 | IPConfig(ControlInterface* control_interface, |
| 107 | const std::string& device_name, |
| 108 | const std::string& type); |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 109 | virtual ~IPConfig(); |
| 110 | |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 111 | const std::string& device_name() const { return device_name_; } |
| 112 | const std::string& type() const { return type_; } |
Chris Masone | 0756f23 | 2011-07-21 17:24:00 -0700 | [diff] [blame] | 113 | uint serial() const { return serial_; } |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 114 | |
Chris Masone | 4e85161 | 2011-07-01 10:46:53 -0700 | [diff] [blame] | 115 | std::string GetRpcIdentifier(); |
| 116 | |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 117 | // Registers a callback that's executed every time the configuration |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 118 | // properties are acquired. Takes ownership of |callback|. Pass NULL |
Samuel Tan | 3c3c36a | 2014-12-16 16:53:19 -0800 | [diff] [blame] | 119 | // to remove a callback. The callback's first argument is a pointer to this IP |
Darin Petkov | f9b0ca8 | 2011-06-20 12:10:23 -0700 | [diff] [blame] | 120 | // configuration instance allowing clients to more easily manage multiple IP |
Samuel Tan | 3c3c36a | 2014-12-16 16:53:19 -0800 | [diff] [blame] | 121 | // configurations. The callback's second argument is a boolean indicating |
| 122 | // whether or not a DHCP lease was acquired from the server. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 123 | void RegisterUpdateCallback(const UpdateCallback& callback); |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 124 | |
| 125 | // Registers a callback that's executed every time the configuration |
| 126 | // properties fail to be acquired. Takes ownership of |callback|. Pass NULL |
| 127 | // to remove a callback. The callback's argument is a pointer to this IP |
| 128 | // configuration instance allowing clients to more easily manage multiple IP |
| 129 | // configurations. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 130 | void RegisterFailureCallback(const Callback& callback); |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 131 | |
Paul Stewart | 8223653 | 2013-12-10 15:33:11 -0800 | [diff] [blame] | 132 | // Registers a callback that's executed every time the Refresh method |
| 133 | // on the ipconfig is called. Takes ownership of |callback|. Pass NULL |
| 134 | // to remove a callback. The callback's argument is a pointer to this IP |
| 135 | // configuration instance allowing clients to more easily manage multiple IP |
| 136 | // configurations. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 137 | void RegisterRefreshCallback(const Callback& callback); |
Paul Stewart | 8223653 | 2013-12-10 15:33:11 -0800 | [diff] [blame] | 138 | |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 139 | // Registers a callback that's executed every time the the lease exipres |
| 140 | // and the IPConfig is about to perform a restart to attempt to regain it. |
| 141 | // Takes ownership of |callback|. Pass NULL to remove a callback. The |
| 142 | // callback's argument is a pointer to this IP configuration instance |
| 143 | // allowing clients to more easily manage multiple IP configurations. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 144 | void RegisterExpireCallback(const Callback& callback); |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 145 | |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 146 | void set_properties(const Properties& props) { properties_ = props; } |
| 147 | virtual const Properties& properties() const { return properties_; } |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 148 | |
Peter Qiu | a89154b | 2014-05-23 15:45:42 -0700 | [diff] [blame] | 149 | // Update DNS servers setting for this ipconfig, this allows Chrome |
| 150 | // to retrieve the new DNS servers. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 151 | virtual void UpdateDNSServers(const std::vector<std::string>& dns_servers); |
Peter Qiu | a89154b | 2014-05-23 15:45:42 -0700 | [diff] [blame] | 152 | |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 153 | // Reset the IPConfig properties to their default values. |
| 154 | virtual void ResetProperties(); |
| 155 | |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 156 | // Request, renew and release IP configuration. Return true on success, false |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 157 | // otherwise. The default implementation always returns false indicating a |
Paul Stewart | a02ee49 | 2012-05-16 10:04:53 -0700 | [diff] [blame] | 158 | // failure. ReleaseIP is advisory: if we are no longer connected, it is not |
| 159 | // possible to properly vacate the lease on the remote server. Also, |
| 160 | // depending on the configuration of the specific IPConfig subclass, we may |
| 161 | // end up holding on to the lease so we can resume to the network lease |
| 162 | // faster. |
Darin Petkov | 92c4390 | 2011-06-09 20:46:06 -0700 | [diff] [blame] | 163 | virtual bool RequestIP(); |
| 164 | virtual bool RenewIP(); |
Paul Stewart | 217c61d | 2013-06-13 15:12:02 -0700 | [diff] [blame] | 165 | virtual bool ReleaseIP(ReleaseReason reason); |
Darin Petkov | d1b715b | 2011-06-02 21:21:22 -0700 | [diff] [blame] | 166 | |
Paul Stewart | 4558bda | 2012-08-03 10:44:10 -0700 | [diff] [blame] | 167 | // Refresh IP configuration. Called by the DBus Adaptor "Refresh" call. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 168 | void Refresh(Error* error); |
Paul Stewart | 4558bda | 2012-08-03 10:44:10 -0700 | [diff] [blame] | 169 | |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 170 | PropertyStore* mutable_store() { return &store_; } |
| 171 | const PropertyStore& store() const { return store_; } |
| 172 | void ApplyStaticIPParameters(StaticIPParameters* static_ip_parameters); |
Chris Masone | 43b48a1 | 2011-07-01 13:37:07 -0700 | [diff] [blame] | 173 | |
Paul Stewart | 8223653 | 2013-12-10 15:33:11 -0800 | [diff] [blame] | 174 | // Restore the fields of |properties_| to their original values before |
| 175 | // static IP parameters were previously applied. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 176 | void RestoreSavedIPParameters(StaticIPParameters* static_ip_parameters); |
Paul Stewart | 8223653 | 2013-12-10 15:33:11 -0800 | [diff] [blame] | 177 | |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 178 | // Updates |current_lease_expiration_time_| by adding |new_lease_duration| to |
| 179 | // the current time. |
| 180 | virtual void UpdateLeaseExpirationTime(uint32_t new_lease_duration); |
| 181 | |
| 182 | // Resets |current_lease_expiration_time_| to its default value. |
| 183 | virtual void ResetLeaseExpirationTime(); |
| 184 | |
| 185 | // Returns the time left (in seconds) till the current DHCP lease is to be |
| 186 | // renewed in |time_left|. Returns false if an error occurs (i.e. current |
| 187 | // lease has already expired or no current DHCP lease), true otherwise. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 188 | bool TimeToLeaseExpiry(uint32_t* time_left); |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 189 | |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 190 | protected: |
mukesh agrawal | 7aed61c | 2013-04-22 16:01:24 -0700 | [diff] [blame] | 191 | // Inform RPC listeners of changes to our properties. MAY emit |
| 192 | // changes even on unchanged properties. |
| 193 | virtual void EmitChanges(); |
| 194 | |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 195 | // Updates the IP configuration properties and notifies registered listeners |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 196 | // about the event. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 197 | virtual void UpdateProperties(const Properties& properties, |
Samuel Tan | 3c3c36a | 2014-12-16 16:53:19 -0800 | [diff] [blame] | 198 | bool new_lease_acquired); |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 199 | |
| 200 | // Notifies registered listeners that the configuration process has failed. |
| 201 | virtual void NotifyFailure(); |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 202 | |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 203 | // Notifies registered listeners that the lease has expired. |
| 204 | virtual void NotifyExpiry(); |
| 205 | |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 206 | private: |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 207 | friend class IPConfigAdaptorInterface; |
mukesh agrawal | 7aed61c | 2013-04-22 16:01:24 -0700 | [diff] [blame] | 208 | friend class IPConfigTest; |
Paul Stewart | dd60e45 | 2011-08-08 11:38:36 -0700 | [diff] [blame] | 209 | friend class ConnectionTest; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 210 | |
Paul Stewart | 2bf1d35 | 2011-12-06 15:02:55 -0800 | [diff] [blame] | 211 | FRIEND_TEST(DeviceTest, AcquireIPConfig); |
Darin Petkov | afa6fc4 | 2011-06-21 16:21:08 -0700 | [diff] [blame] | 212 | FRIEND_TEST(DeviceTest, DestroyIPConfig); |
Paul Stewart | fa11e28 | 2013-12-02 22:04:25 -0800 | [diff] [blame] | 213 | FRIEND_TEST(DeviceTest, IsConnectedViaTether); |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 214 | FRIEND_TEST(DeviceTest, OnIPConfigExpired); |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 215 | FRIEND_TEST(IPConfigTest, UpdateCallback); |
| 216 | FRIEND_TEST(IPConfigTest, UpdateProperties); |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 217 | FRIEND_TEST(IPConfigTest, UpdateLeaseExpirationTime); |
| 218 | FRIEND_TEST(IPConfigTest, TimeToLeaseExpiry_NoDHCPLease); |
| 219 | FRIEND_TEST(IPConfigTest, TimeToLeaseExpiry_CurrentLeaseExpired); |
| 220 | FRIEND_TEST(IPConfigTest, TimeToLeaseExpiry_Success); |
Paul Stewart | b606394 | 2011-08-05 10:17:29 -0700 | [diff] [blame] | 221 | FRIEND_TEST(ResolverTest, Empty); |
| 222 | FRIEND_TEST(ResolverTest, NonEmpty); |
Paul Stewart | 3f68bb1 | 2012-03-15 13:33:10 -0700 | [diff] [blame] | 223 | FRIEND_TEST(RoutingTableTest, ConfigureRoutes); |
Paul Stewart | 75e89d2 | 2011-08-01 10:00:02 -0700 | [diff] [blame] | 224 | FRIEND_TEST(RoutingTableTest, RouteAddDelete); |
Thieu Le | caef893 | 2012-02-28 16:06:59 -0800 | [diff] [blame] | 225 | FRIEND_TEST(RoutingTableTest, RouteDeleteForeign); |
Darin Petkov | efb09c3 | 2011-06-07 20:24:17 -0700 | [diff] [blame] | 226 | |
Chris Masone | 0756f23 | 2011-07-21 17:24:00 -0700 | [diff] [blame] | 227 | static const char kType[]; |
Chris Masone | 0756f23 | 2011-07-21 17:24:00 -0700 | [diff] [blame] | 228 | |
mukesh agrawal | 7aed61c | 2013-04-22 16:01:24 -0700 | [diff] [blame] | 229 | void Init(); |
| 230 | |
| 231 | static uint global_serial_; |
Paul Stewart | ac4ac00 | 2011-08-26 12:04:26 -0700 | [diff] [blame] | 232 | PropertyStore store_; |
Darin Petkov | f65e928 | 2011-06-21 14:29:56 -0700 | [diff] [blame] | 233 | const std::string device_name_; |
Chris Masone | 0756f23 | 2011-07-21 17:24:00 -0700 | [diff] [blame] | 234 | const std::string type_; |
| 235 | const uint serial_; |
Ben Chan | cd47732 | 2014-10-17 14:19:30 -0700 | [diff] [blame] | 236 | std::unique_ptr<IPConfigAdaptorInterface> adaptor_; |
Darin Petkov | e7cb7f8 | 2011-06-03 13:21:51 -0700 | [diff] [blame] | 237 | Properties properties_; |
Samuel Tan | 3c3c36a | 2014-12-16 16:53:19 -0800 | [diff] [blame] | 238 | UpdateCallback update_callback_; |
Paul Stewart | c509953 | 2013-12-12 07:53:15 -0800 | [diff] [blame] | 239 | Callback failure_callback_; |
| 240 | Callback refresh_callback_; |
Paul Stewart | 1f916e4 | 2013-12-23 09:52:54 -0800 | [diff] [blame] | 241 | Callback expire_callback_; |
Samuel Tan | 815a6fb | 2014-10-23 16:53:59 -0700 | [diff] [blame] | 242 | struct timeval current_lease_expiration_time_; |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 243 | Time* time_; |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 244 | |
Darin Petkov | e02b3ca | 2011-05-31 16:00:44 -0700 | [diff] [blame] | 245 | DISALLOW_COPY_AND_ASSIGN(IPConfig); |
| 246 | }; |
| 247 | |
| 248 | } // namespace shill |
| 249 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 250 | #endif // SHILL_IPCONFIG_H_ |