A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
point-to-point-star.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: GPL-2.0-only
3
*/
4
5
// Define an object to create a star topology.
6
7
#ifndef POINT_TO_POINT_STAR_HELPER_H
8
#define POINT_TO_POINT_STAR_HELPER_H
9
10
#include "ns3/internet-stack-helper.h"
11
#include "ns3/ipv4-address-helper.h"
12
#include "ns3/ipv4-interface-container.h"
13
#include "ns3/ipv6-address-helper.h"
14
#include "ns3/ipv6-interface-container.h"
15
#include "ns3/point-to-point-helper.h"
16
17
#include <string>
18
19
namespace
ns3
20
{
21
22
/**
23
* \defgroup point-to-point-layout Point-to-Point Layout Helpers
24
*
25
*/
26
27
/**
28
* \ingroup point-to-point-layout
29
*
30
* \brief A helper to make it easier to create a star topology
31
* with PointToPoint links
32
*/
33
class
PointToPointStarHelper
34
{
35
public
:
36
/**
37
* Create a PointToPointStarHelper in order to easily create
38
* star topologies using p2p links
39
*
40
* \param numSpokes the number of links attached to
41
* the hub node, creating a total of
42
* numSpokes + 1 nodes
43
*
44
* \param p2pHelper the link helper for p2p links,
45
* used to link nodes together
46
*/
47
PointToPointStarHelper
(
uint32_t
numSpokes,
PointToPointHelper
p2pHelper);
48
49
~PointToPointStarHelper
();
50
51
public
:
52
/**
53
* \returns a node pointer to the hub node in the
54
* star, i.e., the center node
55
*/
56
Ptr<Node>
GetHub
()
const
;
57
58
/**
59
* \param i an index into the spokes of the star
60
*
61
* \returns a node pointer to the node at the indexed spoke
62
*/
63
Ptr<Node>
GetSpokeNode
(
uint32_t
i)
const
;
64
65
/**
66
* \param i index into the hub interfaces
67
*
68
* \returns Ipv4Address according to indexed hub interface
69
*/
70
Ipv4Address
GetHubIpv4Address
(
uint32_t
i)
const
;
71
72
/**
73
* \param i index into the spoke interfaces
74
*
75
* \returns Ipv4Address according to indexed spoke interface
76
*/
77
Ipv4Address
GetSpokeIpv4Address
(
uint32_t
i)
const
;
78
79
/**
80
* \param i index into the hub interfaces
81
*
82
* \returns Ipv6Address according to indexed hub interface
83
*/
84
Ipv6Address
GetHubIpv6Address
(
uint32_t
i)
const
;
85
86
/**
87
* \param i index into the spoke interfaces
88
*
89
* \returns Ipv6Address according to indexed spoke interface
90
*/
91
Ipv6Address
GetSpokeIpv6Address
(
uint32_t
i)
const
;
92
93
/**
94
* \returns the total number of spokes in the star
95
*/
96
uint32_t
SpokeCount
()
const
;
97
98
/**
99
* \param stack an InternetStackHelper which is used to install
100
* on every node in the star
101
*/
102
void
InstallStack
(
InternetStackHelper
stack);
103
104
/**
105
* \param address an Ipv4AddressHelper which is used to install
106
* Ipv4 addresses on all the node interfaces in
107
* the star
108
*/
109
void
AssignIpv4Addresses
(
Ipv4AddressHelper
address);
110
111
/**
112
* \param network an IPv6 address representing the network portion
113
* of the IPv6 Address
114
* \param prefix the prefix length
115
*/
116
void
AssignIpv6Addresses
(
Ipv6Address
network,
Ipv6Prefix
prefix);
117
118
/**
119
* Sets up the node canvas locations for every node in the star.
120
* This is needed for use with the animation interface
121
*
122
* \param ulx upper left x value
123
* \param uly upper left y value
124
* \param lrx lower right x value
125
* \param lry lower right y value
126
*/
127
void
BoundingBox
(
double
ulx,
double
uly,
double
lrx,
double
lry);
128
129
private
:
130
NodeContainer
m_hub
;
//!< Hub node
131
NetDeviceContainer
m_hubDevices
;
//!< Hub node NetDevices
132
NodeContainer
m_spokes
;
//!< Spoke nodes
133
NetDeviceContainer
m_spokeDevices
;
//!< Spoke nodes NetDevices
134
Ipv4InterfaceContainer
m_hubInterfaces
;
//!< IPv4 hub interfaces
135
Ipv4InterfaceContainer
m_spokeInterfaces
;
//!< IPv4 spoke nodes interfaces
136
Ipv6InterfaceContainer
m_hubInterfaces6
;
//!< IPv6 hub interfaces
137
Ipv6InterfaceContainer
m_spokeInterfaces6
;
//!< IPv6 spoke nodes interfaces
138
};
139
140
}
// namespace ns3
141
142
#endif
/* POINT_TO_POINT_STAR_HELPER_H */
ns3::InternetStackHelper
aggregate IP/TCP/UDP functionality to existing Nodes.
Definition
internet-stack-helper.h:81
ns3::Ipv4AddressHelper
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Definition
ipv4-address-helper.h:38
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition
ipv4-interface-container.h:45
ns3::Ipv6Address
Describes an IPv6 address.
Definition
ipv6-address.h:38
ns3::Ipv6InterfaceContainer
Keep track of a set of IPv6 interfaces.
Definition
ipv6-interface-container.h:29
ns3::Ipv6Prefix
Describes an IPv6 prefix.
Definition
ipv6-address.h:444
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::PointToPointHelper
Build a set of PointToPointNetDevice objects.
Definition
point-to-point-helper.h:33
ns3::PointToPointStarHelper
A helper to make it easier to create a star topology with PointToPoint links.
Definition
point-to-point-star.h:34
ns3::PointToPointStarHelper::GetSpokeNode
Ptr< Node > GetSpokeNode(uint32_t i) const
Definition
point-to-point-star.cc:49
ns3::PointToPointStarHelper::m_hub
NodeContainer m_hub
Hub node.
Definition
point-to-point-star.h:130
ns3::PointToPointStarHelper::m_hubInterfaces6
Ipv6InterfaceContainer m_hubInterfaces6
IPv6 hub interfaces.
Definition
point-to-point-star.h:136
ns3::PointToPointStarHelper::GetHub
Ptr< Node > GetHub() const
Definition
point-to-point-star.cc:43
ns3::PointToPointStarHelper::InstallStack
void InstallStack(InternetStackHelper stack)
Definition
point-to-point-star.cc:85
ns3::PointToPointStarHelper::GetSpokeIpv4Address
Ipv4Address GetSpokeIpv4Address(uint32_t i) const
Definition
point-to-point-star.cc:61
ns3::PointToPointStarHelper::m_spokes
NodeContainer m_spokes
Spoke nodes.
Definition
point-to-point-star.h:132
ns3::PointToPointStarHelper::m_hubDevices
NetDeviceContainer m_hubDevices
Hub node NetDevices.
Definition
point-to-point-star.h:131
ns3::PointToPointStarHelper::m_spokeInterfaces
Ipv4InterfaceContainer m_spokeInterfaces
IPv4 spoke nodes interfaces.
Definition
point-to-point-star.h:135
ns3::PointToPointStarHelper::PointToPointStarHelper
PointToPointStarHelper(uint32_t numSpokes, PointToPointHelper p2pHelper)
Create a PointToPointStarHelper in order to easily create star topologies using p2p links.
Definition
point-to-point-star.cc:25
ns3::PointToPointStarHelper::m_hubInterfaces
Ipv4InterfaceContainer m_hubInterfaces
IPv4 hub interfaces.
Definition
point-to-point-star.h:134
ns3::PointToPointStarHelper::SpokeCount
uint32_t SpokeCount() const
Definition
point-to-point-star.cc:79
ns3::PointToPointStarHelper::GetHubIpv4Address
Ipv4Address GetHubIpv4Address(uint32_t i) const
Definition
point-to-point-star.cc:55
ns3::PointToPointStarHelper::~PointToPointStarHelper
~PointToPointStarHelper()
Definition
point-to-point-star.cc:38
ns3::PointToPointStarHelper::AssignIpv6Addresses
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
Definition
point-to-point-star.cc:103
ns3::PointToPointStarHelper::GetSpokeIpv6Address
Ipv6Address GetSpokeIpv6Address(uint32_t i) const
Definition
point-to-point-star.cc:73
ns3::PointToPointStarHelper::BoundingBox
void BoundingBox(double ulx, double uly, double lrx, double lry)
Sets up the node canvas locations for every node in the star.
Definition
point-to-point-star.cc:124
ns3::PointToPointStarHelper::AssignIpv4Addresses
void AssignIpv4Addresses(Ipv4AddressHelper address)
Definition
point-to-point-star.cc:92
ns3::PointToPointStarHelper::GetHubIpv6Address
Ipv6Address GetHubIpv6Address(uint32_t i) const
Definition
point-to-point-star.cc:67
ns3::PointToPointStarHelper::m_spokeInterfaces6
Ipv6InterfaceContainer m_spokeInterfaces6
IPv6 spoke nodes interfaces.
Definition
point-to-point-star.h:137
ns3::PointToPointStarHelper::m_spokeDevices
NetDeviceContainer m_spokeDevices
Spoke nodes NetDevices.
Definition
point-to-point-star.h:133
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
point-to-point-layout
model
point-to-point-star.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0