A Discrete-Event Network Simulator
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
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
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 */
23#ifndef AP_WIFI_MAC_H
24#define AP_WIFI_MAC_H
26#include "wifi-mac.h"
27#include <unordered_map>
29namespace ns3 {
31class SupportedRates;
32class CapabilityInformation;
33class DsssParameterSet;
34class ErpInformation;
35class EdcaParameterSet;
36class MuEdcaParameterSet;
37class HtOperation;
38class VhtOperation;
39class HeOperation;
40class CfParameterSet;
41class UniformRandomVariable;
50class ApWifiMac : public WifiMac
57 static TypeId GetTypeId (void);
59 ApWifiMac ();
60 virtual ~ApWifiMac ();
62 void SetLinkUpCallback (Callback<void> linkUp) override;
63 bool CanForwardPacketsTo (Mac48Address to) const override;
64 void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
65 void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;
66 bool SupportsSendFrom (void) const override;
67 void SetAddress (Mac48Address address) override;
68 Ptr<WifiMacQueue> GetTxopQueue (AcIndex ac) const override;
69 void ConfigureStandard (WifiStandard standard) override;
74 void SetBeaconInterval (Time interval);
78 Time GetBeaconInterval (void) const;
89 int64_t AssignStreams (int64_t stream);
98 const std::map<uint16_t, Mac48Address>& GetStaList (void) const;
103 uint16_t GetAssociationId (Mac48Address addr) const;
121 uint8_t GetBufferStatus (uint8_t tid, Mac48Address address) const;
131 void SetBufferStatus (uint8_t tid, Mac48Address address, uint8_t size);
149 {
151 virtual ~ApLinkEntity ();
154 };
162 ApLinkEntity& GetLink (uint8_t linkId) const;
165 std::unique_ptr<LinkEntity> CreateLinkEntity (void) const override;
167 void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId) override;
186 void TxFailed (WifiMacDropReason timeoutReason, Ptr<const WifiMacQueueItem> mpdu);
205 void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
214 void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
221 void SendProbeResp (Mac48Address to);
231 void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
238 void SendOneBeacon (uint8_t linkId);
252 ErpInformation GetErpInformation (uint8_t linkId) const;
259 EdcaParameterSet GetEdcaParameterSet (uint8_t linkId) const;
271 HtOperation GetHtOperation (void) const;
277 VhtOperation GetVhtOperation (void) const;
283 HeOperation GetHeOperation (void) const;
297 DsssParameterSet GetDsssParameterSet (uint8_t linkId) const;
303 void SetBeaconGeneration (bool enable);
311 void UpdateShortSlotTimeEnabled (void);
317 void UpdateShortPreambleEnabled (void);
325 bool GetUseNonErpProtection (void) const;
327 void DoDispose (void) override;
328 void DoInitialize (void) override;
333 uint16_t GetNextAssociationId (void);
340 std::map<uint16_t, Mac48Address> m_staList;
348 typedef struct
349 {
350 uint8_t value;
352 } bsrType;
354 std::unordered_map<WifiAddressTidPair, bsrType, WifiAddressTidHash> m_bufferStatus;
362 typedef void (* AssociationCallback)(uint16_t aid, Mac48Address address);
368} //namespace ns3
370#endif /* AP_WIFI_MAC_H */
Wi-Fi AP state machine.
Definition: ap-wifi-mac.h:51
void UpdateShortPreambleEnabled(void)
Update whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:269
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:344
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:335
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:186
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:758
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
Definition: ap-wifi-mac.cc:405
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:224
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:730
uint16_t GetAssociationId(Mac48Address addr) const
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:151
uint16_t m_numNonHtStations
Number of non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:342
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:338
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
Definition: ap-wifi-mac.h:362
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
Definition: ap-wifi-mac.cc:368
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:116
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:345
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:343
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:596
EdcaParameterSet GetEdcaParameterSet(uint8_t linkId) const
Return the EDCA Parameter Set of the current AP for the given link.
Definition: ap-wifi-mac.cc:494
bool SupportsSendFrom(void) const override
Definition: ap-wifi-mac.cc:398
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:340
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:247
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:461
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
Definition: ap-wifi-mac.h:365
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:336
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:337
void TxFailed(WifiMacDropReason timeoutReason, Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu) override
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack.
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:339
void DoInitialize(void) override
Initialize() implementation.
DsssParameterSet GetDsssParameterSet(uint8_t linkId) const
Return the DSSS Parameter Set that we support on the given link.
Definition: ap-wifi-mac.cc:448
MuEdcaParameterSet GetMuEdcaParameterSet(void) const
Return the MU EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:542
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Definition: ap-wifi-mac.h:364
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
const std::map< uint16_t, Mac48Address > & GetStaList(void) const
Get a const reference to the map of associated stations.
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
Definition: ap-wifi-mac.cc:388
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:51
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:346
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:239
ApLinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: ap-wifi-mac.cc:145
uint16_t GetNextAssociationId(void)
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 ...
void ConfigureStandard(WifiStandard standard) override
Definition: ap-wifi-mac.cc:161
ErpInformation GetErpInformation(uint8_t linkId) const
Return the ERP information of the current AP for the given link.
Definition: ap-wifi-mac.cc:472
void SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:212
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:341
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:685
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:123
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...
void Receive(Ptr< WifiMacQueueItem > mpdu, uint8_t linkId) override
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:833
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:354
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:292
std::unique_ptr< LinkEntity > CreateLinkEntity(void) const override
Create a LinkEntity object.
Definition: ap-wifi-mac.cc:139
void SendOneBeacon(uint8_t linkId)
Forward a beacon packet to the beacon special DCF for transmission on the given link.
Definition: ap-wifi-mac.cc:942
Ptr< WifiMacQueue > GetTxopQueue(AcIndex ac) const override
Get the wifi MAC queue of the (Qos)Txop associated with the given AC, if such (Qos)Txop is installed,...
Definition: ap-wifi-mac.cc:176
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:205
The DSSS Parameter Set.
The EDCA Parameter Set.
The ErpInformation Information Element.
An identifier for simulation events.
Definition: event-id.h:54
The HE Operation Information Element.
Definition: he-operation.h:36
The HT Operation Information Element.
Definition: ht-operation.h:51
an EUI-48 address
Definition: mac48-address.h:44
The MU EDCA Parameter Set.
The Supported Rates Information Element.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
The VHT Operation Information Element.
Definition: vht-operation.h:36
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:90
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
The reason why an MPDU was dropped.
Definition: wifi-mac.h:71
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
store value and timestamp for each Buffer Status Report
Definition: ap-wifi-mac.h:349
uint8_t value
value of BSR
Definition: ap-wifi-mac.h:350
Time timestamp
timestamp of BSR
Definition: ap-wifi-mac.h:351