Tcp sender buffer. More...
#include "tcp-tx-buffer.h"
Public Member Functions | |
TcpTxBuffer (uint32_t n=0) | |
Constructor. More... | |
virtual | ~TcpTxBuffer (void) |
bool | Add (Ptr< Packet > p) |
Append a data packet to the end of the buffer. More... | |
uint32_t | Available (void) const |
Returns the available capacity of this buffer. More... | |
uint32_t | BytesInFlight (uint32_t dupThresh, uint32_t segmentSize) const |
Return total bytes in flight. More... | |
Ptr< Packet > | CopyFromSequence (uint32_t numBytes, const SequenceNumber32 &seq) |
Copy data from the range [seq, seq+numBytes) into a packet. More... | |
Ptr< const TcpOptionSack > | CraftSackOption (const SequenceNumber32 &seq, uint8_t available) const |
Craft a SACK block. More... | |
void | DiscardUpTo (const SequenceNumber32 &seq) |
Discard data up to but not including this sequence number. More... | |
uint32_t | GetRetransmitsCount (void) const |
Return the number of segments in the sent list that have been transmitted more than once, without acknowledgment. More... | |
SequenceNumber32 | HeadSequence (void) const |
Get the sequence number of the buffer head. More... | |
bool | IsHeadRetransmitted () const |
Check if the head is retransmitted. More... | |
bool | IsLost (const SequenceNumber32 &seq, uint32_t dupThresh, uint32_t segmentSize) const |
Check if a segment is lost per RFC 6675. More... | |
uint32_t | MaxBufferSize (void) const |
Get the maximum buffer size. More... | |
bool | NextSeg (SequenceNumber32 *seq, uint32_t dupThresh, uint32_t segmentSize, bool isRecovery) const |
Get the next sequence number to transmit, according to RFC 6675. More... | |
void | ResetLastSegmentSent () |
Take the last segment sent and put it back into the un-sent list (at the beginning) More... | |
void | ResetScoreboard () |
Reset the Scoreboard from all SACK informations. More... | |
void | ResetSentList (uint32_t keepItems=1) |
Reset the sent list. More... | |
void | SetHeadSequence (const SequenceNumber32 &seq) |
Set the head sequence of the buffer. More... | |
void | SetMaxBufferSize (uint32_t n) |
Set the maximum buffer size. More... | |
void | SetSentListLost () |
Set the entire sent list as lost (typically after an RTO) More... | |
uint32_t | Size (void) const |
Returns total number of bytes in this buffer. More... | |
uint32_t | SizeFromSequence (const SequenceNumber32 &seq) const |
Returns the number of bytes from the buffer in the range [seq, tailSequence) More... | |
SequenceNumber32 | TailSequence (void) const |
Get the sequence number of the buffer tail (plus one) More... | |
bool | Update (const TcpOptionSack::SackList &list) |
Update the scoreboard. More... | |
![]() | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Types | |
typedef std::list< TcpTxItem * > | PacketList |
container for data stored in the buffer More... | |
Private Member Functions | |
std::pair< TcpTxBuffer::PacketList::const_iterator, SequenceNumber32 > | GetHighestSacked () const |
Find the highest SACK byte. More... | |
TcpTxItem * | GetNewSegment (uint32_t numBytes) |
Get a block of data not transmitted yet and move it into SentList. More... | |
TcpTxItem * | GetPacketFromList (PacketList &list, const SequenceNumber32 &startingSeq, uint32_t numBytes, const SequenceNumber32 &requestedSeq, bool *listEdited) const |
Get a block (which is returned as Packet) from a list. More... | |
TcpTxItem * | GetTransmittedSegment (uint32_t numBytes, const SequenceNumber32 &seq) |
Get a block of data previously transmitted. More... | |
bool | IsLost (const SequenceNumber32 &seq, const PacketList::const_iterator &segment, uint32_t dupThresh, uint32_t segmentSize) const |
Check if a segment is lost per RFC 6675. More... | |
void | MergeItems (TcpTxItem &t1, TcpTxItem &t2) const |
Merge two TcpTxItem. More... | |
void | SplitItems (TcpTxItem &t1, TcpTxItem &t2, uint32_t size) const |
Split one TcpTxItem. More... | |
Private Attributes | |
PacketList | m_appList |
Buffer for application data. More... | |
TracedValue< SequenceNumber32 > | m_firstByteSeq |
Sequence number of the first byte in data (SND.UNA) More... | |
std::pair< PacketList::const_iterator, SequenceNumber32 > | m_highestSack |
Highest SACK byte. More... | |
uint32_t | m_maxBuffer |
Max number of data bytes in buffer (SND.WND) More... | |
PacketList | m_sentList |
Buffer for sent (but not acked) data. More... | |
uint32_t | m_sentSize |
Size of sent (and not discarded) segments. More... | |
uint32_t | m_size |
Size of all data in this buffer. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, TcpTxBuffer const &tcpTxBuf) |
Output operator. More... | |
Additional Inherited Members | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
![]() | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Tcp sender buffer.
The class keeps track of all data that the application wishes to transmit to the other end. When the data is acknowledged, it is removed from the buffer. The buffer has a maximum size, and data is not saved if the amount exceeds the limit. Packets can be added to the class through the method Add(). An important thing to remember is that all the data managed is strictly sequential. It can be divided into blocks, but all the data follow a strict ordering. That order is managed through SequenceNumber.
In other words, this buffer contains numbered bytes (e.g., 1,2,3), and the class is allowed to return only ordered (using "<" as operator) subsets (e.g. 1,2 or 2,3 or 1,2,3).
The data structure underlying this is composed by two distinct packet lists. The first (SentList) is initially empty, and it contains the packets returned by the method CopyFromSequence. The second (AppList) is initially empty, and it contains the packets coming from the applications, but that are not transmitted yet as segments. To discover how the chunks are managed and retrieved from these lists, check CopyFromSequence documentation.
The head of the data is represented by m_firstByteSeq, and it is returned by HeadSequence(). The last byte is returned by TailSequence(). In this class, we also store the size (in bytes) of the packets inside the SentList in the variable m_sentSize.
The SACK information is usually saved in a data structure referred as scoreboard. In this implementation, the scoreboard is developed on top of the existing classes. In particular, instead of keeping raw pointers to packets in TcpTxBuffer we added the capability to store some flags associated with every segment sent. This is done through the use of the class TcpTxItem: instead of storing a list of packets, we store a list of TcpTxItem. Each item has different flags (check the corresponding documentation) and maintaining the scoreboard is a matter of travelling the list and set the SACK flag on the corresponding segment sent.
The algorithms outlined in RFC 6675 are full of inefficiencies. In particular, traveling all the sent list each time it is needed to compute the bytes in flight is expensive. We try to overcome the issue by maintaining a pointer to the highest sequence SACKed; in this way, we can avoid traveling all the list in some cases. Another option could be keeping a count of each critical value (e.g., the number of packets sacked). However, this would be different from the algorithms in RFC. There are some other possible improvements; if you wish, take a look and try to add some earlier exit conditions in the loops.
ns3::TcpTxBuffer is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
Size of this type is 120 bytes (on a 64-bit architecture).
Definition at line 126 of file tcp-tx-buffer.h.
|
private |
container for data stored in the buffer
Definition at line 338 of file tcp-tx-buffer.h.
ns3::TcpTxBuffer::TcpTxBuffer | ( | uint32_t | n = 0 | ) |
Constructor.
n | initial Sequence number to be transmitted |
Definition at line 114 of file tcp-tx-buffer.cc.
|
virtual |
Definition at line 119 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_appList, ns3::TcpTxItem::m_packet, m_sentList, m_sentSize, and m_size.
Append a data packet to the end of the buffer.
p | The packet to be appended to the Tx buffer |
Definition at line 186 of file tcp-tx-buffer.cc.
References Available(), ns3::Packet::Copy(), ns3::Packet::GetSize(), m_appList, m_firstByteSeq, ns3::TcpTxItem::m_packet, m_size, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.
Referenced by TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
uint32_t ns3::TcpTxBuffer::Available | ( | void | ) | const |
Returns the available capacity of this buffer.
Definition at line 169 of file tcp-tx-buffer.cc.
References m_maxBuffer, and m_size.
Referenced by Add().
uint32_t ns3::TcpTxBuffer::BytesInFlight | ( | uint32_t | dupThresh, |
uint32_t | segmentSize | ||
) | const |
Return total bytes in flight.
The routine follows the "SetPipe" function in RFC 6675 and assumes that SACK is enabled for the session
dupThresh | duplicate ACK threshold |
segmentSize | segment size |
Definition at line 929 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), IsLost(), m_firstByteSeq, ns3::TcpTxItem::m_lost, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, ns3::TcpTxItem::m_sacked, and m_sentList.
Ptr< Packet > ns3::TcpTxBuffer::CopyFromSequence | ( | uint32_t | numBytes, |
const SequenceNumber32 & | seq | ||
) |
Copy data from the range [seq, seq+numBytes) into a packet.
In the following, we refer to the block [seq, seq+numBytes) simply as "block". We check the boundary of the block, and divide the possibilities in three cases:
The last case is when the block is partially transmitted and partially not transmitted. We trick this case by requesting the portion not transmitted from GetNewSegment, and then calling GetTransmittedSegment with the full block range.
numBytes | number of bytes to copy |
seq | start sequence number to extract |
Definition at line 227 of file tcp-tx-buffer.cc.
References ns3::Packet::Copy(), ns3::TracedValue< T >::Get(), GetNewSegment(), ns3::Packet::GetSize(), GetTransmittedSegment(), m_firstByteSeq, ns3::TcpTxItem::m_lastSent, ns3::TcpTxItem::m_lost, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, m_sentSize, min, ns3::Simulator::Now(), NS_ABORT_MSG_UNLESS, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, and SizeFromSequence().
Referenced by DiscardUpTo(), TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
Ptr< const TcpOptionSack > ns3::TcpTxBuffer::CraftSackOption | ( | const SequenceNumber32 & | seq, |
uint8_t | available | ||
) | const |
Craft a SACK block.
Used in case the other end does not support SACK
seq | Look to usable block starting from this sequence number (seq will not be included in the block) |
available | Space left in the header for that SACK option |
Definition at line 1053 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_firstByteSeq, m_highestSack, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_sacked, m_sentList, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
void ns3::TcpTxBuffer::DiscardUpTo | ( | const SequenceNumber32 & | seq | ) |
Discard data up to but not including this sequence number.
seq | The first sequence number to maintain after discarding all the previous sequences. |
Definition at line 578 of file tcp-tx-buffer.cc.
References CopyFromSequence(), ns3::Packet::CreateFragment(), ns3::TracedValue< T >::Get(), ns3::Packet::GetSize(), m_firstByteSeq, m_highestSack, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_sacked, m_sentList, m_sentSize, m_size, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC().
Referenced by TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
|
private |
Find the highest SACK byte.
Definition at line 340 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_firstByteSeq, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_sacked, m_sentList, and NS_LOG_FUNCTION.
Referenced by GetTransmittedSegment().
|
private |
Get a block of data not transmitted yet and move it into SentList.
If the block is not yet transmitted, hopefully, seq is exactly the sequence number of the first byte of the first packet inside AppList. We extract the block from AppList and move it into the SentList, before returning the block itself. We manage possible fragmentation (or merges) inside AppList through GetPacketFromList.
numBytes | number of bytes to copy |
Definition at line 297 of file tcp-tx-buffer.cc.
References GetPacketFromList(), ns3::Packet::GetSize(), m_appList, m_firstByteSeq, ns3::TcpTxItem::m_packet, m_sentList, m_sentSize, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by CopyFromSequence().
|
private |
Get a block (which is returned as Packet) from a list.
This function extract a block [requestedSeq,numBytes) from the list, which starts at startingSeq.
The cases we need to manage are two, and they are depicted in the following image:
|------| |----| |----| list = | | --> | | --> | | |------| |----| |----| ^ ^ | ^ ^ | (1) seq | | seq + numBytes | | | | seq seq + numBytes (2)
The case 1 is easy to manage: the requested block is exactly a packet already stored. If one value (seq or seq + numBytes) does not align to a packet boundary, or when both values does not align (case 2), it is a bit more complex.
Basically, we have two possible operations:
and we reduce case (2) to case (1) through sequentially applying fragment or merge. For instance:
|------| | | |------| ^ ^ ^ ^ | | | | start | | | | | end seq | seq + numBytes
To reduce to case (1), we need to perform two fragment operations:
After these operations, the requested block is exactly the resulting packet. Merge operation is required when the requested block span over two (or more) existing packets.
While this could be extremely slow in the worst possible scenario (one big packet which is split in small packets for transmission, and merged for re-transmission) that scenario is unlikely during a TCP transmission (since MSS can change, but it is stable, and retransmissions do not happen for each segment).
list | List to extract block from |
startingSeq | Starting sequence of the list |
numBytes | Bytes to extract, starting from requestedSeq |
requestedSeq | Requested sequence |
listEdited | output parameter which indicates if the list has been edited |
Definition at line 379 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), ns3::TcpTxItem::m_packet, MergeItems(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_WARN, and SplitItems().
Referenced by GetNewSegment(), and GetTransmittedSegment().
uint32_t ns3::TcpTxBuffer::GetRetransmitsCount | ( | void | ) | const |
Return the number of segments in the sent list that have been transmitted more than once, without acknowledgment.
This method is to support the retransmits count for determining PipeSize in NewReno-style TCP.
Definition at line 911 of file tcp-tx-buffer.cc.
References ns3::TcpTxItem::m_retrans, m_sentList, and NS_LOG_FUNCTION.
|
private |
Get a block of data previously transmitted.
This is clearly a retransmission, and if everything is going well, the block requested is matching perfectly with another one requested in the past. If not, fragmentation or merge are required. We manage both inside GetPacketFromList.
numBytes | number of bytes to copy |
seq | sequence requested |
Definition at line 321 of file tcp-tx-buffer.cc.
References GetHighestSacked(), GetPacketFromList(), m_firstByteSeq, m_highestSack, m_sentList, m_sentSize, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by CopyFromSequence().
|
static |
Get the type ID.
Definition at line 93 of file tcp-tx-buffer.cc.
References m_firstByteSeq, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
SequenceNumber32 ns3::TcpTxBuffer::HeadSequence | ( | void | ) | const |
Get the sequence number of the buffer head.
Definition at line 139 of file tcp-tx-buffer.cc.
References m_firstByteSeq.
bool ns3::TcpTxBuffer::IsHeadRetransmitted | ( | ) | const |
Check if the head is retransmitted.
Definition at line 1039 of file tcp-tx-buffer.cc.
References m_sentList, m_sentSize, NS_ASSERT, and NS_LOG_FUNCTION.
bool ns3::TcpTxBuffer::IsLost | ( | const SequenceNumber32 & | seq, |
uint32_t | dupThresh, | ||
uint32_t | segmentSize | ||
) | const |
Check if a segment is lost per RFC 6675.
seq | sequence to check |
dupThresh | dupAck threshold |
segmentSize | segment size |
Definition at line 793 of file tcp-tx-buffer.cc.
References m_firstByteSeq, m_highestSack, m_sentList, and NS_LOG_FUNCTION.
Referenced by BytesInFlight(), NextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
|
private |
Check if a segment is lost per RFC 6675.
seq | sequence to check |
segment | Iterator pointing at seq |
dupThresh | dupAck threshold |
segmentSize | segment size |
Definition at line 731 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_highestSack, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_sacked, NS_LOG_FUNCTION, and NS_LOG_INFO.
uint32_t ns3::TcpTxBuffer::MaxBufferSize | ( | void | ) | const |
Get the maximum buffer size.
Definition at line 157 of file tcp-tx-buffer.cc.
References m_maxBuffer.
Merge two TcpTxItem.
Merge t2 in t1. It consists in copying the lastSent field if t2 is more recent than t1. Retransmitted field is copied only if it set in t2 but not in t1. Sacked is copied only if it is true in both items.
t1 | first item |
t2 | second item |
Definition at line 549 of file tcp-tx-buffer.cc.
References ns3::Packet::AddAtEnd(), ns3::TcpTxItem::m_lastSent, ns3::TcpTxItem::m_lost, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, ns3::TcpTxItem::m_sacked, and NS_LOG_FUNCTION.
Referenced by GetPacketFromList().
bool ns3::TcpTxBuffer::NextSeg | ( | SequenceNumber32 * | seq, |
uint32_t | dupThresh, | ||
uint32_t | segmentSize, | ||
bool | isRecovery | ||
) | const |
Get the next sequence number to transmit, according to RFC 6675.
seq | Next sequence number to transmit, based on the scoreboard information |
dupThresh | dupAck threshold |
segmentSize | segment size |
isRecovery | true if the socket congestion state is in recovery mode |
Definition at line 823 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), ns3::SequenceNumber< NUMERIC_TYPE, SIGNED_TYPE >::GetValue(), IsLost(), m_firstByteSeq, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, ns3::TcpTxItem::m_sacked, m_sentList, m_sentSize, NS_LOG_FUNCTION, and SizeFromSequence().
Referenced by TcpTxBufferTestCase::TestNextSeg().
void ns3::TcpTxBuffer::ResetLastSegmentSent | ( | ) |
Take the last segment sent and put it back into the un-sent list (at the beginning)
Definition at line 1012 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_appList, ns3::TcpTxItem::m_packet, m_sentList, m_sentSize, and NS_LOG_FUNCTION.
void ns3::TcpTxBuffer::ResetScoreboard | ( | ) |
Reset the Scoreboard from all SACK informations.
Definition at line 964 of file tcp-tx-buffer.cc.
References m_firstByteSeq, m_highestSack, m_sentList, and NS_LOG_FUNCTION.
void ns3::TcpTxBuffer::ResetSentList | ( | uint32_t | keepItems = 1 | ) |
Reset the sent list.
Move all but the first 'keepItems' packets from the sent list to the appList. By default, the HEAD of hte sent list is kept and all others moved to the appList. All items kept on the sent list are then marked as un-sacked, un-retransmitted, and lost.
keepItems | Keep a number of items at the front of the sent list |
Definition at line 981 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_appList, m_highestSack, ns3::TcpTxItem::m_lost, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, ns3::TcpTxItem::m_sacked, m_sentList, m_sentSize, and NS_LOG_FUNCTION.
void ns3::TcpTxBuffer::SetHeadSequence | ( | const SequenceNumber32 & | seq | ) |
Set the head sequence of the buffer.
Set the head (m_firstByteSeq) to seq. Supposed to be called only when the connection is just set up and we did not send any data out yet.
seq | The sequence number of the head byte |
Definition at line 175 of file tcp-tx-buffer.cc.
References m_firstByteSeq, m_highestSack, m_sentList, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
void ns3::TcpTxBuffer::SetMaxBufferSize | ( | uint32_t | n | ) |
Set the maximum buffer size.
n | Tx window size (in bytes) |
Definition at line 163 of file tcp-tx-buffer.cc.
References m_maxBuffer.
void ns3::TcpTxBuffer::SetSentListLost | ( | ) |
Set the entire sent list as lost (typically after an RTO)
Used to set all the sent list as lost, so the bytes in flight is not counting them as in flight, but we will continue to use SACK informations for recovering the timeout.
Definition at line 1026 of file tcp-tx-buffer.cc.
References m_sentList, and NS_LOG_FUNCTION.
uint32_t ns3::TcpTxBuffer::Size | ( | void | ) | const |
Returns total number of bytes in this buffer.
Definition at line 151 of file tcp-tx-buffer.cc.
References m_size.
Referenced by TcpTxBufferTestCase::TestNewBlock(), TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
uint32_t ns3::TcpTxBuffer::SizeFromSequence | ( | const SequenceNumber32 & | seq | ) | const |
Returns the number of bytes from the buffer in the range [seq, tailSequence)
seq | initial sequence number |
Definition at line 210 of file tcp-tx-buffer.cc.
References NS_LOG_ERROR, NS_LOG_FUNCTION, and TailSequence().
Referenced by CopyFromSequence(), NextSeg(), and TcpTxBufferTestCase::TestNewBlock().
Split one TcpTxItem.
Move "size" bytes from t2 into t1, copying all the fields.
t1 | first item |
t2 | second item |
size | Size to split |
Definition at line 365 of file tcp-tx-buffer.cc.
References ns3::Packet::CreateFragment(), ns3::TcpTxItem::m_lastSent, ns3::TcpTxItem::m_lost, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_retrans, ns3::TcpTxItem::m_sacked, NS_LOG_FUNCTION, and ns3::Packet::RemoveAtStart().
Referenced by GetPacketFromList().
SequenceNumber32 ns3::TcpTxBuffer::TailSequence | ( | void | ) | const |
Get the sequence number of the buffer tail (plus one)
Definition at line 145 of file tcp-tx-buffer.cc.
References m_firstByteSeq, and m_size.
Referenced by SizeFromSequence().
bool ns3::TcpTxBuffer::Update | ( | const TcpOptionSack::SackList & | list | ) |
Update the scoreboard.
list | list of SACKed blocks |
Definition at line 661 of file tcp-tx-buffer.cc.
References ns3::Packet::GetSize(), m_firstByteSeq, m_highestSack, ns3::TcpTxItem::m_packet, ns3::TcpTxItem::m_sacked, m_sentList, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by TcpTxBufferTestCase::TestNextSeg(), and TcpTxBufferTestCase::TestUpdateScoreboardWithCraftedSACK().
|
friend |
Output operator.
os | The output stream. |
tcpTxBuf | the TcpTxBuffer to print. |
Definition at line 1146 of file tcp-tx-buffer.cc.
|
private |
Buffer for application data.
Definition at line 487 of file tcp-tx-buffer.h.
Referenced by Add(), GetNewSegment(), ns3::operator<<(), ResetLastSegmentSent(), ResetSentList(), and ~TcpTxBuffer().
|
private |
Sequence number of the first byte in data (SND.UNA)
Definition at line 493 of file tcp-tx-buffer.h.
Referenced by Add(), BytesInFlight(), CopyFromSequence(), CraftSackOption(), DiscardUpTo(), GetHighestSacked(), GetNewSegment(), GetTransmittedSegment(), GetTypeId(), HeadSequence(), IsLost(), NextSeg(), ns3::operator<<(), ResetScoreboard(), SetHeadSequence(), TailSequence(), and Update().
|
private |
Highest SACK byte.
Definition at line 495 of file tcp-tx-buffer.h.
Referenced by CraftSackOption(), DiscardUpTo(), GetTransmittedSegment(), IsLost(), ResetScoreboard(), ResetSentList(), SetHeadSequence(), and Update().
|
private |
Max number of data bytes in buffer (SND.WND)
Definition at line 489 of file tcp-tx-buffer.h.
Referenced by Available(), MaxBufferSize(), and SetMaxBufferSize().
|
private |
Buffer for sent (but not acked) data.
Definition at line 488 of file tcp-tx-buffer.h.
Referenced by BytesInFlight(), CraftSackOption(), DiscardUpTo(), GetHighestSacked(), GetNewSegment(), GetRetransmitsCount(), GetTransmittedSegment(), IsHeadRetransmitted(), IsLost(), NextSeg(), ns3::operator<<(), ResetLastSegmentSent(), ResetScoreboard(), ResetSentList(), SetHeadSequence(), SetSentListLost(), Update(), and ~TcpTxBuffer().
|
private |
Size of sent (and not discarded) segments.
Definition at line 491 of file tcp-tx-buffer.h.
Referenced by CopyFromSequence(), DiscardUpTo(), GetNewSegment(), GetTransmittedSegment(), IsHeadRetransmitted(), NextSeg(), ns3::operator<<(), ResetLastSegmentSent(), ResetSentList(), and ~TcpTxBuffer().
|
private |
Size of all data in this buffer.
Definition at line 490 of file tcp-tx-buffer.h.
Referenced by Add(), Available(), DiscardUpTo(), ns3::operator<<(), Size(), TailSequence(), and ~TcpTxBuffer().