22 #include "ns3/simulator.h"    23 #include "ns3/uinteger.h"    24 #include "ns3/traced-callback.h"    25 #include "ns3/packet.h"    26 #include "ns3/packet-socket-helper.h"    27 #include "ns3/packet-socket-client.h"    28 #include "ns3/packet-socket-server.h"    29 #include "ns3/simple-net-device.h"    30 #include "ns3/simple-channel.h"    47   virtual void DoRun (
void);
    59   : 
TestCase (
"Packet Socket Apps test")
    89   txDev = CreateObject<SimpleNetDevice> ();
    90   nodes.Get (0)->AddDevice (txDev);
    93   rxDev = CreateObject<SimpleNetDevice> ();
    94   nodes.Get (1)->AddDevice (rxDev);
   112   nodes.Get (0)->AddApplication (client);
   117   nodes.Get (1)->AddApplication (server);
   121   Simulator::Destroy ();
 
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used 
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
PacketSocketAppsTestSuite()
static PacketSocketAppsTestSuite g_packetSocketAppsTestSuite
Static variable for test initialization. 
an address for a packet socket 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
PacketSocket apps TestSuite. 
uint32_t m_receivedPacketNumber
Number of received packets. 
Give ns3::PacketSocket powers to ns3::Node. 
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice. 
a polymophic address class 
virtual void SetNode(Ptr< Node > node)
PacketSocket apps Unit Test. 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
Hold an unsigned integer type. 
virtual Address GetAddress(void) const
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
void SetPhysicalAddress(const Address address)
Set the destination address. 
keep track of a set of node pointers. 
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used 
uint32_t m_receivedPacketSize
Received packet size. 
void SetProtocol(uint16_t protocol)
Set the protocol. 
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node. 
virtual uint32_t GetIfIndex(void) const
This test suite implements a Unit Test. 
void ReceivePkt(Ptr< const Packet > packet, const Address &from)
Receive a packet. 
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device. 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
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...