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 "wifi-mac.h"
27#include <unordered_map>
28
29namespace ns3 {
30
31class SupportedRates;
32class CapabilityInformation;
33class DsssParameterSet;
34class ErpInformation;
35class EdcaParameterSet;
36class MuEdcaParameterSet;
37class HtOperation;
38class VhtOperation;
39class HeOperation;
40class CfParameterSet;
41class UniformRandomVariable;
42
50class ApWifiMac : public WifiMac
51{
52public:
57 static TypeId GetTypeId (void);
58
59 ApWifiMac ();
60 virtual ~ApWifiMac ();
61
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
73 void SetBeaconInterval (Time interval);
77 Time GetBeaconInterval (void) const;
78
84 uint16_t GetVhtOperationalChannelWidth (void) const;
85
95 int64_t AssignStreams (int64_t stream);
96
104 const std::map<uint16_t, Mac48Address>& GetStaList (void) const;
109 uint16_t GetAssociationId (Mac48Address addr) const;
110
127 uint8_t GetBufferStatus (uint8_t tid, Mac48Address address) const;
137 void SetBufferStatus (uint8_t tid, Mac48Address address, uint8_t size);
147
148private:
149 void Receive (Ptr<WifiMacQueueItem> mpdu) override;
168 void TxFailed (WifiMacDropReason timeoutReason, Ptr<const WifiMacQueueItem> mpdu);
169
187 void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
196 void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
203 void SendProbeResp (Mac48Address to);
213 void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
217 void SendOneBeacon (void);
218
248 HtOperation GetHtOperation (void) const;
254 VhtOperation GetVhtOperation (void) const;
260 HeOperation GetHeOperation (void) const;
279 void SetBeaconGeneration (bool enable);
280
287 void UpdateShortSlotTimeEnabled (void);
293 void UpdateShortPreambleEnabled (void);
294
301 bool GetUseNonErpProtection (void) const;
302
303 void DoDispose (void) override;
304 void DoInitialize (void) override;
305
309 uint16_t GetNextAssociationId (void);
310
317 std::map<uint16_t, Mac48Address> m_staList;
325 typedef struct
326 {
327 uint8_t value;
329 } bsrType;
331 std::unordered_map<WifiAddressTidPair, bsrType, WifiAddressTidHash> m_bufferStatus;
332
339 typedef void (* AssociationCallback)(uint16_t aid, Mac48Address address);
340
343};
344
345} //namespace ns3
346
347#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:237
bool m_shortPreambleEnabled
Flag whether short preamble is enabled in the BSS.
Definition: ap-wifi-mac.h:321
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:311
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:158
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:739
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
Definition: ap-wifi-mac.cc:390
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:192
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:711
uint16_t GetAssociationId(Mac48Address addr) const
void SetAddress(Mac48Address address) override
Definition: ap-wifi-mac.cc:138
uint16_t m_numNonHtStations
Number of non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:319
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:315
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:987
void(* AssociationCallback)(uint16_t aid, Mac48Address address)
TracedCallback signature for association/deassociation events.
Definition: ap-wifi-mac.h:339
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
Definition: ap-wifi-mac.cc:353
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:120
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:322
bool m_shortSlotTimeEnabled
Flag whether short slot time is enabled within the BSS.
Definition: ap-wifi-mac.h:320
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...
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:457
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:581
bool SupportsSendFrom(void) const override
Definition: ap-wifi-mac.cc:383
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:317
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:433
void UpdateShortSlotTimeEnabled(void)
Update whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:215
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:446
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:915
TracedCallback< uint16_t, Mac48Address > m_deAssocLogger
deassociation logger
Definition: ap-wifi-mac.h:342
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:312
Time m_beaconInterval
Beacon interval.
Definition: ap-wifi-mac.h:313
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:316
void DoInitialize(void) override
Initialize() implementation.
MuEdcaParameterSet GetMuEdcaParameterSet(void) const
Return the MU EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:527
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:479
TracedCallback< uint16_t, Mac48Address > m_assocLogger
association logger
Definition: ap-wifi-mac.h:341
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:314
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:260
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: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:50
Time m_bsrLifetime
Lifetime of Buffer Status Reports.
Definition: ap-wifi-mac.h:323
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:207
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 SetLinkUpCallback(Callback< void > linkUp) override
Definition: ap-wifi-mac.cc:180
uint16_t m_numNonErpStations
Number of non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:318
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:670
void DoDispose(void) override
Destructor implementation.
Definition: ap-wifi-mac.cc:127
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 SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:810
std::unordered_map< WifiAddressTidPair, bsrType, WifiAddressTidHash > m_bufferStatus
Per (MAC address, TID) buffer status reports.
Definition: ap-wifi-mac.h:331
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:277
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:148
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:173
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:103
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:85
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:66
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
address
Definition: first.py:44
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:326
uint8_t value
value of BSR
Definition: ap-wifi-mac.h:327
Time timestamp
timestamp of BSR
Definition: ap-wifi-mac.h:328