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 
63 
67  void SetLinkUpCallback (Callback<void> linkUp);
68 
77  void Enqueue (Ptr<const Packet> packet, Mac48Address to);
78 
90  void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
91 
92  bool SupportsSendFrom (void) const;
93 
101  void SetBeaconInterval (Time interval);
105  Time GetBeaconInterval (void) const;
109  void SetCfpMaxDuration (Time duration);
113  Time GetCfpMaxDuration (void) const;
122  bool GetShortSlotTimeEnabled (void) const;
130  bool GetShortPreambleEnabled (void) const;
136  bool IsNonGfHtStasPresent (void) const;
142  uint16_t GetVhtOperationalChannelWidth (void) const;
143 
153  int64_t AssignStreams (int64_t stream);
154 
155 
156 private:
157  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
166  void TxOk (const WifiMacHeader &hdr);
175  void TxFailed (const WifiMacHeader &hdr);
176 
186  void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
187  const WifiMacHeader *hdr);
196  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
205  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
212  void SendProbeResp (Mac48Address to);
222  void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
226  void SendOneBeacon (void);
230  void SendNextCfFrame (void);
234  void SendCfPoll (void);
238  void SendCfEnd (void);
239 
251  ErpInformation GetErpInformation (void) const;
263  CfParameterSet GetCfParameterSet (void) const;
269  HtOperation GetHtOperation (void) const;
275  VhtOperation GetVhtOperation (void) const;
281  HeOperation GetHeOperation (void) const;
288  SupportedRates GetSupportedRates (void) const;
300  void SetBeaconGeneration (bool enable);
307  bool GetUseNonErpProtection (void) const;
314  bool GetRifsMode (void) const;
319  void IncrementPollingListIterator (void);
320 
321  void DoDispose (void);
322  void DoInitialize (void);
323 
327  uint16_t GetNextAssociationId (void);
328 
335  std::map<uint16_t, Mac48Address> m_staList;
336  std::list<Mac48Address> m_nonErpStations;
337  std::list<Mac48Address> m_nonHtStations;
338  std::list<Mac48Address> m_cfPollingList;
339  std::list<Mac48Address>::iterator m_itCfPollingList;
342 };
343 
344 } //namespace ns3
345 
346 #endif /* AP_WIFI_MAC_H */
void DoInitialize(void)
Initialize() implementation.
void SendCfEnd(void)
Send a CF-End packet.
Definition: ap-wifi-mac.cc:942
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:335
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:194
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
std::list< Mac48Address >::iterator m_itCfPollingList
Iterator to the list of all PCF stations currently associated to the AP.
Definition: ap-wifi-mac.h:339
bool GetRifsMode(void) const
Return whether RIFS is allowed in the BSS.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:402
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:496
bool m_disableRifs
Flag whether to force RIFS to be disabled within the BSS If non-HT STAs are detected.
Definition: ap-wifi-mac.h:341
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:692
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:216
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
Definition: vht-operation.h:37
CfParameterSet GetCfParameterSet(void) const
Return the CF parameter set of the current AP.
Definition: ap-wifi-mac.cc:544
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:52
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:159
uint16_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:278
uint16_t GetNextAssociationId(void)
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
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:330
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:764
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:173
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:385
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:45
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:459
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:295
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:654
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:224
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:340
bool GetShortPreambleEnabled(void) const
Determine whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:245
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:331
Ptr< Txop > m_beaconTxop
Dedicated Txop for beacons.
Definition: ap-wifi-mac.h:329
std::list< Mac48Address > m_cfPollingList
List of all PCF stations currently associated to the AP.
Definition: ap-wifi-mac.h:338
void SendNextCfFrame(void)
Determine what is the next PCF frame and trigger its transmission.
Definition: ap-wifi-mac.cc:917
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: ap-wifi-mac.cc:997
void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:182
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetCfpMaxDuration(Time duration)
Definition: ap-wifi-mac.cc:205
address
Definition: first.py:37
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:446
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:559
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:474
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:708
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:332
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:978
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:842
An identifier for simulation events.
Definition: event-id.h:53
void DoDispose(void)
Destructor implementation.
Definition: ap-wifi-mac.cc:122
void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:134
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:333
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:336
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:112
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:934
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
Time GetCfpMaxDuration(void) const
Definition: ap-wifi-mac.cc:166
bool m_enableBeaconJitter
Flag whether the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:334
bool IsNonGfHtStasPresent(void) const
Determine whether non-Greenfield HT stations are present or not.
Definition: ap-wifi-mac.cc:262
void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:950
The HE Operation Information ElementThis class knows how to serialise and deserialise the HE Operatio...
Definition: he-operation.h:37
std::list< Mac48Address > m_nonHtStations
List of all non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:337
bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:395
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:144