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 "capability-information.h"
28 #include "ht-operation.h"
29 #include "supported-rates.h"
30 #include "dsss-parameter-set.h"
31 #include "erp-information.h"
32 #include "edca-parameter-set.h"
33 #include "ns3/random-variable-stream.h"
34 
35 namespace ns3 {
36 
44 class ApWifiMac : public RegularWifiMac
45 {
46 public:
51  static TypeId GetTypeId (void);
52 
53  ApWifiMac ();
54  virtual ~ApWifiMac ();
55 
60 
64  void SetLinkUpCallback (Callback<void> linkUp);
65 
74  void Enqueue (Ptr<const Packet> packet, Mac48Address to);
75 
87  void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
88 
89  bool SupportsSendFrom (void) const;
90 
98  void SetBeaconInterval (Time interval);
102  Time GetBeaconInterval (void) const;
106  void StartBeaconing (void);
115  bool GetShortSlotTimeEnabled (void) const;
123  bool GetShortPreambleEnabled (void) const;
129  bool IsNonGfHtStasPresent (void) const;
135  uint8_t GetVhtOperationalChannelWidth (void) const;
136 
146  int64_t AssignStreams (int64_t stream);
147 
148 
149 private:
150  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
159  void TxOk (const WifiMacHeader &hdr);
168  void TxFailed (const WifiMacHeader &hdr);
169 
179  void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
180  const WifiMacHeader *hdr);
189  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
198  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
205  void SendProbeResp (Mac48Address to);
213  void SendAssocResp (Mac48Address to, bool success);
217  void SendOneBeacon (void);
229  ErpInformation GetErpInformation (void) const;
241  HtOperation GetHtOperation (void) const;
247  VhtOperation GetVhtOperation (void) const;
254  SupportedRates GetSupportedRates (void) const;
266  void SetBeaconGeneration (bool enable);
272  bool GetBeaconGeneration (void) const;
279  bool GetUseNonErpProtection (void) const;
286  bool GetRifsMode (void) const;
287 
288  void DoDispose (void);
289  void DoInitialize (void);
290 
297  std::list<Mac48Address> m_staList;
298  std::list<Mac48Address> m_nonErpStations;
299  std::list<Mac48Address> m_nonHtStations;
302 };
303 
304 } //namespace ns3
305 
306 #endif /* AP_WIFI_MAC_H */
void DoInitialize(void)
Initialize() implementation.
EdcaParameterSet GetEdcaParameterSet(void) const
Return the EDCA Parameter Set of the current AP.
Definition: ap-wifi-mac.cc:471
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:176
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
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:301
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:194
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:426
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
Definition: vht-operation.h:37
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
Definition: ht-operation.h:52
void SendAssocResp(Mac48Address to, bool success)
Forward an association response packet to the DCF.
Definition: ap-wifi-mac.cc:633
uint8_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:256
bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:373
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
Definition: ap-wifi-mac.h:291
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
bool GetUseNonErpProtection(void) const
Return whether protection for non-ERP stations is used in the BSS.
bool m_enableBeaconGeneration
Flag whether beacons are being generated.
Definition: ap-wifi-mac.h:293
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:156
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:363
base class for all MAC-level wifi objects.
static TypeId GetTypeId(void)
Get the type ID.
Definition: ap-wifi-mac.cc:38
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:273
bool GetRifsMode(void) const
Return whether RIFS is allowed in the BSS.
bool GetShortPreambleEnabled(void) const
Determine whether short preamble should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:223
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
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:294
HtOperation GetHtOperation(void) const
Return the HT operation of the current AP.
Definition: ap-wifi-mac.cc:517
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:789
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...
std::list< Mac48Address > m_staList
List of all stations currently associated to the AP.
Definition: ap-wifi-mac.h:297
void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:164
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The EDCA Parameter SetThis class knows how to serialise and deserialise the EDCA Parameter Set...
an EUI-48 address
Definition: mac48-address.h:43
bool IsNonGfHtStasPresent(void) const
Determine whether non-Greenfield HT stations are present or not.
Definition: ap-wifi-mac.cc:240
bool GetBeaconGeneration(void) const
Return whether the AP is generating beacons.
Definition: ap-wifi-mac.cc:142
Wi-Fi AP state machineHandle association, dis-association and authentication, of STAs within an infra...
Definition: ap-wifi-mac.h:44
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:578
The DSSS Parameter SetThis class knows how to serialise and deserialise the DSSS Parameter Set...
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
void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:775
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:691
An identifier for simulation events.
Definition: event-id.h:53
void DoDispose(void)
Destructor implementation.
Definition: ap-wifi-mac.cc:106
void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:117
ErpInformation GetErpInformation(void) const
Return the ERP information of the current AP.
Definition: ap-wifi-mac.cc:449
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:295
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:439
Time m_beaconInterval
Interval between beacons.
Definition: ap-wifi-mac.h:292
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:298
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:97
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:296
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:149
tuple address
Definition: first.py:37
void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:761
std::list< Mac48Address > m_nonHtStations
List of all non-HT stations currently associated to the AP.
Definition: ap-wifi-mac.h:299
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:202
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:539
a unique identifier for an interface.
Definition: type-id.h:58
void StartBeaconing(void)
Start beacon transmission immediately.
Definition: ap-wifi-mac.cc:187
Implements the IEEE 802.11 MAC header.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:127