xorp

PacketQueue< A > Class Template Reference

Outbound packet queue. More...

#include <packet_queue.hh>

List of all members.

Public Types

typedef list< const RipPacket
< A > * > 
QueueRep

Public Member Functions

void enqueue_packet (const RipPacket< A > *pkt)
 Place packet in ready to sent queue.
bool empty () const
const RipPacket< A > * head () const
 Peek at head packet if it exists.
void pop_head ()
 Remove head packet.
bool drop_old ()
 Discard packet behind head packet to make space for new packets.
void flush_packets ()
 Flush queued packets.
void set_max_buffered_bytes (uint32_t mb)
 Set the maximum amount of data to buffer.
uint32_t max_buffered_bytes () const
 Get the maximum amount of buffered data.
uint32_t buffered_bytes () const
 Get the current amount of buffered data.
uint32_t drop_count () const
 Get the number of packets dropped from queue.
void reset_drop_count ()
 Reset packet drop counter.

Protected Attributes

QueueRep _ready_packets
uint32_t _buffered_bytes
uint32_t _max_buffered_bytes
uint32_t _drops

Detailed Description

template<typename A>
class PacketQueue< A >

Outbound packet queue.

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.


Member Function Documentation

template<typename A >
bool PacketQueue< A >::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.
template<typename A >
bool PacketQueue< A >::empty ( ) const
Returns:
true if no packets are queued, false otherwise.
template<typename A >
void PacketQueue< A >::enqueue_packet ( const RipPacket< A > *  pkt)

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.

template<typename A >
const RipPacket< A > * PacketQueue< A >::head ( ) const

Peek at head packet if it exists.

Returns:
pointer to head packet if it exists, 0 otherwise.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations