11#include "ns3/boolean.h"
14#include "ns3/nstime.h"
15#include "ns3/simulator.h"
16#include "ns3/tcp-header.h"
17#include "ns3/uinteger.h"
127 socket->SetAttribute(
"WindowScaling",
BooleanValue(
false));
144 NS_LOG_INFO(
"RECEIVER application notified of data but does not read (window must close)");
150 NS_LOG_INFO(
"RECEIVER application reads to free the receive buffer at "
155 while (
Ptr<Packet> p = socket->Recv(0xffffffff, 0))
157 if (p->GetSize() == 0)
172 NS_LOG_INFO(
"RECEIVER TX " << h <<
" size " << p->GetSize() <<
" at "
198 "Precondition failed: receiver never advertised a zero window, "
199 "so the sender was never stalled");
202 "Precondition failed: the scheduled application read did not run");
207 "Receiver did not send a window-update ACK after the application "
208 "freed receive-buffer space (issue #125): the only relief is the "
209 "sender persist timer");
225 "window update ACK sent when application read frees rx buffer"),
Regression test for Issue 125.
bool m_appHasRead
True once the scheduled application read has executed.
Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node) override
Create and install the socket to install on the receiver.
bool m_windowClosed
True once the receiver has advertised a zero window.
Time m_readTime
Time at which the application reads to free the window.
Time m_windowUpdateDeadline
Latest time a read-triggered update may legitimately appear.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
void ConfigureProperties() override
Change the configuration of the socket properties.
TcpWindowUpdateOnReadTest(const std::string &desc)
Constructor.
void ReceivePacket(Ptr< Socket > socket) override
Packet received.
void ConfigureEnvironment() override
Change the configuration of the environment.
void AppRead()
Scheduled application read that frees the entire receive buffer.
void FinalChecks() override
Performs the (eventual) final checks through test asserts.
bool m_windowUpdateSent
True if a window-update ACK was sent shortly after the read.
TCP window-update-on-read TestSuite (Issue 125).
TcpWindowUpdateTestSuite()
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
void SetAppPktSize(uint32_t pktSize)
Set app packet size.
void SetInitialCwnd(SocketWho who, uint32_t initialCwnd)
Forcefully set the initial cwnd.
virtual Ptr< TcpSocketMsgBase > CreateReceiverSocket(Ptr< Node > node)
Create and install the socket to install on the receiver.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
void SetMTU(uint32_t mtu)
MTU of the bottleneck link.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
TcpGeneralTest(const std::string &desc)
TcpGeneralTest constructor.
Ptr< TcpSocketMsgBase > GetSenderSocket()
Get the pointer to a previously created sender socket.
Ptr< TcpSocketMsgBase > GetReceiverSocket()
Get the pointer to a previously created receiver socket.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
Hold an unsigned integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpWindowUpdateTestSuite g_tcpWindowUpdateTestSuite
Static variable for test init.