The queue is of fixed size and does FIFO. When the queue becomes full the eldest packet behind the head is dropped, ie since the head may be in transit.
typedef list<const RipPacket<A>*> QueueRep | QueueRep |
PacketQueue ()
| PacketQueue |
~PacketQueue ()
| ~PacketQueue |
void enqueue_packet (const RipPacket<A>* pkt)
| enqueue_packet |
Place packet in ready to sent queue. The supplied packet is expected to have been allocated with the standard new operator and will be destructed by the packet queue when it is dropped or popped from the queue.
This may cause older packets in the queue to be dropped to make sufficient space for new packet.
bool empty ()
| empty |
[const]
Returns: true if no packets are queued, false otherwise.
const RipPacket<A>* head ()
| head |
[const]
Peek at head packet if it exists.
Returns: pointer to head packet if it exists, 0 otherwise.
void pop_head ()
| pop_head |
bool drop_old ()
| drop_old |
Discard packet behind head packet to make space for new packets.
Returns: true if an old packet was dropped, false if no packets dropped.
void flush_packets ()
| flush_packets |
void set_max_buffered_bytes (uint32_t mb)
| set_max_buffered_bytes |
Set the maximum amount of data to buffer.
uint32_t max_buffered_bytes ()
| max_buffered_bytes |
[const]
Get the maximum amount of buffered data.
uint32_t buffered_bytes ()
| buffered_bytes |
[const]
Get the current amount of buffered data.
uint32_t drop_count ()
| drop_count |
[const]
Get the number of packets dropped from queue.
void reset_drop_count ()
| reset_drop_count |
QueueRep _ready_packets | _ready_packets |
[protected]
uint32_t _buffered_bytes | _buffered_bytes |
[protected]
uint32_t _max_buffered_bytes | _max_buffered_bytes |
[protected]
uint32_t _drops | _drops |
[protected]