A Discrete-Event Network Simulator
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
19namespace 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 */
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 */
48
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 */
64
65 /**
66 * \param i index into the hub interfaces
67 *
68 * \returns Ipv4Address according to indexed hub interface
69 */
71
72 /**
73 * \param i index into the spoke interfaces
74 *
75 * \returns Ipv4Address according to indexed spoke interface
76 */
78
79 /**
80 * \param i index into the hub interfaces
81 *
82 * \returns Ipv6Address according to indexed hub interface
83 */
85
86 /**
87 * \param i index into the spoke interfaces
88 *
89 * \returns Ipv6Address according to indexed spoke interface
90 */
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 */
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 */
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 */
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.
Build a set of PointToPointNetDevice objects.
A helper to make it easier to create a star topology with PointToPoint links.
Ptr< Node > GetSpokeNode(uint32_t i) const
Ipv6InterfaceContainer m_hubInterfaces6
IPv6 hub interfaces.
void InstallStack(InternetStackHelper stack)
Ipv4Address GetSpokeIpv4Address(uint32_t i) const
NodeContainer m_spokes
Spoke nodes.
NetDeviceContainer m_hubDevices
Hub node NetDevices.
Ipv4InterfaceContainer m_spokeInterfaces
IPv4 spoke nodes interfaces.
PointToPointStarHelper(uint32_t numSpokes, PointToPointHelper p2pHelper)
Create a PointToPointStarHelper in order to easily create star topologies using p2p links.
Ipv4InterfaceContainer m_hubInterfaces
IPv4 hub interfaces.
Ipv4Address GetHubIpv4Address(uint32_t i) const
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
Ipv6Address GetSpokeIpv6Address(uint32_t i) const
void BoundingBox(double ulx, double uly, double lrx, double lry)
Sets up the node canvas locations for every node in the star.
void AssignIpv4Addresses(Ipv4AddressHelper address)
Ipv6Address GetHubIpv6Address(uint32_t i) const
Ipv6InterfaceContainer m_spokeInterfaces6
IPv6 spoke nodes interfaces.
NetDeviceContainer m_spokeDevices
Spoke nodes NetDevices.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.