Kea  2.3.5-git
dns_client.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef DNS_CLIENT_H
8 #define DNS_CLIENT_H
9 
10 #include <asiolink/io_service.h>
11 #include <asiodns/io_fetch.h>
12 #include <d2srv/d2_tsig_key.h>
14 #include <util/buffer.h>
15 
16 namespace isc {
17 namespace d2 {
18 
19 class DNSClient;
20 typedef boost::shared_ptr<DNSClient> DNSClientPtr;
21 
23 class DNSClientImpl;
24 
47 class DNSClient {
48 public:
49 
52  enum Protocol {
53  UDP,
55  };
56 
58  enum Status {
64  };
65 
72  class Callback {
73  public:
75  virtual ~Callback() { }
76 
81  virtual void operator()(DNSClient::Status status) = 0;
82  };
83 
93  DNSClient(D2UpdateMessagePtr& response_placeholder, Callback* callback,
94  const Protocol proto = UDP);
95 
97  ~DNSClient();
98 
107 
108 private:
109  DNSClient(const DNSClient& source);
110  DNSClient& operator=(const DNSClient& source);
112 
113 public:
114 
119  static unsigned int getMaxTimeout();
120 
142  void doUpdate(asiolink::IOService& io_service,
143  const asiolink::IOAddress& ns_addr,
144  const uint16_t ns_port,
145  D2UpdateMessage& update,
146  const unsigned int wait,
147  const D2TsigKeyPtr& tsig_key = D2TsigKeyPtr());
148 
149 private:
151  std::unique_ptr<DNSClientImpl> impl_;
152 };
153 
154 } // namespace d2
155 } // namespace isc
156 
157 #endif // DNS_CLIENT_H
The D2UpdateMessage encapsulates a DNS Update message.
~DNSClient()
Virtual destructor, does nothing.
Definition: dns_client.cc:304
The DNSClient class handles communication with the DNS server.
Definition: dns_client.h:47
boost::shared_ptr< DNSClient > DNSClientPtr
Definition: dns_client.h:19
virtual ~Callback()
Virtual destructor.
Definition: dns_client.h:75
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
boost::shared_ptr< D2TsigKey > D2TsigKeyPtr
Type of pointer to a D2 TSIG key.
Definition: d2_tsig_key.h:71
No response, timeout.
Definition: dns_client.h:60
Callback for the DNSClient class.
Definition: dns_client.h:72
Other, unclassified error.
Definition: dns_client.h:63
virtual void operator()(DNSClient::Status status)=0
Function operator implementing a callback.
Status
A status code of the DNSClient.
Definition: dns_client.h:58
void doUpdate(asiolink::IOService &io_service, const asiolink::IOAddress &ns_addr, const uint16_t ns_port, D2UpdateMessage &update, const unsigned int wait, const D2TsigKeyPtr &tsig_key=D2TsigKeyPtr())
Start asynchronous DNS Update with TSIG.
Definition: dns_client.cc:314
Response received and is ok.
Definition: dns_client.h:59
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
Definition: dns_client.cc:308
Defines the logger used by the top-level component of kea-lfc.
Protocol
Transport layer protocol used by a DNS Client to communicate with a server.
Definition: dns_client.h:52
Response received but invalid.
Definition: dns_client.h:62
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
Definition: dns_client.cc:299