Kea 2.7.6
isc::dhcp::PacketQueue< PacketTypePtr > Class Template Referenceabstract

Interface for managing a queue of inbound DHCP packets. More...

#include <packet_queue.h>

+ Inheritance diagram for isc::dhcp::PacketQueue< PacketTypePtr >:

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.
 

Detailed Description

template<typename PacketTypePtr>
class isc::dhcp::PacketQueue< PacketTypePtr >

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.

Template Parameters
PacketTypePtrType of packet the queue contains. This expected to be either isc::dhcp::Pkt4Ptr or isc::dhcp::Pkt6Ptr
Note
Derivations of this class MUST BE thread-safe.

Definition at line 47 of file packet_queue.h.

Constructor & Destructor Documentation

◆ PacketQueue()

template<typename PacketTypePtr >
isc::dhcp::PacketQueue< PacketTypePtr >::PacketQueue ( const std::string & queue_type)
inlineexplicit

Constructor.

Parameters
queue_typelogical 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.

◆ ~PacketQueue()

template<typename PacketTypePtr >
virtual isc::dhcp::PacketQueue< PacketTypePtr >::~PacketQueue ( )
inlinevirtual

Virtual destructor.

Definition at line 60 of file packet_queue.h.

Member Function Documentation

◆ clear()

template<typename PacketTypePtr >
virtual void isc::dhcp::PacketQueue< PacketTypePtr >::clear ( )
pure virtual

◆ dequeuePacket()

template<typename PacketTypePtr >
virtual PacketTypePtr isc::dhcp::PacketQueue< PacketTypePtr >::dequeuePacket ( )
pure virtual

Dequeues the next packet from the queue.

Dequeues the next packet (if any) and returns it. Derivations determine how packets are dequeued.

Returns
A pointer to dequeued packet, or an empty pointer if the queue is empty.

Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.

◆ empty()

template<typename PacketTypePtr >
virtual bool isc::dhcp::PacketQueue< PacketTypePtr >::empty ( ) const
pure virtual

◆ enqueuePacket()

template<typename PacketTypePtr >
virtual void isc::dhcp::PacketQueue< PacketTypePtr >::enqueuePacket ( PacketTypePtr packet,
const SocketInfo & source )
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.

Parameters
packetpacket to enqueue
sourcesocket the packet came from

Implemented in isc::dhcp::PacketQueueRing< PacketTypePtr >, isc::dhcp::PacketQueueRing< Pkt4Ptr >, and isc::dhcp::PacketQueueRing< Pkt6Ptr >.

◆ getInfo()

template<typename PacketTypePtr >
virtual data::ElementPtr isc::dhcp::PacketQueue< PacketTypePtr >::getInfo ( ) const
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.

Returns
an ElementPtr containing elements for values of interest

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().

+ Here is the call graph for this function:

◆ getInfoStr()

template<typename PacketTypePtr >
std::string isc::dhcp::PacketQueue< PacketTypePtr >::getInfoStr ( ) const
inline

Fetches a JSON string representation of queue operational info.

This method calls getInfo() and then converts that into JSON text.

Returns
string of JSON text

Definition at line 110 of file packet_queue.h.

References isc::dhcp::PacketQueue< PacketTypePtr >::getInfo(), and isc::db::info.

+ Here is the call graph for this function:

◆ getQueueType()

template<typename PacketTypePtr >
std::string isc::dhcp::PacketQueue< PacketTypePtr >::getQueueType ( )
inline
Returns
Fetches the logical name of the type of this queue.

Definition at line 118 of file packet_queue.h.

◆ getSize()

template<typename PacketTypePtr >
virtual size_t isc::dhcp::PacketQueue< PacketTypePtr >::getSize ( ) const
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 >.


The documentation for this class was generated from the following file: