23 const size_t DEFAULT_BUFFER_SIZE = 128;
105 const uint16_t ns_port,
107 const unsigned int wait,
121 void incrStats(
const std::string& stat,
bool update_key =
true);
128 response_(response_placeholder), callback_(callback), proto_(proto) {
140 <<
" Transport protocol for DNS Updates; please use UDP");
156 <<
proto_ <<
"' specified for DNS Updates");
202 (*callback_)(status);
227 const uint16_t ns_port,
229 const unsigned int wait,
237 <<
". Provided timeout value is '" << wait <<
"'");
274 in_buf_,
this, static_cast<int>(wait));
278 io_service.
post(io_fetch);
292 mgr.
addValue(stat, static_cast<int64_t>(1));
295 static_cast<int64_t>(1));
301 : impl_(new
DNSClientImpl(response_placeholder, callback, proto)) {
309 static const unsigned int max_timeout = std::numeric_limits<int>::max();
310 return (max_timeout);
316 const uint16_t ns_port,
318 const unsigned int wait,
320 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.
void incrStats(const std::string &stat, bool update_key=true)
This function updates statistics.
Control code, fetch has been stopped.
DNSClientImpl(D2UpdateMessagePtr &response_placeholder, DNSClient::Callback *callback, const DNSClient::Protocol proto)
Constructor.
~DNSClient()
Virtual destructor, does nothing.
A generic exception that is thrown when a function is not implemented.
void post(const std::function< void()> &callback)
Post a callback to the end of the queue.
std::string tsig_key_name_
TSIG key name for stats.
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
boost::shared_ptr< D2TsigKey > D2TsigKeyPtr
Type of pointer to a D2 TSIG key.
void toWire(dns::AbstractMessageRenderer &renderer, dns::TSIGContext *const tsig_ctx=NULL)
Encode outgoing message into wire format.
Failure, fetch timed out.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
static StatsMgr & instance()
Statistics Manager accessor method.
util::OutputBufferPtr in_buf_
A buffer holding response from a DNS.
Statistics Manager class.
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_
TSIG context used to sign outbound and verify inbound messages.
DNSClient::Status getStatus(const asiodns::IOFetch::Result result)
This function maps the IO error to the DNSClient error.
Status
A status code of the DNSClient.
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.
D2UpdateMessagePtr & response_
A caller-supplied object which will hold the parsed response from DNS.
Response received and is ok.
DNSClient::Callback * callback_
A caller-supplied external callback which is invoked when DNS message exchange is complete or interru...
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
This is a base class for exceptions thrown from the DNS library module.
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.
Response received but invalid.
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 D2TsigKeyPtr &tsig_key)
Starts asynchronous DNS Update using TSIG.
virtual ~DNSClientImpl()
Destructor.
Success, fetch completed.
DNSClient::Protocol proto_
A Transport Layer protocol used to communicate with a DNS.
virtual void operator()(asiodns::IOFetch::Result result)
This internal callback is called when the DNS update message exchange is complete.