A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
csma-star-helper.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 CSMA_STAR_HELPER_H
19#define CSMA_STAR_HELPER_H
20
21#include "ns3/csma-helper.h"
22#include "ns3/internet-stack-helper.h"
23#include "ns3/ipv4-address-helper.h"
24#include "ns3/ipv4-interface-container.h"
25#include "ns3/ipv6-address-generator.h"
26#include "ns3/ipv6-address-helper.h"
27#include "ns3/ipv6-interface-container.h"
28
29#include <string>
30
31namespace ns3
32{
33
34/**
35 * \defgroup csmalayout CSMA Layout Helpers
36 *
37 */
38
39/**
40 * \ingroup csmalayout
41 *
42 * \brief A helper to make it easier to create a star topology
43 * with Csma links
44 */
46{
47 public:
48 /**
49 * Create a CsmaStarHelper in order to easily create
50 * star topologies using Csma links
51 *
52 * \param numSpokes the number of links attached to
53 * the hub node, creating a total of
54 * numSpokes + 1 nodes
55 *
56 * \param csmaHelper the link helper for Csma links,
57 * used to link nodes together
58 */
59 CsmaStarHelper(uint32_t numSpokes, CsmaHelper csmaHelper);
60
62
63 public:
64 /**
65 * \returns a node pointer to the hub node in the
66 * star, i.e., the center node
67 */
68 Ptr<Node> GetHub() const;
69
70 /**
71 * \param i an index into the spokes of the star
72 *
73 * \returns a node pointer to the node at the indexed spoke
74 */
76
77 /**
78 * \returns the net-device container which contains all of
79 * the devices on the hub node
80 */
82
83 /**
84 * \returns the net-device container which contains all of
85 * the spoke node devices
86 */
88
89 /**
90 * \param i index into the hub interfaces
91 *
92 * \returns Ipv4Address according to indexed hub interface
93 */
95
96 /**
97 * \param i index into the hub interfaces
98 *
99 * \returns Ipv6Address according to indexed hub interface
100 */
102
103 /**
104 * \param i index into the spoke interfaces
105 *
106 * \returns Ipv4Address according to indexed spoke interface
107 */
109
110 /**
111 * \param i index into the spoke interfaces
112 *
113 * \returns Ipv6Address according to indexed spoke interface
114 */
116
117 /**
118 * \returns the total number of spokes in the star
119 */
120 uint32_t SpokeCount() const;
121
122 /**
123 * \param stack an InternetStackHelper which is used to install
124 * on every node in the star
125 */
127
128 /**
129 * \param address an Ipv4AddressHelper which is used to install
130 * Ipv4 addresses on all the node interfaces in
131 * the star
132 */
134
135 /**
136 * \param network an IPv6 Address representing the network portion
137 * of the Ipv6 Address
138 * \param prefix the prefix length
139 */
140 void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix);
141
142 private:
143 NodeContainer m_hub; //!< NodeContainer for the hub node
144 NetDeviceContainer m_hubDevices; //!< NetDeviceContainer for the hub node NetDevices
145 NodeContainer m_spokes; //!< NodeContainer for the spokes nodes
146 NetDeviceContainer m_spokeDevices; //!< NetDeviceContainer for the spokes nodes NetDevices
147 Ipv4InterfaceContainer m_hubInterfaces; //!< Ipv4InterfaceContainer for the hub IPv4 interfaces
149 m_spokeInterfaces; //!< Ipv4InterfaceContainer for the spokes IPv4 interfaces
150 Ipv6InterfaceContainer m_hubInterfaces6; //!< Ipv6InterfaceContainer for the hub IPv6 interfaces
152 m_spokeInterfaces6; //!< Ipv6InterfaceContainer for the spokes IPv6 interfaces
153};
154
155} // namespace ns3
156
157#endif /* CSMA_STAR_HELPER_H */
build a set of CsmaNetDevice objects
Definition: csma-helper.h:48
A helper to make it easier to create a star topology with Csma links.
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
void InstallStack(InternetStackHelper stack)
Ipv6InterfaceContainer m_spokeInterfaces6
Ipv6InterfaceContainer for the spokes IPv6 interfaces.
NetDeviceContainer m_spokeDevices
NetDeviceContainer for the spokes nodes NetDevices.
Ipv4Address GetSpokeIpv4Address(uint32_t i) const
NodeContainer m_spokes
NodeContainer for the spokes nodes.
Ipv4Address GetHubIpv4Address(uint32_t i) const
Ipv6Address GetHubIpv6Address(uint32_t i) const
void AssignIpv4Addresses(Ipv4AddressHelper address)
Ptr< Node > GetSpokeNode(uint32_t i) const
Ptr< Node > GetHub() const
Ipv6InterfaceContainer m_hubInterfaces6
Ipv6InterfaceContainer for the hub IPv6 interfaces.
NetDeviceContainer m_hubDevices
NetDeviceContainer for the hub node NetDevices.
Ipv4InterfaceContainer m_hubInterfaces
Ipv4InterfaceContainer for the hub IPv4 interfaces.
NetDeviceContainer GetSpokeDevices() const
uint32_t SpokeCount() const
Ipv4InterfaceContainer m_spokeInterfaces
Ipv4InterfaceContainer for the spokes IPv4 interfaces.
NodeContainer m_hub
NodeContainer for the hub node.
NetDeviceContainer GetHubDevices() const
Ipv6Address GetSpokeIpv6Address(uint32_t i) const
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.
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.