![]() |
Kea 2.7.3
|
Interface for managing a queue of inbound DHCP packets. More...
#include <packet_queue.h>
Public Member Functions | |
PacketQueue (const std::string &queue_type) | |
Constructor. | |
virtual | ~PacketQueue () |
Virtual destructor. | |
virtual void | clear ()=0 |
Discards all packets currently in the buffer. | |
virtual PacketTypePtr | dequeuePacket ()=0 |
Dequeues the next packet from the queue. | |
virtual bool | empty () const =0 |
return True if the queue is empty. | |
virtual void | enqueuePacket (PacketTypePtr packet, const SocketInfo &source)=0 |
Adds a packet to the queue. | |
virtual data::ElementPtr | getInfo () const |
Fetches operational information about the current state of the queue. | |
std::string | getInfoStr () const |
Fetches a JSON string representation of queue operational info. | |
std::string | getQueueType () |
virtual size_t | getSize () const =0 |
Returns the current number of packets in the buffer. | |
Interface for managing a queue of inbound DHCP packets.
This class serves as the abstract interface for packet queue implementations which may be used by IfaceMgr
to store inbound packets until they are a dequeued for processing.
PacketTypePtr | Type of packet the queue contains. This expected to be either isc::dhcp::Pkt4Ptr or isc::dhcp::Pkt6Ptr |
Definition at line 47 of file packet_queue.h.
|
inlineexplicit |
Constructor.
queue_type | logical name of the queue implementation Typically this is assigned by the factory that creates the queue. It is the logical name used to register queue implementations. |
Definition at line 56 of file packet_queue.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 60 of file packet_queue.h.
|
pure virtual |
Discards all packets currently in the buffer.
Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.
|
pure virtual |
Dequeues the next packet from the queue.
Dequeues the next packet (if any) and returns it. Derivations determine how packets are dequeued.
Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.
|
pure virtual |
return True if the queue is empty.
Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.
|
pure virtual |
Adds a packet to the queue.
Adds the packet to the queue. Derivations determine which packets to queue and how to queue them.
packet | packet to enqueue |
source | socket the packet came from |
Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >.
|
inlinevirtual |
Fetches operational information about the current state of the queue.
Creates and returns an ElementPtr containing a single entry, "queue-type". Derivations are expected to call this method first and then add their own values. Since implementations may vary widely on data of interest, this is structured as an ElementPtr for broad latitude.
Reimplemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.
Definition at line 99 of file packet_queue.h.
References isc::data::Element::create(), isc::data::Element::createMap(), and isc::db::info.
Referenced by isc::dhcp::PacketQueueRing< PacketTypePtr >::getInfo(), and isc::dhcp::PacketQueue< PacketTypePtr >::getInfoStr().
|
inline |
Fetches a JSON string representation of queue operational info.
This method calls getInfo()
and then converts that into JSON text.
Definition at line 110 of file packet_queue.h.
References isc::dhcp::PacketQueue< PacketTypePtr >::getInfo(), and isc::db::info.
|
inline |
Definition at line 118 of file packet_queue.h.
|
pure virtual |
Returns the current number of packets in the buffer.
Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.