A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
point-to-point-dumbbell.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Author: George F. Riley<riley@ece.gatech.edu>
5 */
6
7// Define an object to create a dumbbell topology.
8
9#ifndef POINT_TO_POINT_DUMBBELL_HELPER_H
10#define POINT_TO_POINT_DUMBBELL_HELPER_H
11
12#include "ns3/internet-stack-helper.h"
13#include "ns3/ipv4-address-helper.h"
14#include "ns3/ipv4-interface-container.h"
15#include "ns3/ipv6-address-helper.h"
16#include "ns3/ipv6-interface-container.h"
17#include "ns3/point-to-point-helper.h"
18
19#include <string>
20
21namespace ns3
22{
23
24/**
25 * \ingroup point-to-point-layout
26 *
27 * \brief A helper to make it easier to create a dumbbell topology
28 * with p2p links
29 */
31{
32 public:
33 /**
34 * Create a PointToPointDumbbellHelper in order to easily create
35 * dumbbell topologies using p2p links
36 *
37 * \param nLeftLeaf number of left side leaf nodes in the dumbbell
38 *
39 * \param leftHelper PointToPointHelper used to install the links
40 * between the left leaf nodes and the left-most
41 * router
42 *
43 * \param nRightLeaf number of right side leaf nodes in the dumbbell
44 *
45 * \param rightHelper PointToPointHelper used to install the links
46 * between the right leaf nodes and the right-most
47 * router
48 *
49 * \param bottleneckHelper PointToPointHelper used to install the link
50 * between the inner-routers, usually known as
51 * the bottleneck link
52 */
54 PointToPointHelper leftHelper,
55 uint32_t nRightLeaf,
56 PointToPointHelper rightHelper,
57 PointToPointHelper bottleneckHelper);
58
60
61 public:
62 /**
63 * \returns pointer to the node of the left side bottleneck
64 * router
65 */
66 Ptr<Node> GetLeft() const;
67
68 /**
69 * \returns pointer to the i'th left side leaf node
70 * \param i node number
71 */
72 Ptr<Node> GetLeft(uint32_t i) const;
73
74 /**
75 * \returns pointer to the node of the right side bottleneck
76 * router
77 */
78 Ptr<Node> GetRight() const;
79
80 /**
81 * \returns pointer to the i'th right side leaf node
82 * \param i node number
83 */
85
86 /**
87 * \returns an Ipv4Address of the i'th left leaf
88 * \param i node number
89 */
90 Ipv4Address GetLeftIpv4Address(uint32_t i) const; // Get left leaf address
91
92 /**
93 * \returns an Ipv4Address of the i'th right leaf
94 * \param i node number
95 */
96 Ipv4Address GetRightIpv4Address(uint32_t i) const; // Get right leaf address
97
98 /**
99 * \returns an Ipv6Address of the i'th left leaf
100 * \param i node number
101 */
102 Ipv6Address GetLeftIpv6Address(uint32_t i) const; // Get left leaf address
103
104 /**
105 * \returns an Ipv6Address of the i'th right leaf
106 * \param i node number
107 */
108 Ipv6Address GetRightIpv6Address(uint32_t i) const; // Get right leaf address
109
110 /**
111 * \returns total number of left side leaf nodes
112 */
113 uint32_t LeftCount() const;
114
115 /**
116 * \returns total number of right side leaf nodes
117 */
118 uint32_t RightCount() const;
119
120 /**
121 * \param stack an InternetStackHelper which is used to install
122 * on every node in the dumbbell
123 */
125
126 /**
127 * \param leftIp Ipv4AddressHelper to assign Ipv4 addresses to the
128 * interfaces on the left side of the dumbbell
129 *
130 * \param rightIp Ipv4AddressHelper to assign Ipv4 addresses to the
131 * interfaces on the right side of the dumbbell
132 *
133 * \param routerIp Ipv4AddressHelper to assign Ipv4 addresses to the
134 * interfaces on the bottleneck link
135 */
137 Ipv4AddressHelper rightIp,
138 Ipv4AddressHelper routerIp);
139
140 /**
141 * \param network an IPv6 address representing the network portion
142 * of the IPv6 Address
143 * \param prefix the prefix length
144 */
145 void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix);
146
147 /**
148 * Sets up the node canvas locations for every node in the dumbbell.
149 * This is needed for use with the animation interface
150 *
151 * \param ulx upper left x value
152 * \param uly upper left y value
153 * \param lrx lower right x value
154 * \param lry lower right y value
155 */
156 void BoundingBox(double ulx, double uly, double lrx, double lry) const;
157
158 private:
159 NodeContainer m_leftLeaf; //!< Left Leaf nodes
160 NetDeviceContainer m_leftLeafDevices; //!< Left Leaf NetDevices
161 NodeContainer m_rightLeaf; //!< Right Leaf nodes
162 NetDeviceContainer m_rightLeafDevices; //!< Right Leaf NetDevices
164 NetDeviceContainer m_routerDevices; //!< Routers NetDevices
165 NetDeviceContainer m_leftRouterDevices; //!< Left router NetDevices
166 NetDeviceContainer m_rightRouterDevices; //!< Right router NetDevices
167 Ipv4InterfaceContainer m_leftLeafInterfaces; //!< Left Leaf interfaces (IPv4)
168 Ipv4InterfaceContainer m_leftRouterInterfaces; //!< Left router interfaces (IPv4)
169 Ipv4InterfaceContainer m_rightLeafInterfaces; //!< Right Leaf interfaces (IPv4)
170 Ipv4InterfaceContainer m_rightRouterInterfaces; //!< Right router interfaces (IPv4)
171 Ipv4InterfaceContainer m_routerInterfaces; //!< Router interfaces (IPv4)
172 Ipv6InterfaceContainer m_leftLeafInterfaces6; //!< Left Leaf interfaces (IPv6)
173 Ipv6InterfaceContainer m_leftRouterInterfaces6; //!< Left router interfaces (IPv6)
174 Ipv6InterfaceContainer m_rightLeafInterfaces6; //!< Right Leaf interfaces (IPv6)
175 Ipv6InterfaceContainer m_rightRouterInterfaces6; //!< Right router interfaces (IPv6)
176 Ipv6InterfaceContainer m_routerInterfaces6; //!< Router interfaces (IPv6)
177};
178
179} // namespace ns3
180
181#endif /* POINT_TO_POINT_DUMBBELL_HELPER_H */
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Describes an IPv6 address.
Keep track of a set of IPv6 interfaces.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
A helper to make it easier to create a dumbbell topology with p2p links.
Ipv6InterfaceContainer m_leftLeafInterfaces6
Left Leaf interfaces (IPv6)
Ipv6InterfaceContainer m_rightLeafInterfaces6
Right Leaf interfaces (IPv6)
Ipv4InterfaceContainer m_rightRouterInterfaces
Right router interfaces (IPv4)
PointToPointDumbbellHelper(uint32_t nLeftLeaf, PointToPointHelper leftHelper, uint32_t nRightLeaf, PointToPointHelper rightHelper, PointToPointHelper bottleneckHelper)
Create a PointToPointDumbbellHelper in order to easily create dumbbell topologies using p2p links.
NetDeviceContainer m_leftRouterDevices
Left router NetDevices.
Ipv6InterfaceContainer m_rightRouterInterfaces6
Right router interfaces (IPv6)
Ipv4InterfaceContainer m_routerInterfaces
Router interfaces (IPv4)
void AssignIpv4Addresses(Ipv4AddressHelper leftIp, Ipv4AddressHelper rightIp, Ipv4AddressHelper routerIp)
NetDeviceContainer m_routerDevices
Routers NetDevices.
NetDeviceContainer m_rightRouterDevices
Right router NetDevices.
NodeContainer m_rightLeaf
Right Leaf nodes.
Ipv4InterfaceContainer m_leftRouterInterfaces
Left router interfaces (IPv4)
Ipv4Address GetRightIpv4Address(uint32_t i) const
Ipv6Address GetLeftIpv6Address(uint32_t i) const
Ipv4Address GetLeftIpv4Address(uint32_t i) const
void InstallStack(InternetStackHelper stack)
Ipv6InterfaceContainer m_leftRouterInterfaces6
Left router interfaces (IPv6)
NetDeviceContainer m_leftLeafDevices
Left Leaf NetDevices.
Ipv6Address GetRightIpv6Address(uint32_t i) const
Ipv6InterfaceContainer m_routerInterfaces6
Router interfaces (IPv6)
Ipv4InterfaceContainer m_rightLeafInterfaces
Right Leaf interfaces (IPv4)
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
NodeContainer m_leftLeaf
Left Leaf nodes.
NetDeviceContainer m_rightLeafDevices
Right Leaf NetDevices.
void BoundingBox(double ulx, double uly, double lrx, double lry) const
Sets up the node canvas locations for every node in the dumbbell.
Ipv4InterfaceContainer m_leftLeafInterfaces
Left Leaf interfaces (IPv4)
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.