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