[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_ |
| 7 | #pragma once |
| 8 | |
| 9 | #include "base/memory/scoped_ptr.h" |
| 10 | #include "net/base/net_export.h" |
| 11 | |
| 12 | namespace net { |
| 13 | |
| 14 | struct DnsConfig; |
| 15 | class DnsTransactionFactory; |
| 16 | class NetLog; |
| 17 | |
| 18 | // Convenience wrapper allows easy injection of DnsTransaction into |
| 19 | // HostResolverImpl. |
| 20 | class NET_EXPORT DnsClient { |
| 21 | public: |
| 22 | virtual ~DnsClient() {} |
| 23 | |
| 24 | // Creates a new DnsTransactionFactory according to the new |config|. |
| 25 | virtual void SetConfig(const DnsConfig& config) = 0; |
| 26 | |
| 27 | // Returns NULL if the current config is not valid. |
| 28 | virtual const DnsConfig* GetConfig() const = 0; |
| 29 | |
| 30 | // Returns NULL if the current config is not valid. |
| 31 | virtual DnsTransactionFactory* GetTransactionFactory() = 0; |
| 32 | |
| 33 | // Creates default client. |
| 34 | static scoped_ptr<DnsClient> CreateClient(NetLog* net_log); |
| 35 | }; |
| 36 | |
| 37 | } // namespace net |
| 38 | |
| 39 | #endif // NET_DNS_DNS_CLIENT_H_ |
| 40 | |