7 #ifndef PACKET_QUEUE_RING_H 8 #define PACKET_QUEUE_RING_H 13 #include <boost/function.hpp> 14 #include <boost/circular_buffer.hpp> 25 template<
typename PacketTypePtr>
38 queue_.set_capacity(capacity);
110 queue_.push_back(packet);
112 queue_.push_front(packet);
127 PacketTypePtr packet;
128 if (queue_.empty()) {
133 packet = queue_.front();
136 packet = queue_.back();
154 PacketTypePtr packet;
155 if (!queue_.empty()) {
164 return(queue_.empty());
169 return (queue_.capacity());
181 <<
" is invalid. It must be at least " 186 queue_.set_capacity(capacity);
191 return (queue_.size());
210 boost::circular_buffer<PacketTypePtr> queue_;
260 #endif // PACKET_QUEUE_RING_H
virtual const PacketTypePtr peek(const QueueEnd &from=QueueEnd::FRONT) const
Gets the packet currently at one end of the queue.
virtual data::ElementPtr getInfo() const
Fetches operational information about the current state of the queue.
Interface for managing a queue of inbound DHCP packets.
boost::shared_ptr< Element > ElementPtr
virtual void setCapacity(size_t capacity)
Sets the maximum number of packets allowed in the buffer.
virtual size_t getCapacity() const
Returns the maximum number of packets allowed in the buffer.
QueueEnd
Enumerates choices between the two ends of the queue.
This holds a lock on a Mutex.
Provides a ring-buffer implementation of the PacketQueue interface.
virtual PacketTypePtr popPacket(const QueueEnd &from=QueueEnd::FRONT)
Pops a packet from the queue.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual bool shouldDropPacket(PacketTypePtr, const SocketInfo &)
Determines if a packet should be discarded.
virtual int eatPackets(const QueueEnd &)
Discards packets from one end of the queue.
DHCPv4 packet queue buffer implementation.
virtual void clear()
Discards all packets currently in the buffer.
virtual PacketTypePtr dequeuePacket()
Dequeues the next packet from the queue.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual data::ElementPtr getInfo() const
Fetches pertinent information.
Mutex with very simple interface.
virtual void pushPacket(PacketTypePtr &packet, const QueueEnd &to=QueueEnd::BACK)
Pushes a packet onto the queue.
static ElementPtr create(const Position &pos=ZERO_POSITION())
PacketQueueRing(const std::string &queue_type, size_t capacity)
Constructor.
PacketQueueRing6(const std::string &queue_type, size_t capacity)
Constructor.
virtual void enqueuePacket(PacketTypePtr packet, const SocketInfo &source)
Adds a packet to the queue.
virtual ~PacketQueueRing()
virtual Destructor
static const size_t MIN_RING_CAPACITY
Minimum queue capacity permitted.
DHCPv6 packet queue buffer implementation.
virtual ~PacketQueueRing4()
virtual Destructor
virtual ~PacketQueueRing6()
virtual Destructor
Holds information about socket.
virtual size_t getSize() const
Returns the current number of packets in the buffer.
virtual bool empty() const
Returns True if the queue is empty.
PacketQueueRing4(const std::string &queue_type, size_t capacity)
Constructor.