|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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 AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void ReceivePkt(Ptr< const Packet > packet, const Address &from)
Receive a packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PacketSocketAppsTestSuite()
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
an address for a packet socket
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
static PacketSocketAppsTestSuite g_packetSocketAppsTestSuite
Static variable for test initialization.
virtual Address GetAddress(void) const
a polymophic address class
PacketSocket apps Unit Test.
PacketSocket apps TestSuite.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
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...
uint32_t m_receivedPacketSize
Received packet size.
virtual void SetNode(Ptr< Node > node)
virtual void DoRun(void)
Implementation to actually run this TestCase.
@ UNIT
This test suite implements a Unit Test.
void SetPhysicalAddress(const Address address)
Set the destination address.
keep track of a set of node pointers.
void SetProtocol(uint16_t protocol)
Set the protocol.
Hold an unsigned integer type.
uint32_t m_receivedPacketNumber
Number of received packets.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
virtual uint32_t GetIfIndex(void) const