public:
struct mbuf * dequeue();
Remove a single packet from the head of the queue.
Result: The dequeued packet. A NULL is returned if the queue is empty.public:
struct mbuf * dequeueAll();
Removes all packets from the queue and return the head of the packet chain.
Result: The head of the dequeued packet chain.public:
UInt32 enqueue(struct mbuf * m);
Add a packet (or a packet chain) to the tail of the queue.
Result: The number of packets dropped due to over-capacity.
Name Description m A single packet, or a packet chain, to be added to the tail of the queue.
public:
UInt32 flush();
Removes all packets from the queue and put them back to the free buffer pool. The size of the queue becomes zero after the call.
Result: The number of packets freed.private:
virtual void free();
Frees the IOPacketQueue instance. All packets in the queue are released back to the free buffer pool.
public:
static UInt32 freePacketChain(struct mbuf * m);
This method frees a mbuf chain linked through the mbuf's nextpkt pointers.
Result: The number of mbufs freed.
Name Description m The mbuf at the start of the mbuf chain.
public:
UInt32 getCapacity() const;
Get the capacity of the queue.
Result: The current queue capacity.public:
UInt32 getPeakSize(bool reset = false);
The queue contains a counter that registers the peak size of the queue. This method returns the value in the counter, and optionally resets the counter to zero.
Result: The peak size count.
Name Description reset Reset the peak size counter to zero if true.
public:
UInt32 getSize() const;
Get the size of the queue.
Result: The number of packets currently held in the queue.public:
virtual bool initWithCapacity(UInt32 capacity = IOPQDefaultCapacity);
Initialize an IOPacketQueue instance.
Result: true if initialized successfully, false otherwise.
Name Description capacity The initial capacity of the queue.
public:
struct mbuf * lockDequeue();
Same as dequeue(). A spinlock lock is held while the queue is being accessed.
Result: See dequeue().public:
struct mbuf * lockDequeueAll();
Same as dequeueAll(). A spinlock lock is held while the queue is being accessed.
Result: See dequeueAll().public:
UInt32 lockEnqueue(struct mbuf * m);
Same as enqueue(). A spinlock lock is held while the queue is being accessed.
Result: See enqueue().
Name Description See enqueue().
public:
UInt32 lockFlush();
Same as flush(). A spinlock lock is held while the queue is being accessed.
Result: See flush().public:
void lockPrepend(struct mbuf * m);
Same as prepend(). A spinlock lock is held while the queue is being accessed.
Name Description See prepend().
public:
const struct mbuf * peek() const;
Peek at the head of the queue without dequeueing the packet. Subsequent calls to peek() or dequeue() will return the same packet. The caller must not modify the packet.
Result: The packet at the head of the queue.public:
void prepend(struct mbuf * m);
Add a packet (or a packet chain) to the head of the queue. Unlike enqueue(), the capacity is not checked, and the input packet is never dropped.
Name Description m A single packet, or packet chain, to be added to the head of the queue.
public:
bool setCapacity(UInt32 capacity);
Adjust the capacity of the queue. If the capacity is set to a value that is smaller than its current size, then the queue will drop incoming packets, but existing packets in the queue will remain intact.
Result: true if the new capacity was accepted, false otherwise.
Name Description capacity The new capacity.
public:
static IOPacketQueue * withCapacity(UInt32 capacity = IOPQDefaultCapacity);
Factory method that will construct and initialize an IOPacketQueue instance.
Result: An IOPacketQueue instance upon success, or 0 otherwise.
Name Description capacity The initial capacity of the queue.
private:static const UInt32 IOPQDefaultCapacity = 100;
Specifies the default capacity of the queue (number of packets that the queue can hold). Once the size of the queue grows to its capacity, the queue will begin to drop incoming packets. This capacity can be overridden by specifying the desired capacity when the queue is initialized, or the setCapacity() method can be called to adjust the queue's capacity.
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)