A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mesh-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008,2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Kirill Andreev <andreev@iitp.ru>
18 * Pavel Boyko <boyko@iitp.ru>
19 */
20
21#ifndef MESH_HELPER_H
22#define MESH_HELPER_H
23
24#include "ns3/mesh-stack-installer.h"
25#include "ns3/object-factory.h"
26#include "ns3/qos-utils.h"
27#include "ns3/wifi-standards.h"
28
29namespace ns3
30{
31
32class NetDeviceContainer;
33class WifiPhyHelper;
34class WifiNetDevice;
35class NodeContainer;
36
43{
44 public:
48 MeshHelper();
49
54
60 static MeshHelper Default();
61
71 template <typename... Ts>
72 void SetMacType(Ts&&... args);
83 template <typename... Ts>
84 void SetRemoteStationManager(std::string type, Ts&&... args);
89 void SetStandard(WifiStandard standard);
90
92 // void SetMeshId (std::string s);
100 {
103 };
104
114 void SetNumberOfInterfaces(uint32_t nInterfaces);
115
124 NetDeviceContainer Install(const WifiPhyHelper& phyHelper, NodeContainer c) const;
132 template <typename... Ts>
133 void SetStackInstaller(std::string type, Ts&&... args);
134
141 void Report(const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os);
142
147 void ResetStats(const ns3::Ptr<ns3::NetDevice>& device);
159 int64_t AssignStreams(NetDeviceContainer c, int64_t stream);
160
164 static void EnableLogComponents();
165
166 private:
174 Ptr<Node> node,
175 uint16_t channelId) const;
180
181 // Interface factory
186};
187
188/***************************************************************
189 * Implementation of the templates declared above.
190 ***************************************************************/
191
192template <typename... Ts>
193void
195{
196 m_mac.SetTypeId("ns3::MeshWifiInterfaceMac");
197 m_mac.Set(std::forward<Ts>(args)...);
198}
199
200template <typename... Ts>
201void
202MeshHelper::SetRemoteStationManager(std::string type, Ts&&... args)
203{
204 m_stationManager = ObjectFactory(type, std::forward<Ts>(args)...);
205}
206
207template <typename... Ts>
208void
209MeshHelper::SetStackInstaller(std::string type, Ts&&... args)
210{
212 m_stackFactory.Set(std::forward<Ts>(args)...);
214 if (!m_stack)
215 {
216 NS_FATAL_ERROR("Stack has not been created: " << type);
217 }
218}
219
220} // namespace ns3
221
222#endif /* MESH_HELPER_H */
Helper to create IEEE 802.11s mesh networks.
Definition: mesh-helper.h:43
void SetRemoteStationManager(std::string type, Ts &&... args)
Set the remote station manager type and Attributes.
Definition: mesh-helper.h:202
void SetStandard(WifiStandard standard)
Set standard.
Definition: mesh-helper.cc:108
ObjectFactory m_stackFactory
stack factory
Definition: mesh-helper.h:179
Ptr< WifiNetDevice > CreateInterface(const WifiPhyHelper &phyHelper, Ptr< Node > node, uint16_t channelId) const
Definition: mesh-helper.cc:114
Ptr< MeshStack > m_stack
stack
Definition: mesh-helper.h:178
~MeshHelper()
Destroy a MeshHelper.
Definition: mesh-helper.cc:45
uint32_t m_nInterfaces
number of interfaces
Definition: mesh-helper.h:176
ObjectFactory m_stationManager
the station manager
Definition: mesh-helper.h:183
void SetSpreadInterfaceChannels(ChannelPolicy policy)
set the channel policy
Definition: mesh-helper.cc:51
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: mesh-helper.h:184
ObjectFactory m_mac
the MAC
Definition: mesh-helper.h:182
ChannelPolicy m_spreadChannelPolicy
spread channel policy
Definition: mesh-helper.h:177
void SetStackInstaller(std::string type, Ts &&... args)
Set the MeshStack type to use.
Definition: mesh-helper.h:209
static void EnableLogComponents()
Helper to enable all MeshPointDevice log components with one statement.
Definition: mesh-helper.cc:238
MeshHelper()
Construct a MeshHelper used to make life easier when creating 802.11s networks.
Definition: mesh-helper.cc:37
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: mesh-helper.cc:178
static MeshHelper Default()
Set the helper to the default values for the MAC type, remote station manager and channel policy.
Definition: mesh-helper.cc:98
void SetMacType(Ts &&... args)
Set the Mac Attributes.
Definition: mesh-helper.h:194
NetDeviceContainer Install(const WifiPhyHelper &phyHelper, NodeContainer c) const
Install 802.11s mesh device & protocols on given node list.
Definition: mesh-helper.cc:63
ChannelPolicy
Spread/not spread frequency channels of MP interfaces.
Definition: mesh-helper.h:100
WifiStandard m_standard
standard
Definition: mesh-helper.h:185
void ResetStats(const ns3::Ptr< ns3::NetDevice > &device)
Reset statistics.
Definition: mesh-helper.cc:169
void SetNumberOfInterfaces(uint32_t nInterfaces)
Set a number of interfaces in a mesh network.
Definition: mesh-helper.cc:57
Prototype for class, which helps to install MAC-layer routing stack to ns3::MeshPointDevice.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
create PHY objects
Definition: wifi-helper.h:49
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
Every class exported by the ns3 library is enclosed in the ns3 namespace.