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 
27 
28 namespace ns3 {
29 
30 class SupportedRates;
31 class CapabilityInformation;
32 class DsssParameterSet;
33 class ErpInformation;
34 class EdcaParameterSet;
35 class HtOperation;
36 class VhtOperation;
37 class HeOperation;
38 class CfParameterSet;
39 
48 {
49 public:
54  static TypeId GetTypeId (void);
55 
56  ApWifiMac ();
57  virtual ~ApWifiMac ();
58 
59  // Implementations of pure virtual methods, or overridden from base class.
61  void SetLinkUpCallback (Callback<void> linkUp);
62  void Enqueue (Ptr<Packet> packet, Mac48Address to);
63  void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from);
64  bool SupportsSendFrom (void) const;
66 
70  void SetBeaconInterval (Time interval);
74  Time GetBeaconInterval (void) const;
78  void SetCfpMaxDuration (Time duration);
82  Time GetCfpMaxDuration (void) const;
91  bool GetShortSlotTimeEnabled (void) const;
99  bool GetShortPreambleEnabled (void) const;
105  bool IsNonGfHtStasPresent (void) const;
111  uint16_t GetVhtOperationalChannelWidth (void) const;
112 
122  int64_t AssignStreams (int64_t stream);
123 
124 
125 private:
126  void Receive (Ptr<WifiMacQueueItem> mpdu);
135  void TxOk (const WifiMacHeader &hdr);
144  void TxFailed (const WifiMacHeader &hdr);
145 
163  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
172  void ForwardDown (Ptr<Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
179  void SendProbeResp (Mac48Address to);
189  void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
193  void SendOneBeacon (void);
197  void SendNextCfFrame (void);
201  void SendCfPoll (void);
205  void SendCfEnd (void);
206 
218  ErpInformation GetErpInformation (void) const;
230  CfParameterSet GetCfParameterSet (void) const;
236  HtOperation GetHtOperation (void) const;
242  VhtOperation GetVhtOperation (void) const;
248  HeOperation GetHeOperation (void) const;
255  SupportedRates GetSupportedRates (void) const;
267  void SetBeaconGeneration (bool enable);
274  bool GetUseNonErpProtection (void) const;
279  void IncrementPollingListIterator (void);
280 
281  void DoDispose (void);
282  void DoInitialize (void);
283 
287  uint16_t GetNextAssociationId (void);
288 
295  std::map<uint16_t, Mac48Address> m_staList;
296  std::list<Mac48Address> m_nonErpStations;
297  std::list<Mac48Address> m_nonHtStations;
298  std::list<Mac48Address> m_cfPollingList;
299  std::list<Mac48Address>::iterator m_itCfPollingList;
301 };
302 
303 } //namespace ns3
304 
305 #endif /* AP_WIFI_MAC_H */
void DoInitialize(void)
Initialize() implementation.
void SendCfEnd(void)
Send a CF-End packet.
Definition: ap-wifi-mac.cc:961
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:295
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:192
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
std::list< Mac48Address >::iterator m_itCfPollingList
Iterator to the list of all PCF stations currently associated to the AP.
Definition: ap-wifi-mac.h:299
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:297
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:404
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:498
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:697
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:218
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
Definition: vht-operation.h:35
CfParameterSet GetCfParameterSet(void) const
Return the CF parameter set of the current AP.
Definition: ap-wifi-mac.cc:546
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:50
void Enqueue(Ptr< Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:387
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:157
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:280
uint16_t GetNextAssociationId(void)
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu)
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
The Wifi MAC high model for a STA or AP in a BSS.
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:290
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:783
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:171
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:461
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:656
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:226
The CF Parameter SetThis class knows how to serialise and deserialise the CF Parameter Set...
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:300
bool GetShortPreambleEnabled(void) const
Determine whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:247
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:291
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:289
std::list< Mac48Address > m_cfPollingList
List of all PCF stations currently associated to the AP.
Definition: ap-wifi-mac.h:298
void SendNextCfFrame(void)
Determine what is the next PCF frame and trigger its transmission.
Definition: ap-wifi-mac.cc:936
void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:180
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetCfpMaxDuration(Time duration)
Definition: ap-wifi-mac.cc:207
address
Definition: first.py:44
The EDCA Parameter SetThis class knows how to serialise and deserialise the EDCA Parameter Set...
an EUI-48 address
Definition: mac48-address.h:43
Wi-Fi AP state machineHandle association, dis-association and authentication, of STAs within an infra...
Definition: ap-wifi-mac.h:47
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:448
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:561
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:476
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:727
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
EventId m_cfpEvent
Event to generate one PCF frame.
Definition: ap-wifi-mac.h:292
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:997
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:861
An identifier for simulation events.
Definition: event-id.h:53
void DoDispose(void)
Destructor implementation.
Definition: ap-wifi-mac.cc:120
void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:132
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:293
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:296
void Receive(Ptr< WifiMacQueueItem > mpdu)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:110
void IncrementPollingListIterator(void)
Increment the PCF polling list iterator to indicate that the next polling station can be polled...
void SendCfPoll(void)
Send a CF-Poll packet to the next polling STA.
Definition: ap-wifi-mac.cc:953
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
Time GetCfpMaxDuration(void) const
Definition: ap-wifi-mac.cc:164
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:294
bool IsNonGfHtStasPresent(void) const
Determine whether non-Greenfield HT stations are present or not.
Definition: ap-wifi-mac.cc:264
void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:969
The HE Operation Information ElementThis class knows how to serialise and deserialise the HE Operatio...
Definition: he-operation.h:35
std::list< Mac48Address > m_nonHtStations
List of all non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:297
bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:397
a unique identifier for an interface.
Definition: type-id.h:58
Implements the IEEE 802.11 MAC header.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:142