Kea  1.9.9-git
dns_client.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 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 <d2/d2_update_message.h>
11 
12 #include <asiolink/io_service.h>
13 #include <util/buffer.h>
14 
15 #include <asiodns/io_fetch.h>
16 #include <dns/tsig.h>
17 
18 namespace isc {
19 namespace d2 {
20 
21 class DNSClient;
22 typedef boost::shared_ptr<DNSClient> DNSClientPtr;
23 
25 class DNSClientImpl;
26 
49 class DNSClient {
50 public:
51 
54  enum Protocol {
55  UDP,
57  };
58 
60  enum Status {
66  };
67 
74  class Callback {
75  public:
77  virtual ~Callback() { }
78 
83  virtual void operator()(DNSClient::Status status) = 0;
84  };
85 
95  DNSClient(D2UpdateMessagePtr& response_placeholder, Callback* callback,
96  const Protocol proto = UDP);
97 
99  ~DNSClient();
100 
109 
110 private:
111  DNSClient(const DNSClient& source);
112  DNSClient& operator=(const DNSClient& source);
114 
115 public:
116 
121  static unsigned int getMaxTimeout();
122 
144  void doUpdate(asiolink::IOService& io_service,
145  const asiolink::IOAddress& ns_addr,
146  const uint16_t ns_port,
147  D2UpdateMessage& update,
148  const unsigned int wait,
149  const dns::TSIGKeyPtr& tsig_key = dns::TSIGKeyPtr());
150 
151 private:
152  DNSClientImpl* impl_;
153 };
154 
155 } // namespace d2
156 } // namespace isc
157 
158 #endif // DNS_CLIENT_H
The D2UpdateMessage encapsulates a DNS Update message.
~DNSClient()
Virtual destructor, does nothing.
Definition: dns_client.cc:237
The DNSClient class handles communication with the DNS server.
Definition: dns_client.h:49
boost::shared_ptr< DNSClient > DNSClientPtr
Definition: dns_client.h:21
virtual ~Callback()
Virtual destructor.
Definition: dns_client.h:77
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
No response, timeout.
Definition: dns_client.h:62
Callback for the DNSClient class.
Definition: dns_client.h:74
Other, unclassified error.
Definition: dns_client.h:65
virtual void operator()(DNSClient::Status status)=0
Function operator implementing a callback.
Status
A status code of the DNSClient.
Definition: dns_client.h:60
boost::shared_ptr< TSIGKey > TSIGKeyPtr
Definition: tsig.h:436
Response received and is ok.
Definition: dns_client.h:61
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
Definition: dns_client.cc:242
Defines the logger used by the top-level component of kea-dhcp-ddns.
Protocol
Transport layer protocol used by a DNS Client to communicate with a server.
Definition: dns_client.h:54
Response received but invalid.
Definition: dns_client.h:64
void doUpdate(asiolink::IOService &io_service, const asiolink::IOAddress &ns_addr, const uint16_t ns_port, D2UpdateMessage &update, const unsigned int wait, const dns::TSIGKeyPtr &tsig_key=dns::TSIGKeyPtr())
Start asynchronous DNS Update with TSIG.
Definition: dns_client.cc:248
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
Definition: dns_client.cc:232