|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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;
102 internet.
SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
106 address.SetBase (
"10.1.1.0",
"255.255.255.252");
111 socketWriter->
Setup (n0, sinkAddress);
121 apps.
Stop (sinkStopTimeObj);
127 Simulator::Schedule (
Seconds (10), &SocketWriter::Write, socketWriter, 500);
129 Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
131 std::list<uint32_t> sampleList;
133 sampleList.push_back (0);
134 sampleList.push_back (1);
142 pointToPoint.EnablePcapAll (
"nsc-tcp-loss-test-case-1");
143 pointToPoint.EnableAsciiAll (
"nsc-tcp-loss-test-case-1");
146 Simulator::Stop (simStopTimeObj);
148 Simulator::Destroy ();
167 virtual void DoRun (
void);
177 :
TestCase (
"Check that nsc TCP survives loss of first data packet"),
178 m_writeResults (false)
191 uint16_t sinkPort = 50000;
192 double sinkStopTime = 40;
193 double writerStopTime = 12;
194 double simStopTime = 60;
212 internet.
SetTcp (
"ns3::NscTcpL4Protocol",
"Library",
StringValue (
"liblinux2.6.26.so"));
216 address.SetBase (
"10.1.1.0",
"255.255.255.252");
221 socketWriter->
Setup (n0, sinkAddress);
231 apps.
Stop (sinkStopTimeObj);
237 Simulator::Schedule (
Seconds (10), &SocketWriter::Write, socketWriter, 500);
239 Simulator::Schedule (writerStopTimeObj, &SocketWriter::Close, socketWriter);
241 std::list<uint32_t> sampleList;
243 sampleList.push_back (2);
251 pointToPoint.EnablePcapAll (
"nsc-tcp-loss-test-case-2");
252 pointToPoint.EnableAsciiAll (
"nsc-tcp-loss-test-case-2");
255 Simulator::Stop (simStopTimeObj);
257 Simulator::Destroy ();
holds a vector of ns3::NetDevice pointers
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
TestVectors< uint32_t > m_responses
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Hold objects of type Ptr<T>.
void SetTcp(std::string tid)
set the Tcp stack which will not need any other parameter.
void InstallAll(void) const
Aggregate IPv4, IPv6, UDP, and TCP stacks to all nodes in the simulation.
void SetStopTime(Time stop)
Specify application stop time.
TestVectors< uint32_t > m_responses
void SinkRx(std::string path, Ptr< const Packet > p, const Address &address)
void SetStartTime(Time start)
Specify application start time.
void SetList(const std::list< uint32_t > &packetlist)
a polymophic address class
TestVectors< uint32_t > m_inputs
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SinkRx(std::string path, Ptr< const Packet > p, const Address &address)
Simulation virtual time values and global simulation resolution.
virtual ~NscTcpLossTestCase1()
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...
Hold variables of type string.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
static NscTcpLossTestSuite nscTcpLossTestSuite
#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.
void Connect(std::string path, const CallbackBase &cb)
T Get(std::size_t i) const
Get the i'th test vector.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Time Seconds(double value)
Construct a Time in the indicated unit.
holds a vector of ns3::Application pointers.
virtual ~NscTcpLossTestCase2()
Build a set of PointToPointNetDevice objects.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
std::size_t GetN(void) const
Get the total number of test vectors.
void Setup(Ptr< Node > node, Address peer)
aggregate IP/TCP/UDP functionality to existing Nodes.
std::size_t Add(T vector)
static void SinkRx(std::string path, Ptr< const Packet > p, const Address &address)
TestVectors< uint32_t > m_inputs