11#include "ns3/constant-position-mobility-model.h"
12#include "ns3/internet-stack-helper.h"
13#include "ns3/ipv6-address-generator.h"
15#include "ns3/point-to-point-helper.h"
16#include "ns3/string.h"
17#include "ns3/vector.h"
51 rowDevices.
Add(pointToPoint.Install(rowNodes.
Get(x - 1), rowNodes.
Get(x)));
57 colDevices.
Add(pointToPoint.Install((
m_nodes.at(y - 1)).Get(x), rowNodes.
Get(x)));
83 stack.Install(rowNodes.
Get(j));
102 rowInterfaces.
Add(rowIp.
Assign(rowContainer.
Get(j + 1)));
119 colInterfaces.
Add(colIp.
Assign(colContainer.
Get(j + 1)));
144 addrHelper.
SetBase(v6network, prefix);
146 rowInterfaces.
Add(ic);
147 ic = addrHelper.
Assign(rowContainer.
Get(j + 1));
148 rowInterfaces.
Add(ic);
165 addrHelper.
SetBase(v6network, prefix);
167 colInterfaces.
Add(ic);
168 ic = addrHelper.
Assign(colContainer.
Get(j + 1));
169 colInterfaces.
Add(ic);
197 double xAdder = xDist /
m_xSize;
198 double yAdder = yDist /
m_ySize;
199 double yLoc = yDist / 2;
202 double xLoc = xDist / 2;
211 node->AggregateObject(loc);
213 Vector locVec(xLoc, yLoc, 0);
214 loc->SetPosition(locVec);
227 NS_FATAL_ERROR(
"Index out of bounds in PointToPointGridHelper::GetNode.");
230 return (
m_nodes.at(row)).Get(col);
238 NS_FATAL_ERROR(
"Index out of bounds in PointToPointGridHelper::GetIpv4Address.");
263 NS_FATAL_ERROR(
"Index out of bounds in PointToPointGridHelper::GetIpv6Address.");
Mobility model for which the current position does not change once it has been set and until it is se...
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4Address NewNetwork()
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void Add(const Ipv4InterfaceContainer &other)
Concatenate the entries in the other container with ours.
static void Init(const Ipv6Address net, const Ipv6Prefix prefix, const Ipv6Address interfaceId="::1")
Initialise the base network and interfaceId for the generator.
static Ipv6Address GetNetwork(const Ipv6Prefix prefix)
Get the current network of the given Ipv6Prefix.
static Ipv6Address NextNetwork(const Ipv6Prefix prefix)
Get the next network according to the given Ipv6Prefix.
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
Keep track of a set of IPv6 interfaces.
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
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.
std::vector< Ipv6InterfaceContainer > m_colInterfaces6
IPv6 interfaces in a column.
void InstallStack(InternetStackHelper stack)
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
Assigns Ipv6 addresses to all the row and column interfaces.
Ipv4Address GetIpv4Address(uint32_t row, uint32_t col)
This returns an Ipv4 address at the node specified by the (row, col) address.
Ptr< Node > GetNode(uint32_t row, uint32_t col)
uint32_t m_ySize
Y size of the grid (number of rows)
~PointToPointGridHelper()
Ipv6Address GetIpv6Address(uint32_t row, uint32_t col)
This returns an Ipv6 address at the node specified by the (row, col) address.
std::vector< NodeContainer > m_nodes
all the nodes in the grid
std::vector< NetDeviceContainer > m_colDevices
NetDevices in a column.
std::vector< NetDeviceContainer > m_rowDevices
NetDevices in a row.
std::vector< Ipv6InterfaceContainer > m_rowInterfaces6
IPv6 interfaces in a row.
void BoundingBox(double ulx, double uly, double lrx, double lry)
Sets up the node canvas locations for every node in the grid.
std::vector< Ipv4InterfaceContainer > m_colInterfaces
IPv4 interfaces in a column.
void AssignIpv4Addresses(Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp)
Assigns Ipv4 addresses to all the row and column interfaces.
uint32_t m_xSize
X size of the grid (number of columns)
PointToPointGridHelper(uint32_t nRows, uint32_t nCols, PointToPointHelper pointToPoint)
Create a PointToPointGridHelper in order to easily create grid topologies using p2p links.
std::vector< Ipv4InterfaceContainer > m_rowInterfaces
IPv4 interfaces in a row.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Every class exported by the ns3 library is enclosed in the ns3 namespace.