|
INET Framework for OMNeT++/OMNEST
|
This class provides functionality for reordering out of order data chunks for reliable connection oriented protocols. More...
#include <ReorderBuffer.h>
Public Member Functions | |
| ReorderBuffer (b expectedOffset=b(-1)) | |
| ReorderBuffer (const ReorderBuffer &other) | |
| b | getExpectedOffset () const |
| Returns the offset of the next expected data chunk. More... | |
| void | setExpectedOffset (b expectedOffset) |
| Changes the offset of the next expected data chunk. More... | |
| b | getAvailableDataLength () const |
| Returns the length of the largest next available data chunk starting at the expected offset. More... | |
| const Ptr< const Chunk > | popAvailableData (b length=b(-1)) |
| Returns the largest next available data chunk starting at the expected offset. More... | |
Public Member Functions inherited from inet::ChunkBuffer | |
| ChunkBuffer (const char *name=nullptr) | |
| ChunkBuffer (const ChunkBuffer &other) | |
| virtual ChunkBuffer * | dup () const override |
| bool | isEmpty () const |
| Returns true if the buffer is completely empty. More... | |
| int | getNumRegions () const |
| Returns the number non-overlapping, non-connecting but continuous regions. More... | |
| b | getRegionLength (int index) const |
| Returns the length of the given region. More... | |
| b | getRegionStartOffset (int index) const |
| Returns the start offset of the given region. More... | |
| b | getRegionEndOffset (int index) const |
| Returns the end offset of the given region. More... | |
| const Ptr< const Chunk > & | getRegionData (int index) const |
| Returns the data of the given region in its current representation. More... | |
| void | replace (b offset, const Ptr< const Chunk > &chunk) |
| Replaces the stored data at the provided offset with the data in the chunk. More... | |
| void | clear (b offset, b length) |
| Erases the stored data at the provided offset and length. More... | |
| void | clear () |
| Erases all of the stored data. More... | |
| virtual std::string | str () const override |
| Returns a human readable string representation. More... | |
Protected Attributes | |
| b | expectedOffset |
| The offset of the next expected data chunk. More... | |
Protected Attributes inherited from inet::ChunkBuffer | |
| std::vector< Region > | regions |
| The list of non-overlapping, non-connecting but continuous regions. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from inet::ChunkBuffer | |
| Region * | getRegion (int i) const |
| void | eraseEmptyRegions (std::vector< Region >::iterator begin, std::vector< Region >::iterator end) |
| void | sliceRegions (Region &newRegion) |
| void | mergeRegions (Region &previousRegion, Region &nextRegion) |
This class provides functionality for reordering out of order data chunks for reliable connection oriented protocols.
The reordering algorithm takes the expected offset of the next data chunk. It provides reordered data as a continuous data chunk at the expected offset as soon as it becomes available.
|
inline |
| b inet::ReorderBuffer::getAvailableDataLength | ( | ) | const |
Returns the length of the largest next available data chunk starting at the expected offset.
|
inline |
Returns the offset of the next expected data chunk.
Referenced by inet::tcp::TcpReceiveQueue::extractBytesUpTo(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), and inet::tcp::TcpReceiveQueue::seqToOffset().
Returns the largest next available data chunk starting at the expected offset.
The returned data chunk is automatically removed from the buffer. If there's no available data at the expected offset, then it returns a nullptr and the buffer is not modified.
Referenced by inet::tcp::TcpReceiveQueue::extractBytesUpTo().
|
inline |
Changes the offset of the next expected data chunk.
Referenced by inet::tcp::TcpReceiveQueue::init().
|
protected |
The offset of the next expected data chunk.
Referenced by getAvailableDataLength(), and popAvailableData().