18#include <boost/multi_index_container.hpp>
19#include <boost/multi_index/ordered_index.hpp>
20#include <boost/multi_index/indexed_by.hpp>
21#include <boost/multi_index/member.hpp>
22#include <boost/multi_index/mem_fun.hpp>
23#include <boost/multi_index/random_access_index.hpp>
24#include <boost/noncopyable.hpp>
25#include <boost/shared_ptr.hpp>
67 return (ncr_->getDhcid());
74 return (forward_domain_);
81 return (reverse_domain_);
111typedef boost::multi_index_container<
114 boost::multi_index::indexed_by<
116 boost::multi_index::random_access<
117 boost::multi_index::tag<VectorTag>
121 boost::multi_index::ordered_non_unique<
122 boost::multi_index::tag<DhcidTag>,
257 static std::vector<std::string>
const text_vector {
262 "STOPPED_QUEUE_FULL",
263 "STOPPED_RECV_ERROR",
266 static std::string
const unknown(
"UNKNOWN");
267 return (state < text_vector.size() ? text_vector[state] : unknown);
304 const bool reuse_address =
false);
371 return (ncr_queue_.size());
376 return (max_queue_size_);
450 bool suppress_duplicates =
false);
474 void updateStopState();
483 size_t max_queue_size_;
489 boost::shared_ptr<dhcp_ddns::NameChangeListener> listener_;
495 State target_stop_state_;
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOAddress class represents an IP addresses (version agnostic).
D2QueueMgrError(const char *file, size_t line, const char *what)
D2QueueMgrInvalidIndex(const char *file, size_t line, const char *what)
D2QueueMgrQueueEmpty(const char *file, size_t line, const char *what)
D2QueueMgrQueueFull(const char *file, size_t line, const char *what)
D2QueueMgrReceiveError(const char *file, size_t line, const char *what)
bool enqueue(dhcp_ddns::NameChangeRequestPtr &ncr, bool suppress_duplicates=false)
Adds a request to the end of the queue.
const MatchedNcrPtr findLast(const dhcp_ddns::D2Dhcid &dhcid) const
Fetches the last entry in the queue for a given DHCID.
State
Defines the list of possible states for D2QueueMgr.
virtual ~D2QueueMgr()
Destructor.
size_t getMaxQueueSize() const
Returns the maximum number of entries allowed in the queue.
MatchedNcrPtr matchNcr(dhcp_ddns::NameChangeRequestPtr ncr) const
Creates an NCR matched to forward and reverse domains.
State getMgrState() const
Returns the current state.
static const size_t MAX_QUEUE_DEFAULT
Maximum number of entries allowed in the request queue.
void dequeue()
Removes the entry at the front of the queue.
static std::string const & stateToText(State const &state)
Convert enum to string.
void removeListener()
Deletes the current listener.
void startListening()
Starts actively listening for requests.
void setMaxQueueSize(const size_t max_queue_size)
Sets the maximum number of entries allowed in the queue.
size_t getQueueSize() const
Returns the number of entries in the queue.
const MatchedNcrPtr & peek() const
Returns the entry at the front of the queue.
D2QueueMgr(asiolink::IOServicePtr &io_service, D2CfgMgrPtr &cfg_mgr, const size_t max_queue_size=MAX_QUEUE_DEFAULT)
Constructor.
virtual void operator()(const dhcp_ddns::NameChangeListener::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
Function operator implementing the NCR receive callback.
void clearQueue()
Removes all entries from the queue.
void initUDPListener(const isc::asiolink::IOAddress &ip_address, const uint32_t port, const dhcp_ddns::NameChangeFormat format, const bool reuse_address=false)
Initializes the listener as a UDP listener.
void dequeueAt(const size_t index)
Removes the entry at a given position in the queue.
void stopListening(const State target_stop_state=STOPPED)
Stops listening for requests.
const MatchedNcrPtr & peekAt(const size_t index) const
Returns the entry at a given position in the queue.
void refreshQueuedMatching()
Iterate over queue contents and redo the matching.
Wrapper for NameChangeRequest has been matched to forward and reverse domains.
void refresh(const MatchedNcr &source)
Update the domains from the given MatchedNcr.
DdnsDomainPtr getReverseDomain() const
Fetches the reverse domain matched to the ip Address.
dhcp_ddns::NameChangeRequestPtr getNcr() const
Fetches the NameChangeRequest.
const dhcp_ddns::D2Dhcid & getDhcid() const
Fetches the DHCID from the NCR.
DdnsDomainPtr getForwardDomain() const
Fetches the forward domain matched to the FQDN.
MatchedNcr(const dhcp_ddns::NameChangeRequestPtr &ncr, const DdnsDomainPtr &forward_domain, const DdnsDomainPtr &reverse_domain)
Constructor.
Container class for handling the DHCID value within a NameChangeRequest.
Abstract class for defining application layer receive callbacks.
Result
Defines the outcome of an asynchronous NCR receive.
Defines a State within the State Model.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< DdnsDomain > DdnsDomainPtr
Defines a pointer for DdnsDomain instances.
boost::shared_ptr< D2CfgMgr > D2CfgMgrPtr
Defines a shared pointer to D2CfgMgr.
boost::shared_ptr< MatchedNcr > MatchedNcrPtr
Shared pointer to a MatchedNcr.
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
boost::multi_index_container< MatchedNcrPtr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< VectorTag > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< DhcidTag >, boost::multi_index::const_mem_fun< MatchedNcr, const dhcp_ddns::D2Dhcid &, &MatchedNcr::getDhcid > > > > NcrQueue
A multi index container holding MatchedNcr pointers.
NameChangeFormat
Defines the list of data wire formats supported.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Defines the logger used by the top-level component of kea-lfc.
This file defines abstract classes for exchanging NameChangeRequests.
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
Tag for insertion order index.