|
INET Framework for OMNeT++/OMNEST
|
This class provides basic functionality for merging large data chunks from out of order smaller data chunks. More...
#include <ChunkBuffer.h>
Classes | |
| class | Region |
Public Member Functions | |
Constructors, destructors and duplication related functions | |
| ChunkBuffer (const char *name=nullptr) | |
| ChunkBuffer (const ChunkBuffer &other) | |
| virtual ChunkBuffer * | dup () const override |
Content querying functions | |
| 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 Member Functions | |
| 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) |
Protected Attributes | |
| std::vector< Region > | regions |
| The list of non-overlapping, non-connecting but continuous regions. More... | |
Friends | |
| class | ChunkBufferDescriptor |
| class | ChunkBuffer__RegionDescriptor |
This class provides basic functionality for merging large data chunks from out of order smaller data chunks.
Internally, buffers stores the data in different kind of chunks. See the Chunk class and its subclasses for details. All chunks are immutable in a buffer. Chunks are automatically merged as they are replaced in the buffer, and they are also shared among buffers when duplicating.
In general, this class supports the following operations:
| inet::ChunkBuffer::ChunkBuffer | ( | const ChunkBuffer & | other | ) |
|
inline |
Erases the stored data at the provided offset and length.
Referenced by inet::tcp::TcpReceiveQueue::init().
|
inlineoverridevirtual |
|
protected |
|
inline |
Returns the number non-overlapping, non-connecting but continuous regions.
Referenced by inet::tcp::TcpReceiveQueue::getAmountOfBufferedBytes(), inet::tcp::TcpReceiveQueue::getFirstSeqNo(), inet::tcp::TcpReceiveQueue::getLE(), inet::tcp::TcpReceiveQueue::getQueueLength(), inet::tcp::TcpReceiveQueue::getQueueStatus(), inet::tcp::TcpReceiveQueue::getRE(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), and inet::tcp::TcpReceiveQueue::str().
|
inlineprotected |
|
inline |
Returns the data of the given region in its current representation.
|
inline |
Returns the end offset of the given region.
Referenced by inet::tcp::TcpReceiveQueue::getLE(), inet::tcp::TcpReceiveQueue::getRE(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), and inet::tcp::TcpReceiveQueue::str().
|
inline |
Returns the length of the given region.
Referenced by inet::tcp::TcpReceiveQueue::getAmountOfBufferedBytes(), and inet::tcp::TcpReceiveQueue::insertBytesFromSegment().
|
inline |
Returns the start offset of the given region.
Referenced by inet::tcp::TcpReceiveQueue::getFirstSeqNo(), inet::tcp::TcpReceiveQueue::getLE(), inet::tcp::TcpReceiveQueue::getRE(), inet::tcp::TcpReceiveQueue::insertBytesFromSegment(), and inet::tcp::TcpReceiveQueue::str().
|
inline |
Returns true if the buffer is completely empty.
Referenced by inet::tcp::TcpReceiveQueue::extractBytesUpTo(), and inet::tcp::TcpReceiveQueue::insertBytesFromSegment().
Referenced by replace().
Replaces the stored data at the provided offset with the data in the chunk.
Already existing data gets overwritten, and connecting data gets merged with the provided chunk.
Referenced by inet::Ipv4FragBuf::addFragment(), inet::Ipv6FragBuf::addFragment(), and inet::tcp::TcpReceiveQueue::insertBytesFromSegment().
|
protected |
|
overridevirtual |
|
friend |
|
friend |
|
protected |
The list of non-overlapping, non-connecting but continuous regions.
Referenced by clear(), eraseEmptyRegions(), inet::ReorderBuffer::getAvailableDataLength(), inet::ReorderBuffer::popAvailableData(), replace(), sliceRegions(), and str().