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 SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager) override;
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 
70  void SetBeaconInterval (Time interval);
74  Time GetBeaconInterval (void) const;
75 
81  uint16_t GetVhtOperationalChannelWidth (void) const;
82 
92  int64_t AssignStreams (int64_t stream);
93 
101  const std::map<uint16_t, Mac48Address>& GetStaList (void) const;
106  uint16_t GetAssociationId (Mac48Address addr) const;
107 
124  uint8_t GetBufferStatus (uint8_t tid, Mac48Address address) const;
134  void SetBufferStatus (uint8_t tid, Mac48Address address, uint8_t size);
143  uint8_t GetMaxBufferStatus (Mac48Address address) const;
144 
145 private:
146  void Receive (Ptr<WifiMacQueueItem> mpdu) override;
155  void TxOk (Ptr<const WifiMacQueueItem> mpdu);
166  void TxFailed (uint8_t timeoutReason, Ptr<const WifiMacQueueItem> mpdu, const WifiTxVector& txVector);
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;
240  HtOperation GetHtOperation (void) const;
246  VhtOperation GetVhtOperation (void) const;
252  HeOperation GetHeOperation (void) const;
259  SupportedRates GetSupportedRates (void) const;
271  void SetBeaconGeneration (bool enable);
272 
279  void UpdateShortSlotTimeEnabled (void);
285  void UpdateShortPreambleEnabled (void);
286 
293  bool GetUseNonErpProtection (void) const;
294 
295  void DoDispose (void) override;
296  void DoInitialize (void) override;
297 
301  uint16_t GetNextAssociationId (void);
302 
309  std::map<uint16_t, Mac48Address> m_staList;
310  std::unordered_map<Mac48Address, uint16_t, WifiAddressHash> m_addressIdMap;
318  typedef struct
320  {
321  uint8_t value;
323  } bsrType;
325  std::unordered_map<WifiAddressTidPair, bsrType, WifiAddressTidHash> m_bufferStatus;
326 
333  typedef void (* AssociationCallback)(uint16_t aid, Mac48Address address);
334 
337 };
338 
339 } //namespace ns3
340 
341 #endif /* AP_WIFI_MAC_H */
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
Definition: ap-wifi-mac.cc:363
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:309
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:273
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:380
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:469
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:647
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:136
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:203
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
Definition: ap-wifi-mac.h:336
Forward calls to a chain of Callback.
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:315
uint16_t m_numNonHtStations
Number of non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:313
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
Definition: vht-operation.h:35
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:312
store value and timestamp for each Buffer Status Report
Definition: ap-wifi-mac.h:319
uint16_t GetAssociationId(Mac48Address addr) const
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:50
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:211
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:161
const std::map< uint16_t, Mac48Address > & GetStaList(void) const
Get a const reference to the map of associated stations.
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:256
uint16_t GetNextAssociationId(void)
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
Capability information.
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:304
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:731
base class for all MAC-level wifi objects.
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...
bool SupportsSendFrom(void) const override
Definition: ap-wifi-mac.cc:373
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...
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:48
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:436
Time timestamp
timestamp of BSR
Definition: ap-wifi-mac.h:322
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:317
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:606
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
Definition: ap-wifi-mac.cc:168
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:176
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:316
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:306
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:303
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:919
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:905
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:44
The EDCA Parameter SetThis class knows how to serialise and deserialise the EDCA Parameter Set...
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:892
an EUI-48 address
Definition: mac48-address.h:43
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:314
uint8_t value
value of BSR
Definition: ap-wifi-mac.h:321
void UpdateShortPreambleEnabled(void)
Update whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:233
Wi-Fi AP state machineHandle association, dis-association and authentication, of STAs within an infra...
Definition: ap-wifi-mac.h:48
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:423
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:517
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:447
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:675
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:821
An identifier for simulation events.
Definition: event-id.h:53
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
Definition: ap-wifi-mac.h:333
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:307
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:305
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:325
void DoInitialize(void) override
Initialize() implementation.
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:117
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 ...
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:308
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:125
The HE Operation Information ElementThis class knows how to serialise and deserialise the HE Operatio...
Definition: he-operation.h:35
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Definition: ap-wifi-mac.h:335
a unique identifier for an interface.
Definition: type-id.h:58
std::unordered_map< Mac48Address, uint16_t, WifiAddressHash > m_addressIdMap
Maps MAC addresses of associated stations to their association ID.
Definition: ap-wifi-mac.h:311
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:146