Click
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ModificationList Class Reference

Class used to store the modifications performed in a packet's structure. More...

#include <modificationlist.hh>

Public Member Functions

 ModificationList (MemoryPool< struct ModificationNode > *poolNodes)
 Construct a ModificationList.
 
 ~ModificationList ()
 Destruct a ModificationList and free the memory.
 
void printList ()
 Print the current state of the list in the console using click_chatter.
 
bool addModification (uint32_t firstPosition, uint32_t position, int offset)
 Add a modification in the list.
 
bool isCommitted ()
 Indicate whether the list has been committed.
 
void commit (ByteStreamMaintainer &maintainer)
 Commit the modifications stored in the list into a ByteStreamMaintainer.
 

Detailed Description

Class used to store the modifications performed in a packet's structure.

This class is used to store the modifications made in the structure of a packet. It stores the positions at which bytes are inserted and removed so that they can be committed when the packet is in its final state. The modifications are committed to a ByteStreamMaintainer.

Constructor & Destructor Documentation

◆ ModificationList()

ModificationList::ModificationList ( MemoryPool< struct ModificationNode > *  poolNodes)

Construct a ModificationList.

Parameters
poolNodesA pointer to a MemoryPool for the nodes of type struct ModificationNode.

◆ ~ModificationList()

ModificationList::~ModificationList ( )

Destruct a ModificationList and free the memory.

Member Function Documentation

◆ printList()

void ModificationList::printList ( )

Print the current state of the list in the console using click_chatter.

◆ addModification()

bool ModificationList::addModification ( uint32_t  firstPosition,
uint32_t  position,
int  offset 
)

Add a modification in the list.

Parameters
firstPositionThe lowest position possible for this packet
positionThe position at which the modification occurs
offsetThe offset representing the modification (a positive number if bytes are added and a negative number if bytes are removed)
Returns
True if the modification has been taken into account and false if the list does not accept any new modification because a commit has been made.

◆ isCommitted()

bool ModificationList::isCommitted ( )

Indicate whether the list has been committed.

Returns
True if the list has been committed

◆ commit()

void ModificationList::commit ( ByteStreamMaintainer &  maintainer)

Commit the modifications stored in the list into a ByteStreamMaintainer.

Parameters
maintainerThe ByteStreamMaintainer in which the modifications will be committed

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