20 #include "ns3/packet-socket-client.h"
21 #include "ns3/packet-socket-helper.h"
22 #include "ns3/packet-socket-server.h"
23 #include "ns3/packet.h"
24 #include "ns3/simple-channel.h"
25 #include "ns3/simple-net-device.h"
26 #include "ns3/simulator.h"
28 #include "ns3/traced-callback.h"
29 #include "ns3/uinteger.h"
45 void DoRun()
override;
57 :
TestCase(
"Packet Socket Apps test")
87 txDev = CreateObject<SimpleNetDevice>();
91 rxDev = CreateObject<SimpleNetDevice>();
106 client->SetRemote(socketAddr);
113 server->SetLocal(socketAddr);
117 Simulator::Destroy();
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.
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.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
Hold an unsigned integer type.
#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.