|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #ifndef TCP_TX_BUFFER_H
23 #define TCP_TX_BUFFER_H
25 #include "ns3/object.h"
26 #include "ns3/traced-value.h"
27 #include "ns3/sequence-number.h"
28 #include "ns3/tcp-option-sack.h"
29 #include "ns3/tcp-tx-item.h"
155 uint32_t
Size (
void)
const;
564 bool *listEdited =
nullptr)
const;
600 std::pair <TcpTxBuffer::PacketList::const_iterator, SequenceNumber32>
uint32_t m_dupAckThresh
Duplicate Ack threshold from TcpSocketBase.
a unique identifier for an interface.
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const
Returns the number of bytes from the buffer in the range [seq, tailSequence)
void SetSentListLost(bool resetSack=false)
Set the entire sent list as lost (typically after an RTO)
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
void ResetSentList()
Reset the sent list.
uint32_t Size(void) const
Returns total number of bytes in this buffer.
void UpdateLostCount()
Update the lost count.
void SetSackEnabled(bool enabled)
tell tx-buffer whether SACK is used on this TCP socket
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_sentSize
Size of sent (and not discarded) segments.
TcpTxBuffer(uint32_t n=0)
Constructor.
void MergeItems(TcpTxItem *t1, TcpTxItem *t2) const
Merge two TcpTxItem.
std::list< TcpTxItem * > PacketList
container for data stored in the buffer
void MarkHeadAsLost()
Mark the head of the sent list as lost.
void ConsistencyCheck() const
Check if the values of sacked, lost, retrans, are in sync with the sent list.
uint32_t GetLost(void) const
Get the number of segments that we believe are lost in the network.
PacketList m_sentList
Buffer for sent (but not acked) data.
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem * > &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
uint32_t Available(void) const
Returns the available capacity of this buffer.
uint32_t m_segmentSize
Segment size from TcpSocketBase.
void AddRenoSack()
Emulate SACKs for SACKless connection: account for a new dupack.
virtual ~TcpTxBuffer(void)
bool IsSackEnabled(void) const
check whether SACK is used on the corresponding TCP socket
bool m_renoSack
Indicates if AddRenoSack was called.
void SplitItems(TcpTxItem *t1, TcpTxItem *t2, uint32_t size) const
Split one TcpTxItem.
void SetMaxBufferSize(uint32_t n)
Set the maximum buffer size.
uint32_t MaxBufferSize(void) const
Get the maximum buffer size.
uint32_t m_lostOut
Number of lost bytes.
uint32_t GetSacked(void) const
Get the number of segments that have been explicitly sacked by the receiver.
A base class which provides memory management and object aggregation.
friend std::ostream & operator<<(std::ostream &os, TcpTxBuffer const &tcpTxBuf)
Output operator.
static Callback< void, TcpTxItem * > m_nullCb
Null callback for an item.
uint32_t BytesInFlightRFC() const
Calculate the number of bytes in flight per RFC 6675.
uint32_t m_maxBuffer
Max number of data bytes in buffer (SND.WND)
SequenceNumber32 TailSequence(void) const
Get the sequence number of the buffer tail (plus one)
uint32_t m_size
Size of all data in this buffer.
TcpTxItem * GetNewSegment(uint32_t numBytes)
Get a block of data not transmitted yet and move it into SentList.
bool IsHeadRetransmitted() const
Check if the head is retransmitted.
std::pair< PacketList::const_iterator, SequenceNumber32 > m_highestSack
Highest SACK byte.
void ResetLastSegmentSent()
Take the last segment sent and put it back into the un-sent list (at the beginning)
TcpTxItem * GetPacketFromList(PacketList &list, const SequenceNumber32 &startingSeq, uint32_t numBytes, const SequenceNumber32 &requestedSeq, bool *listEdited=nullptr) const
Get a block (which is returned as Packet) from a list.
bool IsLost(const SequenceNumber32 &seq) const
Check if a segment is lost.
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem * > &sackedCb=m_nullCb)
Update the scoreboard.
Item that encloses the application packet and some flags for it.
void ResetRenoSack()
Reset the SACKs.
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
void SetRWndCallback(Callback< uint32_t > rWndCallback)
Set callback to obtain receiver window value.
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
TcpTxItem * GetTransmittedSegment(uint32_t numBytes, const SequenceNumber32 &seq)
Get a block of data previously transmitted.
Callback< uint32_t > m_rWndCallback
Callback to obtain RCV.WND value.
bool IsLostRFC(const SequenceNumber32 &seq, const PacketList::const_iterator &segment) const
Decide if a segment is lost based on RFC 6675 algorithm.
std::pair< TcpTxBuffer::PacketList::const_iterator, SequenceNumber32 > FindHighestSacked() const
Find the highest SACK byte.
bool IsRetransmittedDataAcked(const SequenceNumber32 &ack) const
Checks whether the ack corresponds to retransmitted data.
uint32_t GetRetransmitsCount(void) const
Return the number of segments in the sent list that have been transmitted more than once,...
PacketList m_appList
Buffer for application data.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
TracedValue< SequenceNumber32 > m_firstByteSeq
Sequence number of the first byte in data (SND.UNA)
void DeleteRetransmittedFlagFromHead()
DeleteRetransmittedFlagFromHead.
uint32_t BytesInFlight() const
Return total bytes in flight.
std::ostream & operator<<(std::ostream &os, const Angles &a)
bool NextSeg(SequenceNumber32 *seq, SequenceNumber32 *seqHigh, bool isRecovery) const
Get the next sequence number to transmit, according to RFC 6675.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
uint32_t m_sackedOut
Number of sacked bytes.
void RemoveFromCounts(TcpTxItem *item, uint32_t size)
Remove the size specified from the lostOut, retrans, sacked count.
static TypeId GetTypeId(void)
Get the type ID.
SequenceNumber32 HeadSequence(void) const
Get the sequence number of the buffer head.
std::list< SackBlock > SackList
SACK list definition.
uint32_t m_retrans
Number of retransmitted bytes.
bool m_sackEnabled
Indicates if SACK is enabled on this connection.