author | Andrey Mazo <mazo@iitp.ru> |
Fri, 23 Apr 2010 15:09:31 +0400 | |
changeset 6273 | 8d70de29d514 |
parent 5859 | 41cff0992d09 |
permissions | -rw-r--r-- |
5776 | 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 |
#ifndef POINT_TO_POINT_GRID_HELPER_H |
|
20 |
#define POINT_TO_POINT_GRID_HELPER_H |
|
21 |
||
22 |
#include <vector> |
|
23 |
||
24 |
#include "internet-stack-helper.h" |
|
25 |
#include "point-to-point-helper.h" |
|
26 |
#include "ipv4-address-helper.h" |
|
27 |
#include "ipv4-interface-container.h" |
|
28 |
#include "net-device-container.h" |
|
29 |
||
30 |
namespace ns3 { |
|
31 |
||
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
32 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
33 |
* \brief A helper to make it easier to create a grid topology |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
34 |
* with p2p links |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
35 |
*/ |
5776 | 36 |
class PointToPointGridHelper |
37 |
{ |
|
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
38 |
public: |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
39 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
40 |
* Create a PointToPointGridHelper in order to easily create |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
41 |
* grid topologies using p2p links |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
42 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
43 |
* \param nRows total number of rows in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
44 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
45 |
* \param nCols total number of colums in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
46 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
47 |
* \param pointToPoint the PointToPointHelper which is used |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
48 |
* to connect all of the nodes together |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
49 |
* in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
50 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
51 |
PointToPointGridHelper (uint32_t nRows, |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
52 |
uint32_t nCols, |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
53 |
PointToPointHelper pointToPoint); |
5776 | 54 |
|
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
55 |
~PointToPointGridHelper (); |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
56 |
|
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
57 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
58 |
* \param row the row address of the node desired |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
59 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
60 |
* \param col the column address of the node desired |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
61 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
62 |
* \returns a pointer to the node specified by the |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
63 |
* (row, col) address |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
64 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
65 |
Ptr<Node> GetNode (uint32_t row, uint32_t col); |
5776 | 66 |
|
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
67 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
68 |
* This returns an Ipv4 address at the node specified by |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
69 |
* the (row, col) address. Technically, a node will have |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
70 |
* multiple interfaces in the grid; therefore, it also has |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
71 |
* multiple Ipv4 addresses. This method only returns one of |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
72 |
* the addresses. If you picture the grid, the address returned |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
73 |
* is the left row device of all the nodes, except the left-most |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
74 |
* grid nodes, which returns the right row device. |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
75 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
76 |
* \param row the row address of the node desired |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
77 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
78 |
* \param col the column address of the node desired |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
79 |
* |
6273
8d70de29d514
spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents:
5859
diff
changeset
|
80 |
* \returns Ipv4Address of one of the interfaces of the node |
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
81 |
* specified by the (row, col) address |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
82 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
83 |
Ipv4Address GetIpv4Address (uint32_t row, uint32_t col); |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
84 |
|
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
85 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
86 |
* \param stack an InternetStackHelper which is used to install |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
87 |
* on every node in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
88 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
89 |
void InstallStack (InternetStackHelper stack); |
5776 | 90 |
|
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
91 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
92 |
* Assigns Ipv4 addresses to all the row and column interfaces |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
93 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
94 |
* \param rowIp the Ipv4AddressHelper used to assign Ipv4 addresses |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
95 |
* to all of the row interfaces in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
96 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
97 |
* \param colIp the Ipv4AddressHelper used to assign Ipv4 addresses |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
98 |
* to all of the row interfaces in the grid |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
99 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
100 |
void AssignIpv4Addresses (Ipv4AddressHelper rowIp, Ipv4AddressHelper colIp); |
5776 | 101 |
|
5859
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
102 |
/** |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
103 |
* Sets up the node canvas locations for every node in the grid. |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
104 |
* This is needed for use with the animation interface |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
105 |
* |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
106 |
* \param ulx upper left x value |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
107 |
* \param uly upper left y value |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
108 |
* \param lrx lower right x value |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
109 |
* \param lry lower right y value |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
110 |
*/ |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
111 |
void BoundingBox (double ulx, double uly, double lrx, double lry); |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
112 |
|
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
113 |
private: |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
114 |
uint32_t m_xSize; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
115 |
uint32_t m_ySize; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
116 |
std::vector<NetDeviceContainer> m_rowDevices; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
117 |
std::vector<NetDeviceContainer> m_colDevices; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
118 |
std::vector<Ipv4InterfaceContainer> m_rowInterfaces; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
119 |
std::vector<Ipv4InterfaceContainer> m_colInterfaces; |
41cff0992d09
Added documentation for animation interface
Josh Pelkey <jpelkey@gatech.edu>
parents:
5776
diff
changeset
|
120 |
std::vector<NodeContainer> m_nodes; |
5776 | 121 |
}; |
122 |
||
123 |
} // namespace ns3 |
|
124 |
||
125 |
#endif /* POINT_TO_POINT_GRID_HELPER_H */ |