Kea 2.0.0
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
11
12#include <asiolink/io_service.h>
13#include <util/buffer.h>
14
15#include <asiodns/io_fetch.h>
16#include <d2srv/d2_tsig_key.h>
17
18namespace isc {
19namespace d2 {
20
21class DNSClient;
22typedef boost::shared_ptr<DNSClient> DNSClientPtr;
23
25class DNSClientImpl;
26
49class DNSClient {
50public:
51
54 enum Protocol {
56 TCP
57 };
58
60 enum Status {
65 OTHER
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
110private:
111 DNSClient(const DNSClient& source);
112 DNSClient& operator=(const DNSClient& source);
114
115public:
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 D2TsigKeyPtr& tsig_key = D2TsigKeyPtr());
150
151private:
152 DNSClientImpl* impl_;
153};
154
155} // namespace d2
156} // namespace isc
157
158#endif // DNS_CLIENT_H
The D2UpdateMessage encapsulates a DNS Update message.
Callback for the DNSClient class.
Definition: dns_client.h:74
virtual ~Callback()
Virtual destructor.
Definition: dns_client.h:77
virtual void operator()(DNSClient::Status status)=0
Function operator implementing a callback.
The DNSClient class handles communication with the DNS server.
Definition: dns_client.h:49
~DNSClient()
Virtual destructor, does nothing.
Definition: dns_client.cc:270
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
Definition: dns_client.cc:265
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:281
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
Definition: dns_client.cc:275
Status
A status code of the DNSClient.
Definition: dns_client.h:60
@ IO_STOPPED
IO was stopped.
Definition: dns_client.h:63
@ TIMEOUT
No response, timeout.
Definition: dns_client.h:62
@ OTHER
Other, unclassified error.
Definition: dns_client.h:65
@ INVALID_RESPONSE
Response received but invalid.
Definition: dns_client.h:64
@ SUCCESS
Response received and is ok.
Definition: dns_client.h:61
Protocol
Transport layer protocol used by a DNS Client to communicate with a server.
Definition: dns_client.h:54
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
boost::shared_ptr< DNSClient > DNSClientPtr
Definition: dns_client.h:21
boost::shared_ptr< D2TsigKey > D2TsigKeyPtr
Type of pointer to a D2 TSIG key.
Definition: d2_tsig_key.h:71
Defines the logger used by the top-level component of kea-lfc.