21 #include "ns3/abort.h"
23 #include "ns3/pcap-file.h"
24 #include "ns3/config.h"
25 #include "ns3/string.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/data-rate.h"
28 #include "ns3/inet-socket-address.h"
29 #include "ns3/point-to-point-helper.h"
30 #include "ns3/internet-stack-helper.h"
31 #include "ns3/ipv4-global-routing-helper.h"
32 #include "ns3/ipv4-address-helper.h"
33 #include "ns3/packet-sink-helper.h"
34 #include "ns3/tcp-socket-factory.h"
35 #include "ns3/node-container.h"
36 #include "ns3/simulator.h"
37 #include "ns3/error-model.h"
38 #include "ns3/pointer.h"
39 #include "../ns3tcp/ns3tcp-socket-writer.h"
57 virtual void DoRun (
void);
67 :
TestCase (
"Check that nsc TCP survives loss of first two SYNs"),
68 m_writeResults (false)
81 uint16_t sinkPort = 50000;
82 double sinkStopTime = 40;
83 double writerStopTime = 30;
84 double simStopTime = 60;
85 Time sinkStopTimeObj = Seconds (sinkStopTime);
86 Time writerStopTimeObj = Seconds (writerStopTime);
87 Time simStopTimeObj= Seconds (simStopTime);
93 pointToPoint.SetDeviceAttribute (
"DataRate",
StringValue (
"5Mbps"));
94 pointToPoint.SetChannelAttribute (
"Delay",
StringValue (
"200ms"));
97 devices = pointToPoint.Install (n0, n1);
100 internet.
SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
104 address.
SetBase (
"10.1.1.0",
"255.255.255.252");
109 socketWriter->
Setup (n0, sinkAddress);
118 apps.
Start (Seconds (0.0));
119 apps.
Stop (sinkStopTimeObj);
125 Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500);
127 Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
129 std::list<uint32_t> sampleList;
131 sampleList.push_back (0);
132 sampleList.push_back (1);
140 pointToPoint.EnablePcapAll (
"nsc-tcp-loss-test-case-1");
141 pointToPoint.EnableAsciiAll (
"nsc-tcp-loss-test-case-1");
144 Simulator::Stop (simStopTimeObj);
146 Simulator::Destroy ();
165 virtual void DoRun (
void);
175 :
TestCase (
"Check that nsc TCP survives loss of first data packet"),
176 m_writeResults (false)
189 uint16_t sinkPort = 50000;
190 double sinkStopTime = 40;
191 double writerStopTime = 12;
192 double simStopTime = 60;
193 Time sinkStopTimeObj = Seconds (sinkStopTime);
194 Time writerStopTimeObj = Seconds (writerStopTime);
195 Time simStopTimeObj= Seconds (simStopTime);
201 pointToPoint.SetDeviceAttribute (
"DataRate",
StringValue (
"5Mbps"));
202 pointToPoint.SetChannelAttribute (
"Delay",
StringValue (
"200ms"));
205 devices = pointToPoint.Install (n0, n1);
208 internet.
SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
212 address.
SetBase (
"10.1.1.0",
"255.255.255.252");
217 socketWriter->
Setup (n0, sinkAddress);
226 apps.
Start (Seconds (0.0));
227 apps.
Stop (sinkStopTimeObj);
233 Simulator::Schedule (Seconds (10), &SocketWriter::Write, socketWriter, 500);
235 Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
237 std::list<uint32_t> sampleList;
239 sampleList.push_back (2);
247 pointToPoint.EnablePcapAll (
"nsc-tcp-loss-test-case-2");
248 pointToPoint.EnableAsciiAll (
"nsc-tcp-loss-test-case-2");
251 Simulator::Stop (simStopTimeObj);
253 Simulator::Destroy ();