|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #include "ns3/tcp-tx-buffer.h"
21 #include "ns3/packet.h"
22 #include "ns3/simulator.h"
42 virtual void DoRun (
void);
43 virtual void DoTeardown (
void);
50 void TestTransmittedBlock ();
55 void TestMergeItemsWhenGetTransmittedSegment ();
60 uint32_t GetRWnd (
void)
const;
89 Simulator::Schedule (
Seconds (0.0),
91 Simulator::Schedule (
Seconds (0.0),
101 Simulator::Schedule (
Seconds (0.0),
105 Simulator::Destroy ();
120 txBuf->
Add(Create<Packet> (10000));
122 for (uint8_t i = 0; i <10 ; ++i)
125 for (uint8_t i = 0; i < 10 ; ++i)
127 "Lost is true, but it's not");
132 for (uint8_t i = 0; i < 10 ; ++i)
134 "Lost is true, but it's not");
139 for (uint8_t i = 0; i < 10 ; ++i)
141 "Lost is true, but it's not");
147 "Lost is true, but it's not");
149 for (uint8_t i = 1; i < 10 ; ++i)
151 "Lost is true, but it's not");
173 uint32_t dupThresh = 3;
179 "NextSeq should not be returned at the beginning");
183 "NextSeq should not be returned with no data");
186 txBuf->
Add (Create<Packet> (30000));
188 "No NextSeq with data at beginning");
190 "Different NextSeq than expected at the beginning");
193 for (uint32_t i=0; i<100; ++i)
196 "No NextSeq with data while \"transmitting\"");
198 "Different NextSeq than expected while \"transmitting\"");
205 for (uint32_t i=1; i<dupThresh; ++i)
214 "No NextSeq with SACK block while \"transmitting\"");
216 "Different NextSeq than expected in limited transmit");
228 "No NextSeq with SACK block for Fast Recovery");
230 "Different NextSeq than expected for Fast Recovery");
235 for (uint32_t i=1; i<=4; ++i)
241 "No NextSeq with SACK block after recv dupacks in FR");
243 "Different NextSeq than expected after recv dupacks in FR");
264 "No NextSeq with SACK block after receiving partial ACK");
266 "Different NextSeq than expected after receiving partial ACK ");
274 "No NextSeq with SACK block after recv dupacks after partial ack");
276 "Different NextSeq than expected after recv dupacks after partial ack");
285 for (uint32_t i=0; i<93; ++i)
288 "No NextSeq with data while \"transmitting\"");
290 "Different NextSeq than expected while \"transmitting\"");
296 "Data inside the buffer");
313 "TxBuf miscalculates size");
315 "TxBuf miscalculates size of in flight segments");
319 "Returned packet has different size than requested");
321 "TxBuf miscalculates size");
323 "TxBuf miscalculates size of in flight segments");
327 "TxBuf miscalculates size");
329 "TxBuf miscalculates size of in flight segments");
338 "Returned packet has different size than requested");
340 "TxBuf miscalculates size");
342 "TxBuf miscalculates size of in flight segments");
350 "Returned packet has different size than requested");
352 "TxBuf miscalculates size");
354 "TxBuf miscalculates size of in flight segments");
358 "Returned packet has different size than requested");
360 "TxBuf miscalculates size");
362 "TxBuf miscalculates size of in flight segments");
367 "Size is different than expected");
378 txBuf.
Add(Create<Packet> (2000));
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const
Returns the number of bytes from the buffer in the range [seq, tailSequence)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
uint32_t Size(void) const
Returns total number of bytes in this buffer.
TcpTxBufferTestCase()
Constructor.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddSackBlock(SackBlock s)
Add a SACK block.
void MarkHeadAsLost()
Mark the head of the sent list as lost.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem * > &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
SackList GetSackList(void) const
Get the SACK list.
void TestNewBlock()
Test the generation of an unsent block.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
void TestMergeItemsWhenGetTransmittedSegment()
Test the logic of merging items in GetTransmittedSegment() which is triggered by CopyFromSequence()
Smart pointer class similar to boost::intrusive_ptr.
static TcpTxBufferTestSuite g_tcpTxBufferTestSuite
Static variable for test initialization.
void TestNextSeg()
Test the generation of the "next" block.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
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.
void TestIsLost()
Test if a segment is really set as lost.
@ UNIT
This test suite implements a Unit Test.
void ClearSackList(void)
Clear the SACK list.
Time Seconds(double value)
Construct a Time in the indicated unit.
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.
the TestSuite for the TcpTxBuffer test case
void TestTransmittedBlock()
Test the generation of a previously sent block.
Ptr< Packet > GetPacketCopy(void) const
Get a copy of the Packet underlying this item.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
uint32_t BytesInFlight() const
Return total bytes in flight.
bool NextSeg(SequenceNumber32 *seq, SequenceNumber32 *seqHigh, bool isRecovery) const
Get the next sequence number to transmit, according to RFC 6675.
uint32_t GetRWnd(void) const
Callback to provide a value of receiver window.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.