ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference
|
IOPacketQueue |
Inherits from: | |
Declared In: |
Implements a bounded FIFO queue of mbuf packets.
Packets are removed from the head of the queue (dequeue), and new packets are added to the tail of the queue (enqueue). A spinlock is used to synchronize access to the queue between methods that have a "lock" prefix.
Removes a single packet from the head of the queue.
Removes all packets from the queue and returns the head of the packet chain.
Removes all packets from the specified queue, and adds them to the tail of this queue.
Adds a chain of packets to the tail of the queue.
Adds a chain of packets to the tail of the queue.
Frees all packets currently held in the queue and releases them back to the free mbuf pool.
Frees the IOPacketQueue object.
Gets the current capacity of the queue.
Gets the size of the queue.
Initializes an IOPacketQueue object.
Removes a single packet from the head of a synchronized queue.
Removes all packets from a synchronized queue and returns the head of the packet chain.
Adds a chain of packets to the tail of a synchronized queue.
Adds a chain of packets to the tail of a synchronized queue.
Frees all packets currently held in a synchronized queue and releases them back to the free mbuf pool.
Adds a chain of packets to the head of a synchronized queue.
Examines the packet at the head of the queue without removing it from the queue.
Removes all packets from the specified queue, and adds them to the head of this queue.
Adds a chain of packets to the head of the queue.
Changes the capacity of the queue.
Factory method that constructs and initializes an IOPacketQueue object.
dequeue |
Removes a single packet from the head of the queue.
public
virtual mbuf_t dequeue();
Returns a packet removed from the head of the queue, or NULL if the queue was empty.
dequeueAll |
Removes all packets from the queue and returns the head of the packet chain.
public
virtual mbuf_t dequeueAll();
Returns the head of a packet chain linking all packets that were held in the queue, or NULL if the queue was empty.
The size of the queue is cleared to zero.
enqueue(IOPacketQueue *) |
Removes all packets from the specified queue, and adds them to the tail of this queue.
public
virtual bool enqueue( IOPacketQueue *queue);
queue
The source IOPacketQueue object containing the packets to be transferred.
Always returns true.
enqueue(mbuf_t) |
Adds a chain of packets to the tail of the queue.
public
virtual bool enqueue( mbuf_t m);
m
A chain of packets to add to the tail of the queue.
Returns true on success, or false to indicate over-capacity and refusal to accept the packet chain provided.
Packets are not added if the size of the queue has reached its capacity.
enqueueWithDrop |
Adds a chain of packets to the tail of the queue.
public
virtual UInt32 enqueueWithDrop( mbuf_t m);
m
A chain of packets to add to the tail of the queue.
Returns the number of packets dropped and freed by the queue.
Packets are dropped if the size of the queue has reached its capacity.
flush |
Frees all packets currently held in the queue and releases them back to the free mbuf pool.
public
virtual UInt32 flush();
Returns the number of packets freed.
The size of the queue is cleared to zero.
free |
Frees the IOPacketQueue object.
protected
virtual void free();
All packets held by the queue are released back to the free pool, resource are deallocated, then super::free() is called.
getCapacity |
Gets the current capacity of the queue.
public
virtual UInt32 getCapacity() const;
Returns the current queue capacity.
getSize |
Gets the size of the queue.
public
virtual UInt32 getSize() const;
Returns the number of packets currently held by the queue.
initWithCapacity |
Initializes an IOPacketQueue object.
public
virtual bool initWithCapacity( UInt32 capacity = IOPacketQueueDefaultCapacity);
capacity
The initial capacity of the queue. Can be later changed by calling the setCapacity() method.
Returns true if initialized successfully, false otherwise.
This method initializes an IOPacketQueue object with the given capacity.
lockDequeue |
Removes a single packet from the head of a synchronized queue.
public
virtual mbuf_t lockDequeue();
Returns a packet removed from the head of the queue, or NULL if the queue was empty.
A spinlock is used to synchronize access to the queue.
lockDequeueAll |
Removes all packets from a synchronized queue and returns the head of the packet chain.
public
virtual mbuf_t lockDequeueAll();
Returns the head of a packet chain linking all packets that were held in the queue, or NULL if the queue was empty.
The size of the queue is cleared to zero. A spinlock is used to synchronize access to the queue.
lockEnqueue |
Adds a chain of packets to the tail of a synchronized queue.
public
virtual bool lockEnqueue( mbuf_t m);
m
A chain of packets to add to the tail of the queue.
Returns true on success, or false to indicate over-capacity and refusal to accept the packet chain provided.
Packets are not added if the size of the queue has reached its capacity. A spinlock is used to synchronize access to the queue.
lockEnqueueWithDrop |
Adds a chain of packets to the tail of a synchronized queue.
public
virtual UInt32 lockEnqueueWithDrop( mbuf_t m);
m
A chain of packets to add to the tail of the queue.
Returns the number of packets dropped and freed by the queue.
Packets are dropped if the size of the queue has reached its capacity. A spinlock is used to synchronize access to the queue.
lockFlush |
Frees all packets currently held in a synchronized queue and releases them back to the free mbuf pool.
public
virtual UInt32 lockFlush();
Returns the number of packets freed.
The size of the queue is cleared to zero. A spinlock is used to synchronize access to the queue.
lockPrepend |
Adds a chain of packets to the head of a synchronized queue.
public
virtual void lockPrepend( mbuf_t m);
m
A chain of packets to add to the head of the queue.
Always returns true.
A spinlock is used to synchronize access to the queue.
peek |
Examines the packet at the head of the queue without removing it from the queue.
public
virtual const mbuf_t peek() const;
Returns the packet at the head of the queue.
A following call to peek() or dequeue() will return the same packet. The caller must never modify the mbuf packet returned.
prepend(IOPacketQueue *) |
Removes all packets from the specified queue, and adds them to the head of this queue.
public
virtual void prepend( IOPacketQueue *queue);
queue
The source IOPacketQueue object containing the packets to be transferred.
prepend(mbuf_t) |
Adds a chain of packets to the head of the queue.
public
virtual void prepend( mbuf_t m);
m
A chain of packets to add to the head of the queue.
setCapacity |
Changes the capacity of the queue.
public
virtual bool setCapacity( UInt32 capacity);
capacity
The new capacity.
Returns true if the new capacity was accepted, false otherwise.
withCapacity |
Factory method that constructs and initializes an IOPacketQueue object.
public
static IOPacketQueue * withCapacity( UInt32 capacity = IOPacketQueueDefaultCapacity);
capacity
The initial capacity of the queue object. Can be later changed by calling the setCapacity() method.
Returns an IOPacketQueue instance on success, or 0 otherwise.
_reserved |
protected
ExpansionData *_reserved;
Reserved for future use. (Internal use only)
IOPacketQueueDefaultCapacity |
Describes the default capacity of the queue object.
protected
static const UInt32 IOPacketQueueDefaultCapacity = 100;
The capacity is only observed by the enqueue() method. Therefore, it is possible for the size of the queue to exceed its capacity when other methods, such as prepend(), are used to add packets to the queue.
reserved |
protected
ExpansionData *_reserved;
Reserved for future use. (Internal use only)
|
Last Updated: 2008-12-19