11#include "ns3/config.h"
12#include "ns3/inet-socket-address.h"
13#include "ns3/internet-stack-helper.h"
14#include "ns3/ipv4-address-helper.h"
16#include "ns3/simple-channel.h"
17#include "ns3/simple-net-device.h"
18#include "ns3/simulator.h"
19#include "ns3/string.h"
21#include "ns3/udp-client-server-helper.h"
22#include "ns3/udp-echo-helper.h"
23#include "ns3/udp-server.h"
24#include "ns3/uinteger.h"
49 void DoRun()
override;
53 :
TestCase(
"Test that all the udp packets generated by an udpClient application are correctly "
54 "received by an udpServer application")
77 rxDev->SetChannel(channel1);
78 txDev->SetChannel(channel1);
85 ipv4.SetBase(
"10.1.1.0",
"255.255.255.0");
90 auto serverApp = serverHelper.
Install(n.
Get(1));
101 auto clientApp = clientHelper.
Install(n.
Get(0));
125 void DoRun()
override;
129 :
TestCase(
"Test that all the udp packets generated by an udpTraceClient application are "
130 "correctly received by an udpServer application")
153 rxDev->SetChannel(channel1);
154 txDev->SetChannel(channel1);
160 ipv4.SetBase(
"10.1.1.0",
"255.255.255.0");
163 uint16_t
port = 4000;
165 auto serverApp = serverHelper.
Install(n.
Get(1));
172 auto clientApp = clientHelper.
Install(n.
Get(0));
183 "Did not receive expected number of packets !");
197 void DoRun()
override;
201 :
TestCase(
"Test that all the PacketLossCounter class checks loss correctly in different cases")
227 for (
uint32_t i = 134; i < 200; i++)
242 for (
uint32_t i = 205; i < 250; i++)
248 "Check that 7 (6+1) packets are lost even when reordering happens");
256 for (
uint32_t i = 256; i < 300; i++)
274 void DoRun()
override;
278 :
TestCase(
"Test that the UdpEchoClient::SetFill class sets packet size (bug 1378)")
293 internet.Install(
nodes);
300 rxDev->SetChannel(channel1);
301 txDev->SetChannel(channel1);
308 ipv4.SetBase(
"10.1.1.0",
"255.255.255.0");
311 uint16_t
port = 5000;
314 serverApps.Start(
Seconds(1.0));
315 serverApps.Stop(
Seconds(10.0));
325 for (i = 0; i < 64; i++)
329 echoClient.SetFill(clientApps.Get(0), &(array[0]), (
uint32_t)64, (
uint32_t)64);
331 clientApps.Start(
Seconds(2.0));
332 clientApps.Stop(
Seconds(10.0));
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.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
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...
Create UdpTraceClient application which sends UDP packets based on a trace file of an MPEG4 stream.
Hold an unsigned integer type.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
static UdpClientServerTestSuite udpClientServerTestSuite
Static variable for test initialization.