23const size_t DEFAULT_BUFFER_SIZE = 128;
111 const uint16_t ns_port,
113 const unsigned int wait,
127 void incrStats(
const std::string& stat,
bool update_key =
true);
137 response_(response_placeholder), callback_(callback), proto_(proto),
150 <<
" Transport protocol for DNS Updates; please use UDP");
166 <<
proto_ <<
"' specified for DNS Updates");
222 (*callback_)(status);
247 const uint16_t ns_port,
249 const unsigned int wait,
260 <<
". Provided timeout value is '" << wait <<
"'");
297 in_buf_,
this,
static_cast<int>(wait)));
302 io_service->post(*io_fetch);
316 mgr.addValue(stat,
static_cast<int64_t
>(1));
319 static_cast<int64_t
>(1));
325 : impl_(new
DNSClientImpl(response_placeholder, callback, proto)) {
339 static const unsigned int max_timeout = std::numeric_limits<int>::max();
340 return (max_timeout);
346 const uint16_t ns_port,
348 const unsigned int wait,
350 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.
The IOAddress class represents an IP addresses (version agnostic)
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.
std::list< IOFetchPtr > io_fetch_list_
The list of IOFetch objects.
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.
void stop()
This function stops the IOFetch objects.
DNSClientImpl(D2UpdateMessagePtr &response_placeholder, DNSClient::Callback *callback, const DNSClient::Protocol proto)
Constructor.
void doUpdate(const asiolink::IOServicePtr &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.
bool stopped_
Flag which indicates that the client has been stopped.
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.
void doUpdate(const asiolink::IOServicePtr &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.
~DNSClient()
Virtual destructor, does nothing.
DNSClient(D2UpdateMessagePtr &response_placeholder, Callback *callback, const Protocol proto=UDP)
Constructor.
void stop()
Stop the client.
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.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< IOFetch > IOFetchPtr
Defines a pointer to an IOFetch.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
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
Type of pointers to output buffers.
Defines the logger used by the top-level component of kea-lfc.