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);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown when a function is not implemented.
Upstream Fetch Processing.
Result
Result of Upstream Fetch.
@ STOPPED
Control code, fetch has been stopped.
@ TIME_OUT
Failure, fetch timed out.
@ SUCCESS
Success, fetch completed.
The IOAddress class represents an IP addresses (version agnostic)
The IOService class is a wrapper for the ASIO io_service class.
void post(const std::function< void()> &callback)
Post a callback to the end of the queue.
The D2UpdateMessage encapsulates a DNS Update message.
void toWire(dns::AbstractMessageRenderer &renderer, dns::TSIGContext *const tsig_ctx=NULL)
Encode outgoing message into wire format.
void incrStats(const std::string &stat, bool update_key=true)
This function updates statistics.
virtual void operator()(asiodns::IOFetch::Result result)
This internal callback is called when the DNS update message exchange is complete.
std::string tsig_key_name_
TSIG key name for stats.
DNSClient::Callback * callback_
A caller-supplied external callback which is invoked when DNS message exchange is complete or interru...
dns::TSIGContextPtr tsig_context_
TSIG context used to sign outbound and verify inbound messages.
D2UpdateMessagePtr & response_
A caller-supplied object which will hold the parsed response from DNS.
virtual ~DNSClientImpl()
Destructor.
DNSClientImpl(D2UpdateMessagePtr &response_placeholder, DNSClient::Callback *callback, const DNSClient::Protocol proto)
Constructor.
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.
DNSClient::Protocol proto_
A Transport Layer protocol used to communicate with a DNS.
DNSClient::Status getStatus(const asiodns::IOFetch::Result result)
This function maps the IO error to the DNSClient error.
util::OutputBufferPtr in_buf_
A buffer holding response from a DNS.
Callback for the DNSClient class.
~DNSClient()
Virtual destructor, does nothing.
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
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.
static unsigned int getMaxTimeout()
Returns maximal allowed timeout value accepted by DNSClient::doUpdate.
Status
A status code of the DNSClient.
@ IO_STOPPED
IO was stopped.
@ TIMEOUT
No response, timeout.
@ OTHER
Other, unclassified error.
@ INVALID_RESPONSE
Response received but invalid.
@ SUCCESS
Response received and is ok.
Protocol
Transport layer protocol used by a DNS Client to communicate with a server.
void setBuffer(isc::util::OutputBuffer *buffer)
Set or reset a temporary output buffer.
The MessageRenderer is a concrete derived class of AbstractMessageRenderer as a general purpose imple...
Statistics Manager class.
static StatsMgr & instance()
Statistics Manager accessor method.
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< D2UpdateMessage > D2UpdateMessagePtr
Pointer to the DNS Update Message.
isc::log::Logger d2_to_dns_logger("d2-to-dns")
const isc::log::MessageID DHCP_DDNS_INVALID_RESPONSE
boost::shared_ptr< D2TsigKey > D2TsigKeyPtr
Type of pointer to a D2 TSIG key.
boost::shared_ptr< TSIGContext > TSIGContextPtr
const int DBGLVL_TRACE_DETAIL
Trace detailed operations.
boost::shared_ptr< OutputBuffer > OutputBufferPtr
Defines the logger used by the top-level component of kea-lfc.