mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 21:18:02 +00:00
[#2078] Moved the factory to libd2srv
This commit is contained in:
parent
8489278255
commit
9ddb97c80b
@ -207,7 +207,7 @@ DNSClientImpl::doUpdate(asiolink::IOService& io_service,
|
||||
// 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();
|
||||
@ -262,14 +262,6 @@ DNSClientImpl::incrStats(const std::string& stat, bool update_key) {
|
||||
}
|
||||
}
|
||||
|
||||
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)) {
|
||||
|
@ -14,12 +14,10 @@
|
||||
|
||||
#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;
|
||||
|
||||
@ -85,18 +83,6 @@ public:
|
||||
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
|
||||
|
@ -58,5 +58,12 @@ D2TsigKey::resetStats() {
|
||||
}
|
||||
}
|
||||
|
||||
TSIGContextPtr
|
||||
defaultTsigContextFactory(D2TsigKeyPtr tsig_key) {
|
||||
return (TSIGContextPtr(new TSIGContext(*tsig_key)));
|
||||
}
|
||||
|
||||
TSIGContextFactory tsigContextFactory = &defaultTsigContextFactory;
|
||||
|
||||
} // namespace d2
|
||||
} // namespace isc
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define D2_TSIG_KEY_H
|
||||
|
||||
#include <dns/name.h>
|
||||
#include <dns/tsigkey.h>
|
||||
#include <dns/tsig.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace isc {
|
||||
@ -60,6 +60,18 @@ private:
|
||||
/// @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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user