Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_DNS_HOST_RESOLVER_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_H_ | 6 #define NET_DNS_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 170 |
| 171 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. | 171 // Returns the HostResolverCache |this| uses, or NULL if there isn't one. |
| 172 // Used primarily to clear the cache and for getting debug information. | 172 // Used primarily to clear the cache and for getting debug information. |
| 173 virtual HostCache* GetHostCache(); | 173 virtual HostCache* GetHostCache(); |
| 174 | 174 |
| 175 // Returns the current DNS configuration |this| is using, as a Value, or NULL | 175 // Returns the current DNS configuration |this| is using, as a Value, or NULL |
| 176 // if it's configured to always use the system host resolver. Caller takes | 176 // if it's configured to always use the system host resolver. Caller takes |
| 177 // ownership of the returned Value. | 177 // ownership of the returned Value. |
| 178 virtual base::Value* GetDnsConfigAsValue() const; | 178 virtual base::Value* GetDnsConfigAsValue() const; |
| 179 | 179 |
| 180 // Sets the IP addresss to use instead of the one provided by doing a lookup | |
| 181 // on gethostname() for operating systems where gethostname() returns | |
| 182 // localhost (e.g. Chrome OS). | |
| 183 void SetMyIpAddresses(const std::string& ipv4_address, | |
| 184 const std::string& ipv6_address); | |
| 185 | |
| 186 // Fills in |addresses| from my_ip*_addresses and returns true if set. | |
| 187 bool ResolveFromMyIpAddress(bool include_ipv6, | |
|
eroman
2014/05/02 01:48:18
I am still unhappy with this design. Adding string
stevenjb
2014/05/02 16:56:13
I could certainly make the name more clear and wou
| |
| 188 AddressList* addresses) const; | |
| 189 | |
| 180 // Creates a HostResolver implementation that queries the underlying system. | 190 // Creates a HostResolver implementation that queries the underlying system. |
| 181 // (Except if a unit-test has changed the global HostResolverProc using | 191 // (Except if a unit-test has changed the global HostResolverProc using |
| 182 // ScopedHostResolverProc to intercept requests to the system). | 192 // ScopedHostResolverProc to intercept requests to the system). |
| 183 static scoped_ptr<HostResolver> CreateSystemResolver( | 193 static scoped_ptr<HostResolver> CreateSystemResolver( |
| 184 const Options& options, | 194 const Options& options, |
| 185 NetLog* net_log); | 195 NetLog* net_log); |
| 186 | 196 |
| 187 // As above, but uses default parameters. | 197 // As above, but uses default parameters. |
| 188 static scoped_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); | 198 static scoped_ptr<HostResolver> CreateDefaultResolver(NetLog* net_log); |
| 189 | 199 |
| 190 protected: | 200 protected: |
| 191 HostResolver(); | 201 HostResolver(); |
| 192 | 202 |
| 193 private: | 203 private: |
| 204 std::string my_ipv4_address_; | |
|
eroman
2014/05/02 01:48:18
Please store these instead as IpAddressNumber
| |
| 205 std::string my_ipv6_address_; | |
| 206 | |
| 194 DISALLOW_COPY_AND_ASSIGN(HostResolver); | 207 DISALLOW_COPY_AND_ASSIGN(HostResolver); |
| 195 }; | 208 }; |
| 196 | 209 |
| 197 } // namespace net | 210 } // namespace net |
| 198 | 211 |
| 199 #endif // NET_DNS_HOST_RESOLVER_H_ | 212 #endif // NET_DNS_HOST_RESOLVER_H_ |
| OLD | NEW |