19#include <boost/noncopyable.hpp>
155 static std::vector<std::string>
const text_vector {
160 "STOPPED_QUEUE_FULL",
161 "STOPPED_RECV_ERROR",
164 static std::string
const unknown(
"UNKNOWN");
165 return (state < text_vector.size() ? text_vector[state] : unknown);
200 const bool reuse_address =
false);
266 return (ncr_queue_.size());
271 return (max_queue_size_);
338 void updateStopState();
344 size_t max_queue_size_;
350 boost::shared_ptr<dhcp_ddns::NameChangeListener> listener_;
356 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)
const dhcp_ddns::NameChangeRequestPtr & peek() const
Returns the entry at the front of the queue.
D2QueueMgr(asiolink::IOServicePtr &io_service, const size_t max_queue_size=MAX_QUEUE_DEFAULT)
Constructor.
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.
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.
const dhcp_ddns::NameChangeRequestPtr & peekAt(const size_t index) const
Returns the entry at a given position in the queue.
static std::string const & stateToText(State const &state)
Convert enum to string.
void removeListener()
Deletes the current listener.
void enqueue(dhcp_ddns::NameChangeRequestPtr &ncr)
Adds a request to the end of the queue.
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.
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.
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.
std::deque< dhcp_ddns::NameChangeRequestPtr > RequestQueue
Defines a queue of requests.
boost::shared_ptr< D2QueueMgr > D2QueueMgrPtr
Defines a pointer for manager instances.
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 ...