// pointer. Message marshalling uses non-null context is the indicator
// that TSIG should be used.
if (tsig_key) {
- tsig_context_.reset(new TSIGContext(*tsig_key));
+ tsig_context_ = DNSClient::factory(tsig_key);
tsig_key_name_ = tsig_key->getKeyName().toText();
} else {
tsig_context_.reset();
}
}
+TSIGContextPtr
+DNSClient::defaultFactory(const D2TsigKeyPtr& tsig_key) {
+ return (TSIGContextPtr(new TSIGContext(*tsig_key)));
+}
+
+DNSClient::TSIGContextFactory
+DNSClient::factory = &DNSClient::defaultFactory;
+
DNSClient::DNSClient(D2UpdateMessagePtr& response_placeholder,
Callback* callback, const DNSClient::Protocol proto)
: impl_(new DNSClientImpl(response_placeholder, callback, proto)) {
#include <asiodns/io_fetch.h>
#include <d2srv/d2_tsig_key.h>
+#include <dns/tsig.h>
namespace isc {
namespace d2 {
+/// @brief Forward declaration of DNSclient class.
class DNSClient;
typedef boost::shared_ptr<DNSClient> DNSClientPtr;
virtual void operator()(DNSClient::Status status) = 0;
};
+ /// @brief TSIGContext factory type.
+ typedef dns::TSIGContextPtr (*TSIGContextFactory)(const D2TsigKeyPtr&);
+
+ /// @brief Pointer to the TSIGContext factory.
+ static TSIGContextFactory factory;
+
+ /// @brief Default TSIGContext factory.
+ ///
+ /// @param tsig_key a D2 TSIG key.
+ /// @return a pointer to a TSIG context.
+ static dns::TSIGContextPtr defaultFactory(const D2TsigKeyPtr& tsig_key);
+
/// @brief Constructor.
///
/// @param response_placeholder Message object pointer which will be updated