|
Click
|
#include <packetbatch.hh>
Public Member Functions | |
| Packet * | first () |
| void | set_tail (Packet *p) |
| Packet * | tail () |
| void | append_simple_list (Packet *lhead, Packet *ltail, int lcount) |
| void | append_batch (PacketBatch *head) |
| void | append_packet (Packet *p) |
| unsigned | count () |
| PacketBatch * | make_tail (Packet *last, unsigned int count) |
| Finish a batch started with start_head() | |
| void | set_count (unsigned int c) |
| void | cut (Packet *middle, int first_batch_count, PacketBatch *&second) |
| Cut a batch in two batches. | |
| void | split (int first_batch_count, PacketBatch *&second, const bool &safe=false) |
| Cut a batch in two batches. | |
| PacketBatch * | split (int first_batch_count) |
| PacketBatch * | pop_front () |
| Packet * | begin () |
| Packet * | end () |
| void | kill () |
| PacketBatch * | clone_batch (const bool duplicate=false, const bool duplicate_data_only=false) |
| void | fast_kill () |
| void | fast_kill_nonatomic () |
Static Public Member Functions | |
| static PacketBatch * | start_head (Packet *p) |
| Start a new batch. | |
| static PacketBatch * | make_from_tailed_list (Packet *head, unsigned int size) |
| static PacketBatch * | make_from_simple_list (Packet *head, Packet *tail, unsigned int size) |
| static PacketBatch * | make_from_simple_list (Packet *head) |
| static PacketBatch * | make_from_packet (Packet *p) |
Batch of Packet. This class has no field member and can be cast to or from Packet. It is only there as a way to remember what we are handling and provide useful functions for managing packets as a batch.
Internally, the head contains all the information usefull for the batch. The prev annotation points to the tail, the next to the next packet. It is implemented by a simply linked list. The BATCH_COUNT annotation is set on the first packet of the batch to remember the number of packets in the batch.
Batches must not mix cloned and unique packets. Use cut to split batches and have part of them cloned.
|
inline |
Return the number of packets in this batch
|
inlinestatic |
Start a new batch.
| p | A packet |
Creates a new batch, with p as the first packet. Batch is NOT valid until you call make_tail(). If the Packet is null, returns no batch.
|
inline |
Finish a batch started with start_head()
| last | The last packet of the batch |
| count | The number of packets in the batch |
This will set up the batch with the last packet. set_next() have to be called for each packet from the head to the last packet !
|
inline |
Set the number of packets in this batch
|
inline |
Cut a batch in two batches.
| middle | The last packet of the first batch |
| first_batch_count | The number of packets in the first batch |
| second | Reference to set the head of the second batch |
|
inline |
Cut a batch in two batches.
| first_batch_count | The number of packets in the first batch |
| second | Reference to set the head of the second batch |
| safe | Set to true for optimization if you're sure there is enough packets to cut, and first_batch_count is not 0 |
|
inline |
Remove the first packet
|
inlinestatic |
Build a batch from a linked list of packet for which head->prev is the tail and tail->next is already 0
| head | The first packet of the batch |
| size | Number of packets in the linkedlist |
|
inlinestatic |
Build a batch from a linked list of packet
| head | The first packet of the batch |
| tail | The last packet of the batch |
| size | Number of packets in the linkedlist |
|
inlinestatic |
Build a batch from a linked list of packet ending by a next==0 pointer. O(n).
| head | The first packet of the batch |
|
inlinestatic |
Make a batch composed of a single packet
|
inline |
Return the first packet of this batch
|
inline |
Return the last packet of this batch
|
inline |
Kill all packets in the batch
Recycle a whole batch
|
inline |
Clone the batch