29 #include "ns3/tcp-congestion-ops.h" 30 #include "ns3/tcp-socket-base.h" 31 #include "ns3/tcp-vegas.h" 58 uint32_t segmentsAcked,
61 const std::string &name);
64 virtual void DoRun (
void);
91 uint32_t segmentsAcked,
94 const std::string &name)
97 m_segmentSize (segmentSize),
98 m_ssThresh (ssThresh),
100 m_segmentsAcked (segmentsAcked),
101 m_nextTxSeq (nextTxSeq),
102 m_lastAckedSeq (lastAckedSeq)
109 m_state = CreateObject<TcpSocketState> ();
138 "CWnd has not updated correctly");
140 "SsThresh has not updated correctly");
150 uint64_t expectedCwnd;
155 diff = segCwnd - expectedCwnd;
165 segCwnd =
std::min (segCwnd, (uint32_t) expectedCwnd + 1);
179 if (diff > beta.
Get ())
184 else if (diff <
alpha.Get ())
214 "Vegas test on cWnd and ssThresh when in slow start and diff > gamma"),
217 "Vegas test on cWnd and ssThresh when in slow start and diff < gamma"),
220 "Vegas test on cWnd and ssThresh when diff > beta"),
223 "Vegas test on cWnd and ssThresh when diff < alpha"),
226 "Vegas test on cWnd and ssThresh when alpha <= diff <= beta"),
TcpVegasTest(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, Time rtt, uint32_t segmentsAcked, SequenceNumber32 nextTxSeq, SequenceNumber32 lastAckedSeq, const std::string &name)
Constructor.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t m_segmentSize
Segment size.
void IncreaseWindow(Ptr< TcpVegas > cong)
Increases the TCP window.
uint32_t m_ssThresh
Slow Start Threshold.
SequenceNumber32 m_lastAckedSeq
Last ACKed sequence number.
uint32_t m_cWnd
Congestion window.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
#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.
SequenceNumber32 m_lastAckedSeq
Last sequence ACKed.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t m_segmentSize
Segment size.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Vegas linear increase/decrease algorithm.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
SequenceNumber32 m_nextTxSeq
Next Tx sequence number.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Vegas algorithm depending on the congestion state.
Generic "sequence number" class.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Compute RTTs needed to execute Vegas algorithm.
static TcpVegasTestSuite g_tcpVegasTest
Static variable for test initialization.
TracedValue< uint32_t > m_cWnd
Congestion window.
void GetSsThresh(Ptr< TcpVegas > cong)
brief Get and check the SSH threshold.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
T Get(void) const
Get the underlying value.
Time m_minRtt
Minimum RTT observed throughout the connection.
Ptr< TcpSocketState > m_state
TCP socket state.
This test suite implements a Unit Test.
uint32_t m_segmentsAcked
Number of segments ACKed.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
TracedValue< SequenceNumber32 > m_nextTxSequence
Next seqnum to be sent (SND.NXT), ReTx pushes it back.
TcpVegas congestion control algorithm test.