BufArray< Packet > Class Template Reference

Wrapper around MoonGen bufarrays. More...

#include <bufArray.hpp>

Classes

class  iterator
 

Public Member Functions

 BufArray (Packet **pkts, uint32_t numPkts, bool fromLua=false)
 Constructor. More...
 
 ~BufArray ()
 
void markDropPkt (uint32_t pktIdx)
 Mark one packet as drop. More...
 
void markDropPkt (Packet *pkt)
 Mark one packet as drop. More...
 
void markSendPkt (uint32_t pktIdx)
 Mark one packet as send. More...
 
void addPkt (Packet *pkt)
 Add one packet to the BufArray. More...
 
uint32_t getSendCount () const
 Get the number of packets currently marked as send. More...
 
uint32_t getFreeCount () const
 Get the number of packets currently marked as free. More...
 
void getSendBufs (Packet **sendBufs) const
 Get all the packets which are to be sent. More...
 
void getFreeBufs (Packet **freeBufs) const
 Get all the packets which are to be freed. More...
 
uint32_t getTotalCount () const
 Get the number of all packets in the BufArray. More...
 
Packet * operator[] (unsigned int idx) const
 
iterator begin ()
 
iterator end ()
 

Detailed Description

template<typename Packet>
class BufArray< Packet >

Wrapper around MoonGen bufarrays.

BufArrays bundle an array of pointers to packets together with their count

Wrapper around MoonGen bufarrays

BufArrays bundle an array of pointers to packets together with their count. It also tracks, which buffers should be send out or freed. This array grows if needed.

Definition at line 42 of file bufArray.hpp.

Constructor & Destructor Documentation

◆ BufArray()

template<typename Packet>
BufArray< Packet >::BufArray ( Packet **  pkts,
uint32_t  numPkts,
bool  fromLua = false 
)
inline

Constructor.

Parameters
pktsPointer to pointers to buffers
numPktsNumber of buffers in pkts
fromLuaSet to true, if pkts is garbage-collected

Definition at line 57 of file bufArray.hpp.

◆ ~BufArray()

template<typename Packet>
BufArray< Packet >::~BufArray ( )
inline

Definition at line 77 of file bufArray.hpp.

Member Function Documentation

◆ addPkt()

template<typename Packet>
void BufArray< Packet >::addPkt ( Packet *  pkt)
inline

Add one packet to the BufArray.

This function may allocate new memory, to fit all packets into one array

Parameters
pktPacke to add

Definition at line 120 of file bufArray.hpp.

◆ begin()

template<typename Packet>
iterator BufArray< Packet >::begin ( )
inline

Definition at line 241 of file bufArray.hpp.

◆ end()

template<typename Packet>
iterator BufArray< Packet >::end ( )
inline

Definition at line 242 of file bufArray.hpp.

◆ getFreeBufs()

template<typename Packet>
void BufArray< Packet >::getFreeBufs ( Packet **  freeBufs) const
inline

Get all the packets which are to be freed.

Parameters
freeBufsArray at least the size returned by getFreeCount()

Definition at line 193 of file bufArray.hpp.

Here is the call graph for this function:

◆ getFreeCount()

template<typename Packet>
uint32_t BufArray< Packet >::getFreeCount ( ) const
inline

Get the number of packets currently marked as free.

Returns
Number of packets to be freed

Definition at line 166 of file bufArray.hpp.

Here is the call graph for this function:

◆ getSendBufs()

template<typename Packet>
void BufArray< Packet >::getSendBufs ( Packet **  sendBufs) const
inline

Get all the packets which are to be sent.

Parameters
sendBufsArray at least the size returned by getSendCount()

Definition at line 175 of file bufArray.hpp.

Here is the call graph for this function:

◆ getSendCount()

template<typename Packet>
uint32_t BufArray< Packet >::getSendCount ( ) const
inline

Get the number of packets currently marked as send.

Returns
Number of packets to be sent

Definition at line 151 of file bufArray.hpp.

◆ getTotalCount()

template<typename Packet>
uint32_t BufArray< Packet >::getTotalCount ( ) const
inline

Get the number of all packets in the BufArray.

Returns
Number of all packets

Definition at line 211 of file bufArray.hpp.

◆ markDropPkt() [1/2]

template<typename Packet>
void BufArray< Packet >::markDropPkt ( uint32_t  pktIdx)
inline

Mark one packet as drop.

Parameters
pktIdxIndex of the packet to drop

Definition at line 87 of file bufArray.hpp.

◆ markDropPkt() [2/2]

template<typename Packet>
void BufArray< Packet >::markDropPkt ( Packet *  pkt)
inline

Mark one packet as drop.

Parameters
pktPointer to the packet to drop

Definition at line 96 of file bufArray.hpp.

◆ markSendPkt()

template<typename Packet>
void BufArray< Packet >::markSendPkt ( uint32_t  pktIdx)
inline

Mark one packet as send.

Parameters
pktIdxIndex of the packet to send

Definition at line 109 of file bufArray.hpp.

◆ operator[]()

template<typename Packet>
Packet* BufArray< Packet >::operator[] ( unsigned int  idx) const
inline

Definition at line 213 of file bufArray.hpp.


The documentation for this class was generated from the following file: