blob: 01d024b9a17032b18d51c57177e74ae478f1177a [file] [log] [blame]
[email protected]78eac2a2012-03-14 19:09:271// 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]78eac2a2012-03-14 19:09:277
danakj22f90e72016-04-16 01:55:408#include <memory>
9
[email protected]78eac2a2012-03-14 19:09:2710#include "net/base/net_export.h"
11
12namespace net {
13
[email protected]0adcb2b2012-08-15 21:30:4614class AddressSorter;
[email protected]78eac2a2012-03-14 19:09:2715struct DnsConfig;
16class DnsTransactionFactory;
17class NetLog;
18
[email protected]0adcb2b2012-08-15 21:30:4619// 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]78eac2a2012-03-14 19:09:2722class NET_EXPORT DnsClient {
23 public:
24 virtual ~DnsClient() {}
25
[email protected]3d164772013-08-21 03:25:1926 // Destroys the current DnsTransactionFactory and creates a new one
27 // according to |config|, unless it is invalid or has |unhandled_options|.
[email protected]78eac2a2012-03-14 19:09:2728 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]0adcb2b2012-08-15 21:30:4636 // Returns NULL if the current config is not valid.
37 virtual AddressSorter* GetAddressSorter() = 0;
38
[email protected]78eac2a2012-03-14 19:09:2739 // Creates default client.
danakj22f90e72016-04-16 01:55:4040 static std::unique_ptr<DnsClient> CreateClient(NetLog* net_log);
[email protected]78eac2a2012-03-14 19:09:2741};
42
43} // namespace net
44
45#endif // NET_DNS_DNS_CLIENT_H_
46