A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
wifi-mac-helper.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2016
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
19
*/
20
21
#include "ns3/net-device.h"
22
#include "
wifi-mac-helper.h
"
23
#include "ns3/frame-exchange-manager.h"
24
#include "ns3/wifi-protection-manager.h"
25
#include "ns3/wifi-ack-manager.h"
26
#include "ns3/multi-user-scheduler.h"
27
#include "ns3/boolean.h"
28
29
namespace
ns3
{
30
31
WifiMacHelper::WifiMacHelper
()
32
{
33
//By default, we create an AdHoc MAC layer without QoS.
34
SetType
(
"ns3::AdhocWifiMac"
,
35
"QosSupported"
,
BooleanValue
(
false
));
36
37
m_protectionManager
.
SetTypeId
(
"ns3::WifiDefaultProtectionManager"
);
38
m_ackManager
.
SetTypeId
(
"ns3::WifiDefaultAckManager"
);
39
}
40
41
WifiMacHelper::~WifiMacHelper
()
42
{
43
}
44
45
Ptr<WifiMac>
46
WifiMacHelper::Create
(
Ptr<NetDevice>
device,
WifiStandard
standard)
const
47
{
48
auto
standardIt =
wifiStandards
.find (standard);
49
NS_ABORT_MSG_IF
(standardIt ==
wifiStandards
.end (),
"Selected standard is not defined!"
);
50
51
Ptr<WifiMac>
mac
=
m_mac
.
Create
<
WifiMac
> ();
52
mac
->SetDevice (device);
53
mac
->SetAddress (
Mac48Address::Allocate
());
54
mac
->ConfigureStandard (standard);
55
56
Ptr<RegularWifiMac>
wifiMac = DynamicCast<RegularWifiMac> (
mac
);
57
Ptr<FrameExchangeManager>
fem;
58
59
if
(wifiMac != 0 && (fem = wifiMac->GetFrameExchangeManager ()) != 0)
60
{
61
Ptr<WifiProtectionManager>
protectionManager =
m_protectionManager
.
Create
<
WifiProtectionManager
> ();
62
protectionManager->SetWifiMac (wifiMac);
63
fem->SetProtectionManager (protectionManager);
64
65
Ptr<WifiAckManager>
ackManager =
m_ackManager
.
Create
<
WifiAckManager
> ();
66
ackManager->SetWifiMac (wifiMac);
67
fem->SetAckManager (ackManager);
68
69
// create and install the Multi User Scheduler if this is an HE AP
70
Ptr<ApWifiMac>
apMac = DynamicCast<ApWifiMac> (
mac
);
71
if
(apMac !=
nullptr
&& standardIt->second.macStandard >=
WIFI_MAC_STANDARD_80211ax
72
&&
m_muScheduler
.
IsTypeIdSet
())
73
{
74
Ptr<MultiUserScheduler>
muScheduler =
m_muScheduler
.
Create
<
MultiUserScheduler
> ();
75
apMac->AggregateObject (muScheduler);
76
}
77
}
78
return
mac
;
79
}
80
81
}
//namespace ns3
wifi-mac-helper.h
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition:
boolean.h:37
ns3::MultiUserScheduler
MultiUserScheduler is an abstract base class defining the API that APs supporting at least VHT can us...
Definition:
multi-user-scheduler.h:51
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WIFI_MAC_STANDARD_80211ax
@ WIFI_MAC_STANDARD_80211ax
Definition:
wifi-standards.h:94
ns3::ObjectFactory::IsTypeIdSet
bool IsTypeIdSet(void) const
Check if the ObjectFactory has been configured with a TypeId.
Definition:
object-factory.cc:58
third.mac
mac
Definition:
third.py:99
ns3::WifiMacHelper::m_protectionManager
ObjectFactory m_protectionManager
Factory to create a protection manager.
Definition:
wifi-mac-helper.h:114
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
ns3::Mac48Address::Allocate
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
Definition:
mac48-address.cc:135
ns3::WifiMac
base class for all MAC-level wifi objects.
Definition:
wifi-mac.h:72
ns3::WifiMacHelper::m_muScheduler
ObjectFactory m_muScheduler
Multi-user Scheduler object factory.
Definition:
wifi-mac-helper.h:116
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition:
abort.h:108
ns3::WifiAckManager
WifiAckManager is an abstract base class.
Definition:
wifi-ack-manager.h:43
ns3::WifiMacHelper::WifiMacHelper
WifiMacHelper()
Create a WifiMacHelper to make life easier for people who want to work with Wifi MAC layers.
Definition:
wifi-mac-helper.cc:31
ns3::WifiMacHelper::m_mac
ObjectFactory m_mac
MAC object factory.
Definition:
wifi-mac-helper.h:113
ns3::WifiMacHelper::m_ackManager
ObjectFactory m_ackManager
Factory to create an acknowledgment manager.
Definition:
wifi-mac-helper.h:115
ns3::WifiMacHelper::SetType
void SetType(std::string type, Args &&... args)
Definition:
wifi-mac-helper.h:130
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition:
object-factory.cc:40
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition:
object-factory.cc:98
ns3::wifiStandards
const std::map< WifiStandard, WifiStandardInfo > wifiStandards
map a given standard configured by the user to the corresponding WifiStandardInfo
Definition:
wifi-standards.h:188
ns3::WifiStandard
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
Definition:
wifi-standards.h:126
ns3::WifiMacHelper::~WifiMacHelper
virtual ~WifiMacHelper()
Destroy a WifiMacHelper.
Definition:
wifi-mac-helper.cc:41
ns3::WifiMacHelper::Create
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device, WifiStandard standard) const
Definition:
wifi-mac-helper.cc:46
ns3::WifiProtectionManager
WifiProtectionManager is an abstract base class.
Definition:
wifi-protection-manager.h:42
src
wifi
helper
wifi-mac-helper.cc
Generated on Fri Oct 1 2021 17:03:42 for ns-3 by
1.8.20