A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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>

Public Member Functions

 PointToPointGridHelper (uint32_t nRows, uint32_t nCols, PointToPointHelper pointToPoint)
 
void AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp)
 
void AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix)
 
void BoundingBox (double ulx, double uly, double lrx, double lry)
 
Ipv4Address GetIpv4Address (uint32_t row, uint32_t col)
 
Ipv6Address GetIpv6Address (uint32_t row, uint32_t col)
 
Ptr< NodeGetNode (uint32_t row, uint32_t col)
 
void InstallStack (InternetStackHelper stack)
 

Private Attributes

std::vector< NetDeviceContainerm_colDevices
 
std::vector
< Ipv4InterfaceContainer
m_colInterfaces
 
std::vector
< Ipv6InterfaceContainer
m_colInterfaces6
 
std::vector< NodeContainerm_nodes
 
std::vector< NetDeviceContainerm_rowDevices
 
std::vector
< Ipv4InterfaceContainer
m_rowInterfaces
 
std::vector
< Ipv6InterfaceContainer
m_rowInterfaces6
 
uint32_t m_xSize
 
uint32_t m_ySize
 

Detailed Description

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

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

Constructor & Destructor Documentation

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 colums in the grid
pointToPointthe PointToPointHelper which is used to connect all of the nodes together in the grid

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

References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Create(), ns3::NodeContainer::Get(), and NS_FATAL_ERROR.

Member Function Documentation

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 row interfaces in the grid

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

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

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 134 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(), ns3::Ipv6AddressGenerator::NextNetwork(), and ns3::Ipv6AddressHelper::SetBase().

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 184 of file point-to-point-grid.cc.

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

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 242 of file point-to-point-grid.cc.

References NS_FATAL_ERROR.

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 268 of file point-to-point-grid.cc.

References NS_FATAL_ERROR.

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 230 of file point-to-point-grid.cc.

References NS_FATAL_ERROR.

Referenced by BoundingBox().

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

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

References ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), and ns3::InternetStackHelper::Install().


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