A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
point-to-point-star.h
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 */
15
16// Define an object to create a star topology.
17
18#ifndef POINT_TO_POINT_STAR_HELPER_H
19#define POINT_TO_POINT_STAR_HELPER_H
20
21#include "ns3/internet-stack-helper.h"
22#include "ns3/ipv4-address-helper.h"
23#include "ns3/ipv4-interface-container.h"
24#include "ns3/ipv6-address-helper.h"
25#include "ns3/ipv6-interface-container.h"
26#include "ns3/point-to-point-helper.h"
27
28#include <string>
29
30namespace ns3
31{
32
33/**
34 * \defgroup point-to-point-layout Point-to-Point Layout Helpers
35 *
36 */
37
38/**
39 * \ingroup point-to-point-layout
40 *
41 * \brief A helper to make it easier to create a star topology
42 * with PointToPoint links
43 */
45{
46 public:
47 /**
48 * Create a PointToPointStarHelper in order to easily create
49 * star topologies using p2p links
50 *
51 * \param numSpokes the number of links attached to
52 * the hub node, creating a total of
53 * numSpokes + 1 nodes
54 *
55 * \param p2pHelper the link helper for p2p links,
56 * used to link nodes together
57 */
59
61
62 public:
63 /**
64 * \returns a node pointer to the hub node in the
65 * star, i.e., the center node
66 */
67 Ptr<Node> GetHub() const;
68
69 /**
70 * \param i an index into the spokes of the star
71 *
72 * \returns a node pointer to the node at the indexed spoke
73 */
75
76 /**
77 * \param i index into the hub interfaces
78 *
79 * \returns Ipv4Address according to indexed hub interface
80 */
82
83 /**
84 * \param i index into the spoke interfaces
85 *
86 * \returns Ipv4Address according to indexed spoke interface
87 */
89
90 /**
91 * \param i index into the hub interfaces
92 *
93 * \returns Ipv6Address according to indexed hub interface
94 */
96
97 /**
98 * \param i index into the spoke interfaces
99 *
100 * \returns Ipv6Address according to indexed spoke interface
101 */
103
104 /**
105 * \returns the total number of spokes in the star
106 */
107 uint32_t SpokeCount() const;
108
109 /**
110 * \param stack an InternetStackHelper which is used to install
111 * on every node in the star
112 */
114
115 /**
116 * \param address an Ipv4AddressHelper which is used to install
117 * Ipv4 addresses on all the node interfaces in
118 * the star
119 */
121
122 /**
123 * \param network an IPv6 address representing the network portion
124 * of the IPv6 Address
125 * \param prefix the prefix length
126 */
127 void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix);
128
129 /**
130 * Sets up the node canvas locations for every node in the star.
131 * This is needed for use with the animation interface
132 *
133 * \param ulx upper left x value
134 * \param uly upper left y value
135 * \param lrx lower right x value
136 * \param lry lower right y value
137 */
138 void BoundingBox(double ulx, double uly, double lrx, double lry);
139
140 private:
141 NodeContainer m_hub; //!< Hub node
142 NetDeviceContainer m_hubDevices; //!< Hub node NetDevices
143 NodeContainer m_spokes; //!< Spoke nodes
144 NetDeviceContainer m_spokeDevices; //!< Spoke nodes NetDevices
145 Ipv4InterfaceContainer m_hubInterfaces; //!< IPv4 hub interfaces
146 Ipv4InterfaceContainer m_spokeInterfaces; //!< IPv4 spoke nodes interfaces
147 Ipv6InterfaceContainer m_hubInterfaces6; //!< IPv6 hub interfaces
148 Ipv6InterfaceContainer m_spokeInterfaces6; //!< IPv6 spoke nodes interfaces
149};
150
151} // namespace ns3
152
153#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.
Definition: ipv4-address.h:42
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Describes an IPv6 address.
Definition: ipv6-address.h:49
Keep track of a set of IPv6 interfaces.
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
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
NodeContainer m_hub
Hub node.
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.
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.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.