summaryrefslogtreecommitdiffstats
path: root/net/dns/dns_client.h
blob: 13aa0bf8ed1183320180b4482110a15540df6e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_DNS_DNS_CLIENT_H_
#define NET_DNS_DNS_CLIENT_H_

#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"

namespace net {

struct DnsConfig;
class DnsTransactionFactory;
class NetLog;

// Convenience wrapper allows easy injection of DnsTransaction into
// HostResolverImpl.
class NET_EXPORT DnsClient {
 public:
  virtual ~DnsClient() {}

  // Creates a new DnsTransactionFactory according to the new |config|.
  virtual void SetConfig(const DnsConfig& config) = 0;

  // Returns NULL if the current config is not valid.
  virtual const DnsConfig* GetConfig() const = 0;

  // Returns NULL if the current config is not valid.
  virtual DnsTransactionFactory* GetTransactionFactory() = 0;

  // Creates default client.
  static scoped_ptr<DnsClient> CreateClient(NetLog* net_log);
};

}  // namespace net

#endif  // NET_DNS_DNS_CLIENT_H_