[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef NET_DNS_DNS_CLIENT_H_ | ||||
6 | #define NET_DNS_DNS_CLIENT_H_ | ||||
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 7 | |
danakj | 22f90e7 | 2016-04-16 01:55:40 | [diff] [blame^] | 8 | #include <memory> |
9 | |||||
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 10 | #include "net/base/net_export.h" |
11 | |||||
12 | namespace net { | ||||
13 | |||||
[email protected] | 0adcb2b | 2012-08-15 21:30:46 | [diff] [blame] | 14 | class AddressSorter; |
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 15 | struct DnsConfig; |
16 | class DnsTransactionFactory; | ||||
17 | class NetLog; | ||||
18 | |||||
[email protected] | 0adcb2b | 2012-08-15 21:30:46 | [diff] [blame] | 19 | // Convenience wrapper which allows easy injection of DnsTransaction into |
20 | // HostResolverImpl. Pointers returned by the Get* methods are only guaranteed | ||||
21 | // to remain valid until next time SetConfig is called. | ||||
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 22 | class NET_EXPORT DnsClient { |
23 | public: | ||||
24 | virtual ~DnsClient() {} | ||||
25 | |||||
[email protected] | 3d16477 | 2013-08-21 03:25:19 | [diff] [blame] | 26 | // Destroys the current DnsTransactionFactory and creates a new one |
27 | // according to |config|, unless it is invalid or has |unhandled_options|. | ||||
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 28 | virtual void SetConfig(const DnsConfig& config) = 0; |
29 | |||||
30 | // Returns NULL if the current config is not valid. | ||||
31 | virtual const DnsConfig* GetConfig() const = 0; | ||||
32 | |||||
33 | // Returns NULL if the current config is not valid. | ||||
34 | virtual DnsTransactionFactory* GetTransactionFactory() = 0; | ||||
35 | |||||
[email protected] | 0adcb2b | 2012-08-15 21:30:46 | [diff] [blame] | 36 | // Returns NULL if the current config is not valid. |
37 | virtual AddressSorter* GetAddressSorter() = 0; | ||||
38 | |||||
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 39 | // Creates default client. |
danakj | 22f90e7 | 2016-04-16 01:55:40 | [diff] [blame^] | 40 | static std::unique_ptr<DnsClient> CreateClient(NetLog* net_log); |
[email protected] | 78eac2a | 2012-03-14 19:09:27 | [diff] [blame] | 41 | }; |
42 | |||||
43 | } // namespace net | ||||
44 | |||||
45 | #endif // NET_DNS_DNS_CLIENT_H_ | ||||
46 |