20 #include "ns3/abort.h"
22 #include "ns3/pcap-file.h"
23 #include "ns3/config.h"
24 #include "ns3/string.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/data-rate.h"
27 #include "ns3/inet-socket-address.h"
28 #include "ns3/point-to-point-helper.h"
29 #include "ns3/internet-stack-helper.h"
30 #include "ns3/ipv4-global-routing-helper.h"
31 #include "ns3/ipv4-address-helper.h"
32 #include "ns3/packet-sink-helper.h"
33 #include "ns3/tcp-socket-factory.h"
34 #include "ns3/simulator.h"
85 virtual void StartApplication (
void);
86 virtual void StopApplication (
void);
88 void ScheduleTx (
void);
183 virtual void DoRun (
void);
194 void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
198 :
TestCase (
"Check to see that the ns-3 TCP congestion window works as expected against liblinux2.6.26.so"),
199 m_writeResults (false)
213 event.m_newCwnd = newCwnd;
243 devices = pointToPoint.
Install (nodes);
256 std::string nscStack =
"liblinux2.6.26.so";
257 stack.
SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
265 address.
SetBase (
"10.1.1.0",
"255.255.255.252");
273 uint16_t sinkPort = 8080;
300 Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (nodes.
Get (0), TcpSocketFactory::GetTypeId ());
304 app->
Setup (ns3TcpSocket, sinkAddress, 1040, 10,
DataRate (
"5Mbps"));
331 Simulator::Destroy ();
347 const uint32_t MSS = 536;
348 const uint32_t N_EVENTS = 21;
356 for (uint32_t i = 1, from = MSS, to = MSS * 2; i < N_EVENTS; ++i, from += MSS, to += MSS)
386 virtual void DoRun (
void);
387 void VerifyCwndRun (uint32_t beginIdx, uint32_t endIdx, uint32_t initialCwnd, uint32_t mss);
398 void CwndChange (uint32_t oldCwnd, uint32_t newCwnd);
402 :
TestCase (
"Check to see that the ns-3 TCP congestion window works as expected for out-of-order packet delivery"),
403 m_writeResults (false)
417 event.m_newCwnd = newCwnd;
457 ipv4.
SetBase (
"10.1.3.0",
"255.255.255.0");
459 ipv4.
SetBase (
"10.1.2.0",
"255.255.255.0");
461 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
465 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
468 uint16_t servPort = 50000;
480 Ptr<Socket> ns3TcpSocket = Socket::CreateSocket (n0n1.
Get (0), TcpSocketFactory::GetTypeId ());
485 app->
Setup (ns3TcpSocket, sinkAddress, 1040, 1000,
DataRate (
"1Mbps"));
498 Simulator::Stop (
Seconds (4.4));
500 Simulator::Destroy ();
518 const uint32_t MSS = 536;
519 const uint32_t N_EVENTS = 45;
558 uint32_t cwnd = 5 * MSS;
560 for (uint32_t i = 30; i < N_EVENTS; ++i)
562 double adder =
static_cast<double> (MSS * MSS) / cwnd;
563 adder = std::max (1.0, adder);
564 cwnd +=
static_cast<uint32_t
> (adder);
575 for(uint32_t i = beginIdx, to = initialCwnd; i < endIdx; ++i, to += mss)