A Discrete-Event Network Simulator
API
ap-wifi-mac.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #ifndef AP_WIFI_MAC_H
24 #define AP_WIFI_MAC_H
25 
26 #include "regular-wifi-mac.h"
27 #include <unordered_map>
28 
29 namespace ns3 {
30 
31 class SupportedRates;
32 class CapabilityInformation;
33 class DsssParameterSet;
34 class ErpInformation;
35 class EdcaParameterSet;
36 class MuEdcaParameterSet;
37 class HtOperation;
38 class VhtOperation;
39 class HeOperation;
40 class CfParameterSet;
41 
49 class ApWifiMac : public RegularWifiMac
50 {
51 public:
56  static TypeId GetTypeId (void);
57 
58  ApWifiMac ();
59  virtual ~ApWifiMac ();
60 
61  void SetLinkUpCallback (Callback<void> linkUp) override;
62  void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
63  void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;
64  bool SupportsSendFrom (void) const override;
65  void SetAddress (Mac48Address address) override;
66  Ptr<WifiMacQueue> GetTxopQueue (AcIndex ac) const override;
67 
71  void SetBeaconInterval (Time interval);
75  Time GetBeaconInterval (void) const;
76 
82  uint16_t GetVhtOperationalChannelWidth (void) const;
83 
93  int64_t AssignStreams (int64_t stream);
94 
102  const std::map<uint16_t, Mac48Address>& GetStaList (void) const;
107  uint16_t GetAssociationId (Mac48Address addr) const;
108 
125  uint8_t GetBufferStatus (uint8_t tid, Mac48Address address) const;
135  void SetBufferStatus (uint8_t tid, Mac48Address address, uint8_t size);
144  uint8_t GetMaxBufferStatus (Mac48Address address) const;
145 
146 private:
147  void Receive (Ptr<WifiMacQueueItem> mpdu) override;
156  void TxOk (Ptr<const WifiMacQueueItem> mpdu);
166  void TxFailed (WifiMacDropReason timeoutReason, Ptr<const WifiMacQueueItem> mpdu);
167 
185  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
194  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
201  void SendProbeResp (Mac48Address to);
211  void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
215  void SendOneBeacon (void);
216 
228  ErpInformation GetErpInformation (void) const;
246  HtOperation GetHtOperation (void) const;
252  VhtOperation GetVhtOperation (void) const;
258  HeOperation GetHeOperation (void) const;
265  SupportedRates GetSupportedRates (void) const;
277  void SetBeaconGeneration (bool enable);
278 
285  void UpdateShortSlotTimeEnabled (void);
291  void UpdateShortPreambleEnabled (void);
292 
299  bool GetUseNonErpProtection (void) const;
300 
301  void DoDispose (void) override;
302  void DoInitialize (void) override;
303 
307  uint16_t GetNextAssociationId (void);
308 
315  std::map<uint16_t, Mac48Address> m_staList;
322  typedef struct
324  {
325  uint8_t value;
327  } bsrType;
329  std::unordered_map<WifiAddressTidPair, bsrType, WifiAddressTidHash> m_bufferStatus;
330 
337  typedef void (* AssociationCallback)(uint16_t aid, Mac48Address address);
338 
341 };
342 
343 } //namespace ns3
344 
345 #endif /* AP_WIFI_MAC_H */
ns3::ApWifiMac::m_beaconTxop
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:309
ns3::ApWifiMac::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: ap-wifi-mac.cc:1403
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::ApWifiMac::GetSupportedRates
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
Definition: ap-wifi-mac.cc:383
ns3::ApWifiMac::m_bufferStatus
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:329
ns3::ApWifiMac::ApWifiMac
ApWifiMac()
Definition: ap-wifi-mac.cc:99
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::ApWifiMac::~ApWifiMac
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:119
regular-wifi-mac.h
ns3::WifiMacDropReason
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
ns3::Callback< void >
ns3::ApWifiMac::AssociationCallback
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
Definition: ap-wifi-mac.h:337
ns3::ApWifiMac::DeaggregateAmsduAndForward
void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
Definition: ap-wifi-mac.cc:1382
ns3::ApWifiMac::GetHeOperation
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:704
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ApWifiMac::GetHtOperation
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:574
ns3::DsssParameterSet
The DSSS Parameter Set.
Definition: dsss-parameter-set.h:35
ns3::ApWifiMac::GetStaList
const std::map< uint16_t, Mac48Address > & GetStaList(void) const
Get a const reference to the map of associated stations.
Definition: ap-wifi-mac.cc:1453
ns3::ApWifiMac::GetDsssParameterSet
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:426
ns3::ApWifiMac::TxOk
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:952
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::RegularWifiMac
base class for all MAC-level wifi objects.
Definition: regular-wifi-mac.h:52
ns3::ApWifiMac::SetBeaconInterval
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:191
ns3::ApWifiMac::m_shortPreambleEnabled
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:319
ns3::ApWifiMac::bsrType::value
uint8_t value
value of BSR
Definition: ap-wifi-mac.h:325
ns3::VhtOperation
The VHT Operation Information Element.
Definition: vht-operation.h:36
ns3::ApWifiMac::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:49
ns3::EdcaParameterSet
The EDCA Parameter Set.
Definition: edca-parameter-set.h:35
ns3::ApWifiMac::m_enableBeaconGeneration
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:310
ns3::ApWifiMac::m_shortSlotTimeEnabled
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:318
ns3::SupportedRates
The Supported Rates Information Element.
Definition: supported-rates.h:96
ns3::Ptr< Packet >
ns3::ApWifiMac::m_numNonHtStations
uint16_t m_numNonHtStations
Number of non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:317
ns3::ApWifiMac::bsrType
store value and timestamp for each Buffer Status Report
Definition: ap-wifi-mac.h:324
ns3::ApWifiMac::GetCapabilities
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:439
ns3::ApWifiMac::m_beaconInterval
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:311
ns3::ApWifiMac::GetTxopQueue
Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const override
Get the wifi MAC queue of the (Qos)Txop associated with the given AC.
Definition: ap-wifi-mac.cc:147
ns3::ApWifiMac::SendOneBeacon
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:880
ns3::ApWifiMac::m_beaconEvent
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:312
ns3::ApWifiMac::SendProbeResp
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:732
ns3::HeOperation
The HE Operation Information Element.
Definition: he-operation.h:36
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::ApWifiMac::SetBeaconGeneration
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:157
ns3::ApWifiMac::SendAssocResp
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:789
ns3::ApWifiMac::GetVhtOperationalChannelWidth
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:259
ns3::ApWifiMac::GetMaxBufferStatus
uint8_t GetMaxBufferStatus(Mac48Address address) const
Return the maximum among the values of the Queue Size subfield of the last QoS Data or QoS Null frame...
Definition: ap-wifi-mac.cc:1491
ns3::ApWifiMac::GetVhtOperation
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:663
ns3::ApWifiMac::m_beaconJitter
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:313
ns3::CapabilityInformation
Capability information.
Definition: capability-information.h:34
ns3::ApWifiMac::m_staList
std::map< uint16_t, Mac48Address > m_staList
Map of all stations currently associated to the AP with their association ID.
Definition: ap-wifi-mac.h:315
ns3::ApWifiMac::GetBufferStatus
uint8_t GetBufferStatus(uint8_t tid, Mac48Address address) const
Return the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the ...
Definition: ap-wifi-mac.cc:1465
ns3::ApWifiMac::SetLinkUpCallback
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:179
ns3::ApWifiMac::GetAssociationId
uint16_t GetAssociationId(Mac48Address addr) const
Definition: ap-wifi-mac.cc:1459
ns3::ApWifiMac::UpdateShortPreambleEnabled
void UpdateShortPreambleEnabled(void)
Update whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:236
ns3::ApWifiMac::m_enableBeaconJitter
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:314
ns3::ApWifiMac::GetBeaconInterval
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:172
ns3::ApWifiMac::Receive
void Receive(Ptr< WifiMacQueueItem > mpdu) override
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: ap-wifi-mac.cc:979
ns3::ApWifiMac::ForwardDown
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:276
ns3::ApWifiMac
Wi-Fi AP state machine.
Definition: ap-wifi-mac.h:50
ns3::ApWifiMac::m_numNonErpStations
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:316
ns3::ApWifiMac::SetAddress
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:137
ns3::ApWifiMac::UpdateShortSlotTimeEnabled
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:214
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::ApWifiMac::GetMuEdcaParameterSet
MuEdcaParameterSet GetMuEdcaParameterSet(void) const
Return the MU EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:520
ns3::ApWifiMac::TxFailed
void TxFailed(WifiMacDropReason timeoutReason, Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:965
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::ApWifiMac::SupportsSendFrom
bool SupportsSendFrom(void) const override
Definition: ap-wifi-mac.cc:376
ns3::HtOperation
The HT Operation Information Element.
Definition: ht-operation.h:51
ns3::ApWifiMac::m_deAssocLogger
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
Definition: ap-wifi-mac.h:340
ns3::ApWifiMac::GetEdcaParameterSet
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:472
ns3::ApWifiMac::GetErpInformation
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:450
ns3::ApWifiMac::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:126
ns3::ErpInformation
The ErpInformation Information Element.
Definition: erp-information.h:35
ns3::ApWifiMac::m_assocLogger
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Definition: ap-wifi-mac.h:339
ns3::ApWifiMac::m_bsrLifetime
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:321
ns3::ApWifiMac::GetUseNonErpProtection
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
Definition: ap-wifi-mac.cc:1430
ns3::ApWifiMac::m_enableNonErpProtection
bool m_enableNonErpProtection
Flag whether protection mechanism is used or not when non-ERP STAs are present within the BSS.
Definition: ap-wifi-mac.h:320
ns3::ApWifiMac::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: ap-wifi-mac.cc:206
ns3::ApWifiMac::SetBufferStatus
void SetBufferStatus(uint8_t tid, Mac48Address address, uint8_t size)
Store the value of the Queue Size subfield of the last QoS Data or QoS Null frame received from the s...
Definition: ap-wifi-mac.cc:1477
ns3::ApWifiMac::bsrType::timestamp
Time timestamp
timestamp of BSR
Definition: ap-wifi-mac.h:326
ns3::MuEdcaParameterSet
The MU EDCA Parameter Set.
Definition: mu-edca-parameter-set.h:37
ns3::ApWifiMac::Enqueue
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
Definition: ap-wifi-mac.cc:366
ns3::ApWifiMac::GetNextAssociationId
uint16_t GetNextAssociationId(void)
Definition: ap-wifi-mac.cc:1438