9#include "ns3/packet-socket-client.h" 
   10#include "ns3/packet-socket-helper.h" 
   11#include "ns3/packet-socket-server.h" 
   12#include "ns3/packet.h" 
   13#include "ns3/simple-channel.h" 
   14#include "ns3/simple-net-device.h" 
   15#include "ns3/simulator.h" 
   17#include "ns3/traced-callback.h" 
   18#include "ns3/uinteger.h" 
   34    void DoRun() 
override;
 
 
   46    : 
TestCase(
"Packet Socket Apps test")
 
 
   77    nodes.Get(0)->AddDevice(txDev);
 
   81    nodes.Get(1)->AddDevice(rxDev);
 
   84    txDev->SetChannel(channel);
 
   85    rxDev->SetChannel(channel);
 
   86    txDev->SetNode(
nodes.Get(0));
 
   87    rxDev->SetNode(
nodes.Get(1));
 
   95    client->SetRemote(socketAddr);
 
   98    nodes.Get(0)->AddApplication(client);
 
  102    server->SetLocal(socketAddr);
 
  103    nodes.Get(1)->AddApplication(server);
 
 
PacketSocket apps Unit Test.
uint32_t m_receivedPacketSize
Received packet size.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_receivedPacketNumber
Number of received packets.
void ReceivePkt(Ptr< const Packet > packet, const Address &from)
Receive a packet.
PacketSocket apps TestSuite.
PacketSocketAppsTestSuite()
a polymophic address class
keep track of a set of node pointers.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
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.
TestCase(const TestCase &)=delete
@ UNIT
This test suite implements a Unit Test.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Hold an unsigned integer type.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static PacketSocketAppsTestSuite g_packetSocketAppsTestSuite
Static variable for test initialization.