A Discrete-Event Network Simulator
API
ns3::PointToPointGridHelper Class Reference

A helper to make it easier to create a grid topology with p2p links. More...

#include "point-to-point-grid.h"

+ Collaboration diagram for ns3::PointToPointGridHelper:

Public Member Functions

 PointToPointGridHelper (uint32_t nRows, uint32_t nCols, PointToPointHelper pointToPoint)
 Create a PointToPointGridHelper in order to easily create grid topologies using p2p links. More...
 
 ~PointToPointGridHelper ()
 
void AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp)
 Assigns Ipv4 addresses to all the row and column interfaces. More...
 
void AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix)
 Assigns Ipv6 addresses to all the row and column interfaces. More...
 
void BoundingBox (double ulx, double uly, double lrx, double lry)
 Sets up the node canvas locations for every node in the grid. More...
 
Ipv4Address GetIpv4Address (uint32_t row, uint32_t col)
 This returns an Ipv4 address at the node specified by the (row, col) address. More...
 
Ipv6Address GetIpv6Address (uint32_t row, uint32_t col)
 This returns an Ipv6 address at the node specified by the (row, col) address. More...
 
Ptr< NodeGetNode (uint32_t row, uint32_t col)
 
void InstallStack (InternetStackHelper stack)
 

Private Attributes

std::vector< NetDeviceContainerm_colDevices
 NetDevices in a column. More...
 
std::vector< Ipv4InterfaceContainerm_colInterfaces
 IPv4 interfaces in a column. More...
 
std::vector< Ipv6InterfaceContainerm_colInterfaces6
 IPv6 interfaces in a column. More...
 
std::vector< NodeContainerm_nodes
 all the nodes in the grid More...
 
std::vector< NetDeviceContainerm_rowDevices
 NetDevices in a row. More...
 
std::vector< Ipv4InterfaceContainerm_rowInterfaces
 IPv4 interfaces in a row. More...
 
std::vector< Ipv6InterfaceContainerm_rowInterfaces6
 IPv6 interfaces in a row. More...
 
uint32_t m_xSize
 X size of the grid (number of columns) More...
 
uint32_t m_ySize
 Y size of the grid (number of rows) More...
 

Detailed Description

A helper to make it easier to create a grid topology with p2p links.

Definition at line 42 of file point-to-point-grid.h.

Constructor & Destructor Documentation

◆ PointToPointGridHelper()

ns3::PointToPointGridHelper::PointToPointGridHelper ( uint32_t  nRows,
uint32_t  nCols,
PointToPointHelper  pointToPoint 
)

Create a PointToPointGridHelper in order to easily create grid topologies using p2p links.

Parameters
nRowstotal number of rows in the grid
nColstotal number of columns in the grid
pointToPointthe PointToPointHelper which is used to connect all of the nodes together in the grid

Definition at line 34 of file point-to-point-grid.cc.

References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Create(), ns3::NodeContainer::Get(), m_colDevices, m_nodes, m_rowDevices, m_xSize, m_ySize, NS_FATAL_ERROR, first::pointToPoint, and first::stack.

+ Here is the call graph for this function:

◆ ~PointToPointGridHelper()

ns3::PointToPointGridHelper::~PointToPointGridHelper ( )

Definition at line 80 of file point-to-point-grid.cc.

Member Function Documentation

◆ AssignIpv4Addresses()

void ns3::PointToPointGridHelper::AssignIpv4Addresses ( Ipv4AddressHelper  rowIp,
Ipv4AddressHelper  colIp 
)

Assigns Ipv4 addresses to all the row and column interfaces.

Parameters
rowIpthe Ipv4AddressHelper used to assign Ipv4 addresses to all of the row interfaces in the grid
colIpthe Ipv4AddressHelper used to assign Ipv4 addresses to all of the column interfaces in the grid

Definition at line 98 of file point-to-point-grid.cc.

References ns3::Ipv4InterfaceContainer::Add(), ns3::Ipv4AddressHelper::Assign(), ns3::NetDeviceContainer::Get(), ns3::NetDeviceContainer::GetN(), m_colDevices, m_colInterfaces, m_rowDevices, m_rowInterfaces, and ns3::Ipv4AddressHelper::NewNetwork().

+ Here is the call graph for this function:

◆ AssignIpv6Addresses()

void ns3::PointToPointGridHelper::AssignIpv6Addresses ( Ipv6Address  network,
Ipv6Prefix  prefix 
)

Assigns Ipv6 addresses to all the row and column interfaces.

Parameters
networkan IPv6 address representing the network portion of the IPv6 Address
prefixthe prefix length

Definition at line 136 of file point-to-point-grid.cc.

References ns3::Ipv6InterfaceContainer::Add(), ns3::Ipv6AddressHelper::Assign(), ns3::NetDeviceContainer::Get(), ns3::NetDeviceContainer::GetN(), ns3::Ipv6AddressGenerator::GetNetwork(), ns3::Ipv6AddressGenerator::Init(), m_colDevices, m_colInterfaces6, m_rowDevices, m_rowInterfaces6, ns3::Ipv6AddressGenerator::NextNetwork(), and ns3::Ipv6AddressHelper::SetBase().

+ Here is the call graph for this function:

◆ BoundingBox()

void ns3::PointToPointGridHelper::BoundingBox ( double  ulx,
double  uly,
double  lrx,
double  lry 
)

