A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mac-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016
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: Sébastien Deronne <sebastien.deronne@gmail.com>
18 */
19
20#ifndef WIFI_MAC_HELPER_H
21#define WIFI_MAC_HELPER_H
22
23#include "ns3/object-factory.h"
24#include "ns3/wifi-standards.h"
25
26namespace ns3
27{
28
29class WifiMac;
30class WifiNetDevice;
31
32/**
33 * \brief create MAC layers for a ns3::WifiNetDevice.
34 *
35 * This class can create MACs of type ns3::ApWifiMac, ns3::StaWifiMac and ns3::AdhocWifiMac.
36 * Its purpose is to allow a WifiHelper to configure and install WifiMac objects on a collection
37 * of nodes. The WifiMac objects themselves are mainly composed of TxMiddle, RxMiddle,
38 * ChannelAccessManager, FrameExchangeManager, WifiRemoteStationManager, MpduAggregator and
39 * MsduAggregartor objects, so this helper offers the opportunity to configure attribute values away
40 * from their default values, on a per-NodeContainer basis. By default, it creates an Adhoc MAC
41 * layer without QoS. Typically, it is used to set type and attribute values, then hand this object
42 * over to the WifiHelper that finishes the job of installing.
43 *
44 * This class may be further subclassed (WaveMacHelper is an example of this).
45 *
46 */
48{
49 public:
50 /**
51 * Create a WifiMacHelper to make life easier for people who want to
52 * work with Wifi MAC layers.
53 */
55 /**
56 * Destroy a WifiMacHelper.
57 */
58 virtual ~WifiMacHelper();
59
60 /**
61 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
62 * \param type the type of ns3::WifiMac to create.
63 * \param args A sequence of name-value pairs of the attributes to set.
64 *
65 * All the attributes specified in this method should exist
66 * in the requested MAC.
67 */
68 template <typename... Args>
69 void SetType(std::string type, Args&&... args);
70
71 /**
72 * Helper function used to set the Association Manager.
73 *
74 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
75 * \param type the type of Association Manager
76 * \param args A sequence of name-value pairs of the attributes to set.
77 */
78 template <typename... Args>
79 void SetAssocManager(std::string type, Args&&... args);
80
81 /**
82 * Helper function used to set the MAC queue scheduler.
83 *
84 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
85 * \param type the type of MAC queue scheduler
86 * \param args A sequence of name-value pairs of the attributes to set.
87 */
88 template <typename... Args>
89 void SetMacQueueScheduler(std::string type, Args&&... args);
90
91 /**
92 * Helper function used to set the Protection Manager.
93 *
94 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
95 * \param type the type of Protection Manager
96 * \param args A sequence of name-value pairs of the attributes to set.
97 */
98 template <typename... Args>
99 void SetProtectionManager(std::string type, Args&&... args);
100
101 /**
102 * Helper function used to set the Acknowledgment Manager.
103 *
104 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
105 * \param type the type of Acknowledgment Manager
106 * \param args A sequence of name-value pairs of the attributes to set.
107 */
108 template <typename... Args>
109 void SetAckManager(std::string type, Args&&... args);
110
111 /**
112 * Helper function used to set the Multi User Scheduler that can be aggregated
113 * to an HE AP's MAC.
114 *
115 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
116 * \param type the type of Multi User Scheduler
117 * \param args A sequence of name-value pairs of the attributes to set.
118 */
119 template <typename... Args>
120 void SetMultiUserScheduler(std::string type, Args&&... args);
121
122 /**
123 * Helper function used to set the EMLSR Manager that can be installed on an EHT non-AP MLD.
124 *
125 * \tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
126 * \param type the type of EMLSR Manager
127 * \param args A sequence of name-value pairs of the attributes to set.
128 */
129 template <typename... Args>
130 void SetEmlsrManager(std::string type, Args&&... args);
131
132 /**
133 * \param device the device within which the MAC object will reside
134 * \param standard the standard to configure during installation
135 * \returns a new MAC object.
136 *
137 * This allows the ns3::WifiHelper class to create MAC objects from ns3::WifiHelper::Install.
138 */
139 virtual Ptr<WifiMac> Create(Ptr<WifiNetDevice> device, WifiStandard standard) const;
140
141 protected:
142 ObjectFactory m_mac; ///< MAC object factory
143 ObjectFactory m_assocManager; ///< Association Manager
144 ObjectFactory m_queueScheduler; ///< MAC queue scheduler
145 ObjectFactory m_protectionManager; ///< Factory to create a protection manager
146 ObjectFactory m_ackManager; ///< Factory to create an acknowledgment manager
147 ObjectFactory m_muScheduler; ///< Multi-user Scheduler object factory
148 ObjectFactory m_emlsrManager; ///< EMLSR Manager object factory
149};
150
151} // namespace ns3
152
153/***************************************************************
154 * Implementation of the templates declared above.
155 ***************************************************************/
156
157namespace ns3
158{
159
160template <typename... Args>
161void
162WifiMacHelper::SetType(std::string type, Args&&... args)
163{
164 m_mac.SetTypeId(type);
165 m_mac.Set(args...);
166}
167
168template <typename... Args>
169void
170WifiMacHelper::SetAssocManager(std::string type, Args&&... args)
171{
173 m_assocManager.Set(args...);
174}
175
176template <typename... Args>
177void
178WifiMacHelper::SetMacQueueScheduler(std::string type, Args&&... args)
179{
181 m_queueScheduler.Set(args...);
182}
183
184template <typename... Args>
185void
186WifiMacHelper::SetProtectionManager(std::string type, Args&&... args)
187{
189 m_protectionManager.Set(args...);
190}
191
192template <typename... Args>
193void
194WifiMacHelper::SetAckManager(std::string type, Args&&... args)
195{
197 m_ackManager.Set(args...);
198}
199
200template <typename... Args>
201void
202WifiMacHelper::SetMultiUserScheduler(std::string type, Args&&... args)
203{
205 m_muScheduler.Set(args...);
206}
207
208template <typename... Args>
209void
210WifiMacHelper::SetEmlsrManager(std::string type, Args&&... args)
211{
213 m_emlsrManager.Set(args...);
214}
215
216} // namespace ns3
217
218#endif /* WIFI_MAC_HELPER_H */
Instantiate subclasses of ns3::Object.
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:77
create MAC layers for a ns3::WifiNetDevice.
ObjectFactory m_mac
MAC object factory.
ObjectFactory m_queueScheduler
MAC queue scheduler.
void SetAckManager(std::string type, Args &&... args)
Helper function used to set the Acknowledgment Manager.
virtual ~WifiMacHelper()
Destroy a WifiMacHelper.
virtual Ptr< WifiMac > Create(Ptr< WifiNetDevice > device, WifiStandard standard) const
ObjectFactory m_protectionManager
Factory to create a protection manager.
ObjectFactory m_muScheduler
Multi-user Scheduler object factory.
void SetProtectionManager(std::string type, Args &&... args)
Helper function used to set the Protection Manager.
void SetMacQueueScheduler(std::string type, Args &&... args)
Helper function used to set the MAC queue scheduler.
ObjectFactory m_assocManager
Association Manager.
WifiMacHelper()
Create a WifiMacHelper to make life easier for people who want to work with Wifi MAC layers.
ObjectFactory m_emlsrManager
EMLSR Manager object factory.
void SetAssocManager(std::string type, Args &&... args)
Helper function used to set the Association Manager.
void SetMultiUserScheduler(std::string type, Args &&... args)
Helper function used to set the Multi User Scheduler that can be aggregated to an HE AP's MAC.
void SetEmlsrManager(std::string type, Args &&... args)
Helper function used to set the EMLSR Manager that can be installed on an EHT non-AP MLD.
ObjectFactory m_ackManager
Factory to create an acknowledgment manager.
void SetType(std::string type, Args &&... args)
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.