// pointer. Message marshalling uses non-null context is the indicator
// that TSIG should be used.
if (tsig_key) {
- tsig_context_ = DNSClient::factory(tsig_key);
+ tsig_context_ = tsigContextFactory(tsig_key);
tsig_key_name_ = tsig_key->getKeyName().toText();
} else {
tsig_context_.reset();
}
}
-TSIGContextPtr
-DNSClient::defaultFactory(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)(D2TsigKeyPtr);
-
- /// @brief 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(D2TsigKeyPtr tsig_key);
-
/// @brief Constructor.
///
/// @param response_placeholder Message object pointer which will be updated
}
}
+TSIGContextPtr
+defaultTsigContextFactory(D2TsigKeyPtr tsig_key) {
+ return (TSIGContextPtr(new TSIGContext(*tsig_key)));
+}
+
+TSIGContextFactory tsigContextFactory = &defaultTsigContextFactory;
+
} // namespace d2
} // namespace isc
#define D2_TSIG_KEY_H
#include <dns/name.h>
-#include <dns/tsigkey.h>
+#include <dns/tsig.h>
#include <boost/shared_ptr.hpp>
namespace isc {
/// @brief Type of pointer to a D2 TSIG key.
typedef boost::shared_ptr<D2TsigKey> D2TsigKeyPtr;
+/// @brief TSIGContext factory type.
+typedef dns::TSIGContextPtr (*TSIGContextFactory)(D2TsigKeyPtr);
+
+/// @brief The TSIGContext factory.
+extern TSIGContextFactory tsigContextFactory;
+
+/// @brief Default TSIGContext factory.
+///
+/// @param tsig_key a D2 TSIG key.
+/// @return a pointer to a TSIG context.
+dns::TSIGContextPtr defaultTsigContextFactory(D2TsigKeyPtr tsig_key);
+
} // namespace d2
} // namespace isc