Sets up the node canvas locations for every node in the grid.

This is needed for use with the animation interface

Parameters
ulxupper left x value
ulyupper left y value
lrxlower right x value
lrylower right y value

Definition at line 186 of file point-to-point-grid.cc.

References ns3::Object::AggregateObject(), GetNode(), ns3::Object::GetObject(), m_xSize, and m_ySize.

+ Here is the call graph for this function:

◆ GetIpv4Address()

Ipv4Address ns3::PointToPointGridHelper::GetIpv4Address ( uint32_t  row,
uint32_t  col 
)

This returns an Ipv4 address at the node specified by the (row, col) address.

Technically, a node will have multiple interfaces in the grid; therefore, it also has multiple Ipv4 addresses. This method only returns one of the addresses. If you picture the grid, the address returned is the left row device of all the nodes, except the left-most grid nodes, which returns the right row device.

Parameters
rowthe row address of the node desired
colthe column address of the node desired
Returns
Ipv4Address of one of the interfaces of the node specified by the (row, col) address

Definition at line 244 of file point-to-point-grid.cc.

References m_nodes, m_rowInterfaces, and NS_FATAL_ERROR.

◆ GetIpv6Address()

Ipv6Address ns3::PointToPointGridHelper::GetIpv6Address ( uint32_t  row,
uint32_t  col 
)

This returns an Ipv6 address at the node specified by the (row, col) address.

Technically, a node will have multiple interfaces in the grid; therefore, it also has multiple Ipv6 addresses. This method only returns one of the addresses. If you picture the grid, the address returned is the left row device of all the nodes, except the left-most grid nodes, which returns the right row device.

Parameters
rowthe row address of the node desired
colthe column address of the node desired
Returns
Ipv6Address of one of the interfaces of the node specified by the (row, col) address

Definition at line 270 of file point-to-point-grid.cc.

References m_nodes, m_rowInterfaces6, and NS_FATAL_ERROR.

◆ GetNode()

Ptr< Node > ns3::PointToPointGridHelper::GetNode ( uint32_t  row,
uint32_t  col 
)
Parameters
rowthe row address of the node desired
colthe column address of the node desired
Returns
a pointer to the node specified by the (row, col) address

Definition at line 232 of file point-to-point-grid.cc.

References m_nodes, and NS_FATAL_ERROR.

Referenced by BoundingBox().

+ Here is the caller graph for this function:

◆ InstallStack()

void ns3::PointToPointGridHelper::InstallStack ( InternetStackHelper  stack)
Parameters
stackan InternetStackHelper which is used to install on every node in the grid

Definition at line 85 of file point-to-point-grid.cc.

References ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), m_nodes, and first::stack.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_colDevices

std::vector<NetDeviceContainer> ns3::PointToPointGridHelper::m_colDevices
private

NetDevices in a column.

Definition at line 150 of file point-to-point-grid.h.

Referenced by PointToPointGridHelper(), AssignIpv4Addresses(), and AssignIpv6Addresses().

◆ m_colInterfaces

std::vector<Ipv4InterfaceContainer> ns3::PointToPointGridHelper::m_colInterfaces
private

IPv4 interfaces in a column.

Definition at line 152 of file point-to-point-grid.h.

Referenced by AssignIpv4Addresses().

◆ m_colInterfaces6

std::vector<Ipv6InterfaceContainer> ns3::PointToPointGridHelper::m_colInterfaces6
private

IPv6 interfaces in a column.

Definition at line 154 of file point-to-point-grid.h.

Referenced by AssignIpv6Addresses().

◆ m_nodes

std::vector<NodeContainer> ns3::PointToPointGridHelper::m_nodes
private

all the nodes in the grid

Definition at line 155 of file point-to-point-grid.h.

Referenced by PointToPointGridHelper(), GetIpv4Address(), GetIpv6Address(), GetNode(), and InstallStack().

◆ m_rowDevices

std::vector<NetDeviceContainer> ns3::PointToPointGridHelper::m_rowDevices
private

NetDevices in a row.

Definition at line 149 of file point-to-point-grid.h.

Referenced by PointToPointGridHelper(), AssignIpv4Addresses(), and AssignIpv6Addresses().

◆ m_rowInterfaces

std::vector<Ipv4InterfaceContainer> ns3::PointToPointGridHelper::m_rowInterfaces
private

IPv4 interfaces in a row.

Definition at line 151 of file point-to-point-grid.h.

Referenced by AssignIpv4Addresses(), and GetIpv4Address().

◆ m_rowInterfaces6

std::vector<Ipv6InterfaceContainer> ns3::PointToPointGridHelper::m_rowInterfaces6
private

IPv6 interfaces in a row.

Definition at line 153 of file point-to-point-grid.h.

Referenced by AssignIpv6Addresses(), and GetIpv6Address().

◆ m_xSize

uint32_t ns3::PointToPointGridHelper::m_xSize
private

X size of the grid (number of columns)

Definition at line 147 of file point-to-point-grid.h.

Referenced by PointToPointGridHelper(), and BoundingBox().

◆ m_ySize

uint32_t ns3::PointToPointGridHelper::m_ySize
private

Y size of the grid (number of rows)

Definition at line 148 of file point-to-point-grid.h.

Referenced by PointToPointGridHelper(), and BoundingBox().


The documentation for this class was generated from the following files: