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 HtOperation;
37 class VhtOperation;
38 class HeOperation;
39 class CfParameterSet;
40 
48 class ApWifiMac : public RegularWifiMac
49 {
50 public:
55  static TypeId GetTypeId (void);
56 
57  ApWifiMac ();
58  virtual ~ApWifiMac ();
59 
60  void SetLinkUpCallback (Callback<void> linkUp) override;
61  void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
62  void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;
63  bool SupportsSendFrom (void) const override;
64  void SetAddress (Mac48Address address) override;
65 
69  void SetBeaconInterval (Time interval);
73  Time GetBeaconInterval (void) const;
74 
80  uint16_t GetVhtOperationalChannelWidth (void) const;
81 
91  int64_t AssignStreams (int64_t stream);
92 
100  const std::map<uint16_t, Mac48Address>& GetStaList (void) const;
105  uint16_t GetAssociationId (Mac48Address addr) const;
106 
123  uint8_t GetBufferStatus (uint8_t tid, Mac48Address address) const;
133  void SetBufferStatus (uint8_t tid, Mac48Address address, uint8_t size);
142  uint8_t GetMaxBufferStatus (Mac48Address address) const;
143 
144 private:
145  void Receive (Ptr<WifiMacQueueItem> mpdu) override;
154  void TxOk (Ptr<const WifiMacQueueItem> mpdu);
165  void TxFailed (uint8_t timeoutReason, Ptr<const WifiMacQueueItem> mpdu, const WifiTxVector& txVector);
166 
184  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
193  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
200  void SendProbeResp (Mac48Address to);
210  void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
214  void SendOneBeacon (void);
215 
227  ErpInformation GetErpInformation (void) const;
239  HtOperation GetHtOperation (void) const;
245  VhtOperation GetVhtOperation (void) const;
251  HeOperation GetHeOperation (void) const;
258  SupportedRates GetSupportedRates (void) const;
270  void SetBeaconGeneration (bool enable);
271 
278  void UpdateShortSlotTimeEnabled (void);
284  void UpdateShortPreambleEnabled (void);
285 
292  bool GetUseNonErpProtection (void) const;
293 
294  void DoDispose (void) override;
295  void DoInitialize (void) override;
296 
300  uint16_t GetNextAssociationId (void);
301 
308  std::map<uint16_t, Mac48Address> m_staList;
315  typedef struct
317  {
318  uint8_t value;
320  } bsrType;
322  std::unordered_map<WifiAddressTidPair, bsrType, WifiAddressTidHash> m_bufferStatus;
323 
330  typedef void (* AssociationCallback)(uint16_t aid, Mac48Address address);
331 
334 };
335 
336 } //namespace ns3
337 
338 #endif /* AP_WIFI_MAC_H */
ns3::ApWifiMac::m_beaconTxop
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:302
ns3::ApWifiMac::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: ap-wifi-mac.cc:1335
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:372
ns3::ApWifiMac::m_bufferStatus
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:322
ns3::ApWifiMac::ApWifiMac
ApWifiMac()
Definition: ap-wifi-mac.cc:98
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::ApWifiMac::~ApWifiMac
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:118
regular-wifi-mac.h
ns3::Callback< void >
ns3::ApWifiMac::AssociationCallback
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
Definition: ap-wifi-mac.h:330
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:1314
ns3::ApWifiMac::GetHeOperation
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:639
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:509
ns3::ApWifiMac::TxFailed
void TxFailed(uint8_t timeoutReason, Ptr< const WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:897
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:1385
ns3::ApWifiMac::GetDsssParameterSet
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:415
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:884
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::RegularWifiMac
base class for all MAC-level wifi objects.
Definition: regular-wifi-mac.h:51
ns3::ApWifiMac::SetBeaconInterval
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:180
ns3::ApWifiMac::m_shortPreambleEnabled
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:312
ns3::ApWifiMac::bsrType::value
uint8_t value
value of BSR
Definition: ap-wifi-mac.h:318
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:48
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:303
ns3::ApWifiMac::m_shortSlotTimeEnabled
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:311
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:310
ns3::ApWifiMac::bsrType
store value and timestamp for each Buffer Status Report
Definition: ap-wifi-mac.h:317
ns3::ApWifiMac::GetCapabilities
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:428
ns3::ApWifiMac::m_beaconInterval
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:304
ns3::ApWifiMac::SendOneBeacon
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:813
ns3::ApWifiMac::m_beaconEvent
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:305
ns3::ApWifiMac::SendProbeResp
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:667
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:146
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:723
ns3::ApWifiMac::GetVhtOperationalChannelWidth
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:248
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:1423
ns3::ApWifiMac::GetVhtOperation
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:598
ns3::ApWifiMac::m_beaconJitter
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:306
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:308
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:1397
ns3::ApWifiMac::SetLinkUpCallback
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:168
ns3::ApWifiMac::GetAssociationId
uint16_t GetAssociationId(Mac48Address addr) const
Definition: ap-wifi-mac.cc:1391
ns3::ApWifiMac::UpdateShortPreambleEnabled
void UpdateShortPreambleEnabled(void)
Update whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:225
ns3::ApWifiMac::m_enableBeaconJitter
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:307
ns3::ApWifiMac::GetBeaconInterval
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:161
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:911
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:265
ns3::ApWifiMac
Wi-Fi AP state machine.
Definition: ap-wifi-mac.h:49
ns3::ApWifiMac::m_numNonErpStations
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:309
ns3::ApWifiMac::SetAddress
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:136
ns3::ApWifiMac::UpdateShortSlotTimeEnabled
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:203
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:365
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:333
ns3::ApWifiMac::GetEdcaParameterSet
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:461
ns3::ApWifiMac::GetErpInformation
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:439
ns3::ApWifiMac::DoDispose
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:125
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:332
ns3::ApWifiMac::m_bsrLifetime
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:314
ns3::ApWifiMac::GetUseNonErpProtection
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
Definition: ap-wifi-mac.cc:1362
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:313
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:195
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:1409
ns3::ApWifiMac::bsrType::timestamp
Time timestamp
timestamp of BSR
Definition: ap-wifi-mac.h:319
ns3::ApWifiMac::Enqueue
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
Definition: ap-wifi-mac.cc:355
ns3::ApWifiMac::GetNextAssociationId
uint16_t GetNextAssociationId(void)
Definition: ap-wifi-mac.cc:1370