21 #include "ns3/abort.h"
22 #include "ns3/config.h"
23 #include "ns3/inet-socket-address.h"
24 #include "ns3/internet-stack-helper.h"
25 #include "ns3/ipv4-address-helper.h"
27 #include "ns3/simple-channel.h"
28 #include "ns3/simple-net-device.h"
29 #include "ns3/simulator.h"
30 #include "ns3/string.h"
32 #include "ns3/udp-client-server-helper.h"
33 #include "ns3/udp-echo-helper.h"
34 #include "ns3/uinteger.h"
59 void DoRun()
override;
63 :
TestCase(
"Test that all the udp packets generated by an udpClient application are correctly "
64 "received by an udpServer application")
87 rxDev->SetChannel(channel1);
88 txDev->SetChannel(channel1);
95 ipv4.
SetBase(
"10.1.1.0",
"255.255.255.0");
104 uint32_t MaxPacketSize = 1024;
106 uint32_t maxPacketCount = 10;
116 Simulator::Destroy();
121 "Did not receive expected number of packets !");
136 void DoRun()
override;
140 :
TestCase(
"Test that all the udp packets generated by an udpTraceClient application are "
141 "correctly received by an udpServer application")
164 rxDev->SetChannel(channel1);
165 txDev->SetChannel(channel1);
171 ipv4.
SetBase(
"10.1.1.0",
"255.255.255.0");
174 uint16_t
port = 4000;
180 uint32_t MaxPacketSize = 1400 - 28;
188 Simulator::Destroy();
193 "Did not receive expected number of packets !");
207 void DoRun()
override;
211 :
TestCase(
"Test that all the PacketLossCounter class checks loss correctly in different cases")
224 for (uint32_t i = 0; i < 64; i++)
231 for (uint32_t i = 65; i < 128; i++)
237 for (uint32_t i = 134; i < 200; i++)
252 for (uint32_t i = 205; i < 250; i++)
258 "Check that 7 (6+1) packets are lost even when reordering happens");
266 for (uint32_t i = 256; i < 300; i++)
284 void DoRun()
override;
288 :
TestCase(
"Test that the UdpEchoClient::SetFill class sets packet size (bug 1378)")
310 rxDev->SetChannel(channel1);
311 txDev->SetChannel(channel1);
318 ipv4.
SetBase(
"10.1.1.0",
"255.255.255.0");
321 uint16_t
port = 5000;
335 for (i = 0; i < 64; i++)
345 Simulator::Destroy();
Test that all the PacketLossCounter class checks loss correctly in different cases.
~PacketLossCounterTestCase() override
PacketLossCounterTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Test that all the UDP packets generated by an UdpClient application are correctly received by an UdpS...
~UdpClientServerTestCase() override
UdpClientServerTestCase()
void DoRun() override
Implementation to actually run this TestCase.
UDP client and server TestSuite.
UdpClientServerTestSuite()
~UdpEchoClientSetFillTestCase() override
UdpEchoClientSetFillTestCase()
void DoRun() override
Implementation to actually run this TestCase.
Test that all the udp packets generated by an udpTraceClient application are correctly received by an...
UdpTraceClientServerTestCase()
~UdpTraceClientServerTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
A class to count the number of lost packets.
void NotifyReceived(uint32_t seq)
Record a successfully received packet.
uint32_t GetLost() const
Get the number of lost packets.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
ApplicationContainer Install(NodeContainer c)
Create an application which sends a UDP packet and waits for an echo of this packet.
Create a server application which waits for input UDP packets and sends them back to the original sen...
Create a server application which waits for input UDP packets and uses the information carried into t...
Ptr< UdpServer > GetServer()
Return the last created server.
ApplicationContainer Install(NodeContainer c)
Create one UDP server application on each of the Nodes in the NodeContainer.
Create UdpTraceClient application which sends UDP packets based on a trace file of an MPEG4 stream.
ApplicationContainer Install(NodeContainer c)
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static UdpClientServerTestSuite udpClientServerTestSuite
Static variable for test initialization.