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/nstime.h"
29 #include "ns3/tcp-option-sack.h"
57 void Print (std::ostream &os)
const;
159 uint32_t
Size (
void)
const;
259 bool isRecovery)
const;
282 uint32_t
BytesInFlight (uint32_t dupThresh, uint32_t segmentSize)
const;
349 uint32_t segmentSize)
const;
455 bool *listEdited)
const;
484 std::pair <TcpTxBuffer::PacketList::const_iterator, SequenceNumber32>
Simulation virtual time values and global simulation resolution.
bool m_retrans
Indicates if the segment is retransmitted.
uint32_t Size(void) const
Returns total number of bytes in this buffer.
void ResetSentList(uint32_t keepItems=1)
Reset the sent list.
TcpTxItem * GetTransmittedSegment(uint32_t numBytes, const SequenceNumber32 &seq)
Get a block of data previously transmitted.
void DiscardUpTo(const SequenceNumber32 &seq)
Discard data up to but not including this sequence number.
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const
Returns the number of bytes from the buffer in the range [seq, tailSequence)
void ResetLastSegmentSent()
Take the last segment sent and put it back into the un-sent list (at the beginning) ...
bool IsLost(const SequenceNumber32 &seq, uint32_t dupThresh, uint32_t segmentSize) const
Check if a segment is lost per RFC 6675.
SequenceNumber32 HeadSequence(void) const
Get the sequence number of the buffer head.
PacketList m_appList
Buffer for application data.
std::list< SackBlock > SackList
SACK list definition.
uint32_t MaxBufferSize(void) const
Get the maximum buffer size.
Item that encloses the application packet and some flags for it.
uint32_t GetRetransmitsCount(void) const
Return the number of segments in the sent list that have been transmitted more than once...
TracedValue< SequenceNumber32 > m_firstByteSeq
Sequence number of the first byte in data (SND.UNA)
Time m_lastSent
Timestamp of the time at which the segment has.
uint32_t BytesInFlight(uint32_t dupThresh, uint32_t segmentSize) const
Return total bytes in flight.
uint32_t m_sentSize
Size of sent (and not discarded) segments.
void SetSentListLost()
Set the entire sent list as lost (typically after an RTO)
std::list< TcpTxItem * > PacketList
container for data stored in the buffer
uint32_t m_size
Size of all data in this buffer.
void SetMaxBufferSize(uint32_t n)
Set the maximum buffer size.
std::pair< PacketList::const_iterator, SequenceNumber32 > m_highestSack
Highest SACK byte.
uint32_t Available(void) const
Returns the available capacity of this buffer.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Ptr< Packet > m_packet
Application packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Generic "sequence number" class.
bool NextSeg(SequenceNumber32 *seq, uint32_t dupThresh, uint32_t segmentSize, bool isRecovery) const
Get the next sequence number to transmit, according to RFC 6675.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
static TypeId GetTypeId(void)
Get the type ID.
void SplitItems(TcpTxItem &t1, TcpTxItem &t2, uint32_t size) const
Split one TcpTxItem.
bool Update(const TcpOptionSack::SackList &list)
Update the scoreboard.
bool IsHeadRetransmitted() const
Check if the head is retransmitted.
friend std::ostream & operator<<(std::ostream &os, TcpTxBuffer const &tcpTxBuf)
Output operator.
PacketList m_sentList
Buffer for sent (but not acked) data.
uint32_t m_maxBuffer
Max number of data bytes in buffer (SND.WND)
void ResetScoreboard()
Reset the Scoreboard from all SACK informations.
TcpTxItem * GetNewSegment(uint32_t numBytes)
Get a block of data not transmitted yet and move it into SentList.
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.
Ptr< const TcpOptionSack > CraftSackOption(const SequenceNumber32 &seq, uint8_t available) const
Craft a SACK block.
A base class which provides memory management and object aggregation.
TcpTxBuffer(uint32_t n=0)
Constructor.
virtual ~TcpTxBuffer(void)
void MergeItems(TcpTxItem &t1, TcpTxItem &t2) const
Merge two TcpTxItem.
void Print(std::ostream &os) const
Print the time.
bool m_sacked
Indicates if the segment has been SACKed.
a unique identifier for an interface.
bool m_lost
Indicates if the segment has been lost (RTO)
SequenceNumber32 TailSequence(void) const
Get the sequence number of the buffer tail (plus one)
std::pair< TcpTxBuffer::PacketList::const_iterator, SequenceNumber32 > GetHighestSacked() const
Find the highest SACK byte.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
Ptr< Packet > CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.