Kea 2.7.6
|
Packet Queue Managers (PQM). More...
#include <packet_queue_mgr.h>
Public Types | |
typedef std::function< PacketQueueTypePtr(data::ConstElementPtr)> | Factory |
Defines the type of the packet queue factory function. | |
Public Member Functions | |
PacketQueueMgr () | |
Constructor. | |
void | createPacketQueue (data::ConstElementPtr parameters) |
Create an instance of a packet queue. | |
void | destroyPacketQueue () |
Destroys the current packet queue. | |
PacketQueueTypePtr | getPacketQueue () const |
Returns underlying packet queue. | |
bool | registerPacketQueueFactory (const std::string &queue_type, Factory factory) |
Registers new queue factory function for a given queue type. | |
bool | unregisterPacketQueueFactory (const std::string &queue_type) |
Unregisters the queue factory function for a given type. | |
Protected Attributes | |
std::map< std::string, Factory > | factories_ |
A map holding registered backend factory functions. | |
PacketQueueTypePtr | packet_queue_ |
the current queue_ ? | |
Packet Queue Managers (PQM).
Base class to manage the registry of packet queue implementations and the creation of and access to the current packet queue.
PacktQueueTypePtr | Base type of packet queues managed by the manager (e.g. PacketQueue4Ptr, PacketQueue6Ptr). |
Definition at line 39 of file packet_queue_mgr.h.
std::function<PacketQueueTypePtr(data::ConstElementPtr)> isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::Factory |
Defines the type of the packet queue factory function.
Factory function returns a pointer to the instance of the packet queue created.
Definition at line 45 of file packet_queue_mgr.h.
|
inline |
Constructor.
Definition at line 48 of file packet_queue_mgr.h.
|
inline |
Create an instance of a packet queue.
Replace the current packet queue with a new one based on the given configuration parameters. The set of parameters must contain at least "queue-type". This value is used to locate the registered queue factory to invoke to create the new queue.
The factory is passed the parameters verbatim for its use in creating the new queue. Factories are expected to throw exceptions on creation failure. Note the existing queue is not altered or replaced unless the new queue is successfully created.
InvalidQueueParameter | if parameters is not map that contains "queue-type", InvalidQueueType if the queue type requested is not supported. |
Unexpected | if the backend factory function returned NULL. |
Definition at line 133 of file packet_queue_mgr.h.
References isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::factories_, isc::data::SimpleParser::getString(), isc_throw, and isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::packet_queue_.
|
inline |
Destroys the current packet queue.
Any queued packets will be discarded.
Definition at line 174 of file packet_queue_mgr.h.
References isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::packet_queue_.
|
inline |
Returns underlying packet queue.
Definition at line 168 of file packet_queue_mgr.h.
References isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::packet_queue_.
|
inline |
Registers new queue factory function for a given queue type.
The typical usage of this function is to make the PQM aware of a packet queue implementation. This implementation may exist in a hooks library. In such a case, this function should be called from the load
function in this library. When the queue impl is registered, the server will use it when required by the configuration, i.e. a user specifies it in "queue-control:queue-type"
If the given queue type has already been registered, perhaps by another hooks library, the PQM will refuse to register another of the same type.
queue_type | Queue type, e.g. "kea-ring4" |
factory | Pointer to the queue factory function. |
Definition at line 70 of file packet_queue_mgr.h.
References isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::factories_.
|
inline |
Unregisters the queue factory function for a given type.
This function is used to remove the factory function for a given type. Typically, it would be called when unloading the hook library which loaded the type, and thus called by the library's unload
function. In addition to removing the factory, it will also destroy the current queue if it is of the same queue-type as the factory being removed. This avoids the nastiness that occurs when objecs are left in existence after their library is unloaded.
queue_type | queue type, e.g. "kea-ring4". |
Definition at line 96 of file packet_queue_mgr.h.
References isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::factories_, and isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::packet_queue_.
|
protected |
A map holding registered backend factory functions.
Definition at line 180 of file packet_queue_mgr.h.
Referenced by isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::createPacketQueue(), isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::registerPacketQueueFactory(), and isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::unregisterPacketQueueFactory().
|
protected |
the current queue_ ?
Definition at line 183 of file packet_queue_mgr.h.
Referenced by isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::createPacketQueue(), isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::destroyPacketQueue(), isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::getPacketQueue(), and isc::dhcp::PacketQueueMgr< PacketQueueTypePtr >::unregisterPacketQueueFactory().