19 #include "ns3/boolean.h"
20 #include "ns3/config.h"
21 #include "ns3/csma-helper.h"
22 #include "ns3/csma-net-device.h"
23 #include "ns3/inet-socket-address.h"
24 #include "ns3/internet-stack-helper.h"
25 #include "ns3/ipv4-address-helper.h"
26 #include "ns3/ipv4-static-routing-helper.h"
28 #include "ns3/node-container.h"
29 #include "ns3/on-off-helper.h"
30 #include "ns3/packet.h"
31 #include "ns3/packet-sink-helper.h"
32 #include "ns3/packet-sink.h"
33 #include "ns3/packet-socket-helper.h"
34 #include "ns3/packet-socket-address.h"
35 #include "ns3/point-to-point-helper.h"
36 #include "ns3/pointer.h"
37 #include "ns3/simulator.h"
38 #include "ns3/string.h"
40 #include "ns3/uinteger.h"
51 virtual void DoRun (
void);
56 :
TestCase (
"Slash 32 static routing example")
93 deviceA->
SetAddress (Mac48Address::Allocate ());
97 deviceC->
SetAddress (Mac48Address::Allocate ());
98 nC->AddDevice (deviceC);
102 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.252");
105 ipv4.
SetBase (
"10.1.1.4",
"255.255.255.252");
113 int32_t ifIndexC = ipv4C->AddInterface (deviceC);
118 ipv4A->
SetUp (ifIndexA);
121 ipv4C->AddAddress (ifIndexC, ifInAddrC);
122 ipv4C->SetMetric (ifIndexC, 1);
123 ipv4C->SetUp (ifIndexC);
140 apps.
Start (Seconds (1.0));
141 apps.
Stop (Seconds (10.0));
147 apps.
Start (Seconds (1.0));
148 apps.
Stop (Seconds (10.0));
154 Simulator::Destroy ();
holds a vector of ns3::Application pointers.
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
holds a vector of std::pair of Ptr and interface index.
Ipv4Address GetLocal(void) const
Get the local address.
hold variables of type string
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void AddHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a host route to the static routing table.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
Class for representing data rates.
virtual void SetUp(uint32_t interface)=0
holds a vector of ns3::NetDevice pointers
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Access to the Ipv4 forwarding table, interfaces, and configuration.
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr
stored in this container at a given index.
virtual ~StaticRoutingSlash32TestCase()
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
uint32_t GetTotalRx() const
static StaticRoutingTestSuite staticRoutingTestSuite
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Ipv4 addresses are stored in host order in this class.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
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)
a class to store IPv4 address information on an interface
Helper class that adds ns3::Ipv4StaticRouting objects.
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
virtual void SetAddress(Address address)
Set the address of this interface.
virtual bool AddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
StaticRoutingSlash32TestCase()
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ptr< T > GetObject(void) const
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.