21 const size_t DEFAULT_BUFFER_SIZE = 128;
74 const uint16_t ns_port,
76 const unsigned int wait,
87 response_(response_placeholder),
callback_(callback), proto_(proto) {
99 <<
" Transport protocol for DNS Updates; please use UDP");
115 <<
proto_ <<
"' specified for DNS Updates");
156 (*callback_)(status);
180 const uint16_t ns_port,
182 const unsigned int wait,
190 <<
". Provided timeout value is '" << wait <<
"'");
225 in_buf_,
this, static_cast<int>(wait));
229 io_service.
post(io_fetch);
234 : impl_(new
DNSClientImpl(response_placeholder, callback, proto)) {
243 static const unsigned int max_timeout = std::numeric_limits<int>::max();
244 return (max_timeout);
250 const uint16_t ns_port,
252 const unsigned int wait,
254 impl_->
doUpdate(io_service, ns_addr, ns_port, update, wait, tsig_key);
void setBuffer(isc::util::OutputBuffer *buffer)
Set or reset a temporary output buffer.
Upstream Fetch Processing.
The D2UpdateMessage encapsulates a DNS Update message.
Control code, fetch has been stopped.
DNSClientImpl(D2UpdateMessagePtr &response_placeholder, DNSClient::Callback *callback, const DNSClient::Protocol proto)
~DNSClient()
Virtual destructor, does nothing.
A generic exception that is thrown when a function is not implemented.
std::function< void()> callback_
The callback function.
void post(const std::function< void()> &callback)
Post a callback to the end of the queue.
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
void toWire(dns::AbstractMessageRenderer &renderer, dns::TSIGContext *const tsig_ctx=NULL)
Encode outgoing message into wire format.
Failure, fetch timed out.
util::OutputBufferPtr in_buf_
The IOService class is a wrapper for the ASIO io_service class.
Callback for the DNSClient class.
Other, unclassified error.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
isc::log::Logger d2_to_dns_logger("d2-to-dns")
dns::TSIGContextPtr tsig_context_
Status
A status code of the DNSClient.
boost::shared_ptr< TSIGKey > TSIGKeyPtr
D2UpdateMessagePtr & response_
Response received and is ok.
DNSClient::Callback * callback_
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
DNSClient::Status getStatus(const asiodns::IOFetch::Result)
This is a base class for exceptions thrown from the DNS library module.
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.
Response received but invalid.
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.
The MessageRenderer is a concrete derived class of AbstractMessageRenderer as a general purpose imple...
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
boost::shared_ptr< TSIGContext > TSIGContextPtr
Result
Result of Upstream Fetch.
const isc::log::MessageID DHCP_DDNS_INVALID_RESPONSE
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< OutputBuffer > OutputBufferPtr
const int DBGLVL_TRACE_DETAIL
Trace detailed operations.
The IOAddress class represents an IP addresses (version agnostic)
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)
Success, fetch completed.
DNSClient::Protocol proto_
virtual void operator()(asiodns::IOFetch::Result result)
Callback method.