19 #include "ns3/boolean.h" 
   20 #include "ns3/config.h" 
   21 #include "ns3/inet-socket-address.h" 
   22 #include "ns3/internet-stack-helper.h" 
   23 #include "ns3/ipv4-address-helper.h" 
   24 #include "ns3/ipv4-static-routing-helper.h" 
   26 #include "ns3/node-container.h" 
   27 #include "ns3/packet.h" 
   28 #include "ns3/pointer.h" 
   29 #include "ns3/simulator.h" 
   30 #include "ns3/string.h" 
   32 #include "ns3/uinteger.h" 
   33 #include "ns3/simple-net-device.h" 
   34 #include "ns3/simple-channel.h" 
   35 #include "ns3/simple-net-device-helper.h" 
   36 #include "ns3/socket-factory.h" 
   37 #include "ns3/udp-socket-factory.h" 
   60   void DoSendData (
Ptr<Socket> socket, std::string to);
 
   75   virtual void DoRun (
void);
 
   80   : 
TestCase (
"Slash 32 static routing example")
 
   91   uint32_t availableData;
 
  114   Simulator::Stop (
Seconds (66));
 
  141   deviceA->
SetAddress (Mac48Address::Allocate ());
 
  148   deviceC->
SetAddress (Mac48Address::Allocate ());
 
  149   nC->AddDevice (deviceC);
 
  153   ipv4.
SetBase (
"10.1.1.0", 
"255.255.255.252");
 
  156   ipv4.
SetBase (
"10.1.1.4", 
"255.255.255.252");
 
  164   int32_t ifIndexC = ipv4C->AddInterface (deviceC);
 
  169   ipv4A->
SetUp (ifIndexA);
 
  172   ipv4C->AddAddress (ifIndexC, ifInAddrC);
 
  173   ipv4C->SetMetric (ifIndexC, 1);
 
  174   ipv4C->SetUp (ifIndexC);
 
  201   Simulator::Destroy ();
 
  217   : 
TestSuite (
"ipv4-static-routing", UNIT)
 
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
 
static Ipv4StaticRoutingTestSuite ipv4StaticRoutingTestSuite
Static variable for test initialization. 
 
NetDeviceContainer Install(Ptr< Node > node) const 
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
 
holds a vector of std::pair of Ptr and interface index. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed. 
 
a class to represent an Ipv4 address mask 
 
Ptr< Packet > m_receivedPacket
Received packet. 
 
void DoSendData(Ptr< Socket > socket, std::string to)
Send data. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
aggregate IP/TCP/UDP functionality to existing Nodes. 
 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
virtual ~Ipv4StaticRoutingSlash32TestCase()
 
virtual Ptr< Socket > CreateSocket(void)=0
 
void AddHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a host route to the static routing table. 
 
a polymophic address class 
 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
 
virtual void SetUp(uint32_t interface)=0
 
void ReceivePkt(Ptr< Socket > socket)
Receive data. 
 
holds a vector of ns3::NetDevice pointers 
 
Ipv4StaticRoutingTestSuite()
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
Access to the IPv4 forwarding table, interfaces, and configuration. 
 
Ipv4StaticRoutingSlash32TestCase()
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
void SendData(Ptr< Socket > socket, std::string to)
Send data. 
 
keep track of a set of node pointers. 
 
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket. 
 
void Install(std::string nodeName) const 
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
 
IPv4 StaticRouting /32 Test. 
 
Ipv4 addresses are stored in host order in this class. 
 
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
 
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const 
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
 
uint32_t GetId(void) const 
 
a class to store IPv4 address information on an interface 
 
Helper class that adds ns3::Ipv4StaticRouting objects. 
 
virtual Ptr< Node > GetNode(void) const =0
Return the node this socket is associated with. 
 
virtual void SetAddress(Address address)
Set the address of this interface. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
 
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
 
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer. 
 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
 
API to create UDP socket instances. 
 
build a set of SimpleNetDevice objects 
 
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address. 
 
IPv4 StaticRouting /32 TestSuite. 
 
virtual uint32_t GetRxAvailable(void) const =0
Return number of bytes which can be returned from one or multiple calls to Recv.