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) | |
Create a PointToPointGridHelper in order to easily create grid topologies using p2p links. | |
~PointToPointGridHelper () | |
void | AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp) |
Assigns Ipv4 addresses to all the row and column interfaces. | |
void | AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix) |
Assigns Ipv6 addresses to all the row and column interfaces. | |
void | BoundingBox (double ulx, double uly, double lrx, double lry) |
Sets up the node canvas locations for every node in the grid. | |
Ipv4Address | GetIpv4Address (uint32_t row, uint32_t col) |
This returns an Ipv4 address at the node specified by the (row, col) address. | |
Ipv6Address | GetIpv6Address (uint32_t row, uint32_t col) |
This returns an Ipv6 address at the node specified by the (row, col) address. | |
Ptr< Node > | GetNode (uint32_t row, uint32_t col) |
void | InstallStack (InternetStackHelper stack) |
Private Attributes | |
std::vector< NetDeviceContainer > | m_colDevices |
NetDevices in a column. | |
std::vector< Ipv4InterfaceContainer > | m_colInterfaces |
IPv4 interfaces in a column. | |
std::vector< Ipv6InterfaceContainer > | m_colInterfaces6 |
IPv6 interfaces in a column. | |
std::vector< NodeContainer > | m_nodes |
all the nodes in the grid | |
std::vector< NetDeviceContainer > | m_rowDevices |
NetDevices in a row. | |
std::vector< Ipv4InterfaceContainer > | m_rowInterfaces |
IPv4 interfaces in a row. | |
std::vector< Ipv6InterfaceContainer > | m_rowInterfaces6 |
IPv6 interfaces in a row. | |
uint32_t | m_xSize |
X size of the grid (number of columns) | |
uint32_t | m_ySize |
Y size of the grid (number of rows) | |
A helper to make it easier to create a grid topology with p2p links.
Definition at line 31 of file point-to-point-grid.h.
ns3::PointToPointGridHelper::PointToPointGridHelper | ( | uint32_t | nRows, |
uint32_t | nCols, | ||
PointToPointHelper | pointToPoint ) |
Create a PointToPointGridHelper in order to easily create grid topologies using p2p links.
nRows | total number of rows in the grid |
nCols | total number of columns in the grid |
pointToPoint | the PointToPointHelper which is used to connect all of the nodes together in the grid |
Definition at line 24 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, and NS_FATAL_ERROR.
ns3::PointToPointGridHelper::~PointToPointGridHelper | ( | ) |
Definition at line 71 of file point-to-point-grid.cc.
void ns3::PointToPointGridHelper::AssignIpv4Addresses | ( | Ipv4AddressHelper | rowIp, |
Ipv4AddressHelper | colIp ) |
Assigns Ipv4 addresses to all the row and column interfaces.
rowIp | the Ipv4AddressHelper used to assign Ipv4 addresses to all of the row interfaces in the grid |
colIp | the Ipv4AddressHelper used to assign Ipv4 addresses to all of the column interfaces in the grid |
Definition at line 89 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().
void ns3::PointToPointGridHelper::AssignIpv6Addresses | ( | Ipv6Address | network, |
Ipv6Prefix | prefix ) |
Assigns Ipv6 addresses to all the row and column interfaces.
network | an IPv6 address representing the network portion of the IPv6 Address |
prefix | the prefix length |
Definition at line 127 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().
Sets up the node canvas locations for every node in the grid.
This is needed for use with the animation interface
ulx | upper left x value |
uly | upper left y value |
lrx | lower right x value |
lry | lower right y value |
Definition at line 177 of file point-to-point-grid.cc.
References ns3::CreateObject(), GetNode(), m_xSize, and m_ySize.
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.
row | the row address of the node desired |
col | the column address of the node desired |
Definition at line 234 of file point-to-point-grid.cc.
References m_nodes, m_rowInterfaces, and 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.
row | the row address of the node desired |
col | the column address of the node desired |
Definition at line 259 of file point-to-point-grid.cc.
References m_nodes, m_rowInterfaces6, and NS_FATAL_ERROR.
row | the row address of the node desired |
col | the column address of the node desired |
Definition at line 223 of file point-to-point-grid.cc.
References m_nodes, and NS_FATAL_ERROR.
Referenced by BoundingBox().
void ns3::PointToPointGridHelper::InstallStack | ( | InternetStackHelper | stack | ) |
stack | an InternetStackHelper which is used to install on every node in the grid |
Definition at line 76 of file point-to-point-grid.cc.
References ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), and m_nodes.
|
private |
NetDevices in a column.
Definition at line 137 of file point-to-point-grid.h.
Referenced by PointToPointGridHelper(), AssignIpv4Addresses(), and AssignIpv6Addresses().
|
private |
IPv4 interfaces in a column.
Definition at line 139 of file point-to-point-grid.h.
Referenced by AssignIpv4Addresses().
|
private |
IPv6 interfaces in a column.
Definition at line 141 of file point-to-point-grid.h.
Referenced by AssignIpv6Addresses().
|
private |
all the nodes in the grid
Definition at line 142 of file point-to-point-grid.h.
Referenced by PointToPointGridHelper(), GetIpv4Address(), GetIpv6Address(), GetNode(), and InstallStack().
|
private |
NetDevices in a row.
Definition at line 136 of file point-to-point-grid.h.
Referenced by PointToPointGridHelper(), AssignIpv4Addresses(), and AssignIpv6Addresses().
|
private |
IPv4 interfaces in a row.
Definition at line 138 of file point-to-point-grid.h.
Referenced by AssignIpv4Addresses(), and GetIpv4Address().
|
private |
IPv6 interfaces in a row.
Definition at line 140 of file point-to-point-grid.h.
Referenced by AssignIpv6Addresses(), and GetIpv6Address().
|
private |
X size of the grid (number of columns)
Definition at line 134 of file point-to-point-grid.h.
Referenced by PointToPointGridHelper(), and BoundingBox().
|
private |
Y size of the grid (number of rows)
Definition at line 135 of file point-to-point-grid.h.
Referenced by PointToPointGridHelper(), and BoundingBox().