A Discrete-Event Network Simulator
API
point-to-point-grid.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: Josh Pelkey <jpelkey@gatech.edu>
17  */
18 
19 // Define an object to create a grid topology.
20 
21 #ifndef POINT_TO_POINT_GRID_HELPER_H
22 #define POINT_TO_POINT_GRID_HELPER_H
23 
24 #include <vector>
25 
26 #include "internet-stack-helper.h"
27 #include "point-to-point-helper.h"
28 #include "ipv4-address-helper.h"
29 #include "ipv6-address-helper.h"
32 #include "net-device-container.h"
33 
34 namespace ns3 {
35 
43 {
44 public:
57  PointToPointGridHelper (uint32_t nRows,
58  uint32_t nCols,
60 
62 
71  Ptr<Node> GetNode (uint32_t row, uint32_t col);
72 
89  Ipv4Address GetIpv4Address (uint32_t row, uint32_t col);
90 
107  Ipv6Address GetIpv6Address (uint32_t row, uint32_t col);
108 
114 
125 
133  void AssignIpv6Addresses (Ipv6Address network, Ipv6Prefix prefix);
134 
144  void BoundingBox (double ulx, double uly, double lrx, double lry);
145 
146 private:
147  uint32_t m_xSize;
148  uint32_t m_ySize;
149  std::vector<NetDeviceContainer> m_rowDevices;
150  std::vector<NetDeviceContainer> m_colDevices;
151  std::vector<Ipv4InterfaceContainer> m_rowInterfaces;
152  std::vector<Ipv4InterfaceContainer> m_colInterfaces;
153  std::vector<Ipv6InterfaceContainer> m_rowInterfaces6;
154  std::vector<Ipv6InterfaceContainer> m_colInterfaces6;
155  std::vector<NodeContainer> m_nodes;
156 };
157 
158 } // namespace ns3
159 
160 #endif /* POINT_TO_POINT_GRID_HELPER_H */
std::vector< NetDeviceContainer > m_colDevices
NetDevices in a column.
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.
uint32_t m_xSize
X size of the grid (number of columns)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to create a grid topology with p2p links.
Ipv6Address GetIpv6Address(uint32_t row, uint32_t col)
This returns an Ipv6 address at the node specified by the (row, col) address.
Build a set of PointToPointNetDevice objects.
Ptr< Node > GetNode(uint32_t row, uint32_t col)
stack
Definition: first.py:41
std::vector< NodeContainer > m_nodes
all the nodes in the grid
PointToPointGridHelper(uint32_t nRows, uint32_t nCols, PointToPointHelper pointToPoint)
Create a PointToPointGridHelper in order to easily create grid topologies using p2p links...
pointToPoint
Definition: first.py:35
std::vector< Ipv6InterfaceContainer > m_rowInterfaces6
IPv6 interfaces in a row.
std::vector< Ipv4InterfaceContainer > m_rowInterfaces
IPv4 interfaces in a row.
std::vector< NetDeviceContainer > m_rowDevices
NetDevices in a row.
Ipv4Address GetIpv4Address(uint32_t row, uint32_t col)
This returns an Ipv4 address at the node specified by the (row, col) address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< Ipv6InterfaceContainer > m_colInterfaces6
IPv6 interfaces in a column.
Describes an IPv6 address.
Definition: ipv6-address.h:49
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
void InstallStack(InternetStackHelper stack)
Describes an IPv6 prefix.
Definition: ipv6-address.h:466
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
uint32_t m_ySize
Y size of the grid (number of rows)
std::vector< Ipv4InterfaceContainer > m_colInterfaces
IPv4 interfaces in a column.
void BoundingBox(double ulx, double uly, double lrx, double lry)
Sets up the node canvas locations for every node in the grid.