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 "supported-rates.h"
29 #include "dsss-parameter-set.h"
30 #include "erp-information.h"
31 #include "edca-parameter-set.h"
32 #include "ns3/random-variable-stream.h"
33 
34 namespace ns3 {
35 
43 class ApWifiMac : public RegularWifiMac
44 {
45 public:
50  static TypeId GetTypeId (void);
51 
52  ApWifiMac ();
53  virtual ~ApWifiMac ();
54 
59 
63  void SetLinkUpCallback (Callback<void> linkUp);
64 
73  void Enqueue (Ptr<const Packet> packet, Mac48Address to);
74 
86  void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
87 
88  bool SupportsSendFrom (void) const;
89 
97  void SetBeaconInterval (Time interval);
101  Time GetBeaconInterval (void) const;
110  bool GetShortSlotTimeEnabled (void) const;
118  bool GetShortPreambleEnabled (void) const;
124  bool IsNonGfHtStasPresent (void) const;
130  uint8_t GetVhtOperationalChannelWidth (void) const;
131 
141  int64_t AssignStreams (int64_t stream);
142 
143 
144 private:
145  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
154  void TxOk (const WifiMacHeader &hdr);
163  void TxFailed (const WifiMacHeader &hdr);
164 
174  void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
175  const WifiMacHeader *hdr);
184  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
193  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
200  void SendProbeResp (Mac48Address to);
210  void SendAssocResp (Mac48Address to, bool success, bool isReassoc);
214  void SendOneBeacon (void);
226  ErpInformation GetErpInformation (void) const;
238  HtOperation GetHtOperation (void) const;
244  VhtOperation GetVhtOperation (void) const;
250  HeOperation GetHeOperation (void) const;
257  SupportedRates GetSupportedRates (void) const;
269  void SetBeaconGeneration (bool enable);
275  bool GetBeaconGeneration (void) const;
282  bool GetUseNonErpProtection (void) const;
289  bool GetRifsMode (void) const;
290 
291  void DoDispose (void);
292  void DoInitialize (void);
293 
297  uint16_t GetNextAssociationId (void);
298 
305  std::map<uint16_t, Mac48Address> m_staList;
306  std::list<Mac48Address> m_nonErpStations;
307  std::list<Mac48Address> m_nonHtStations;
310 };
311 
312 } //namespace ns3
313 
314 #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:465
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:305
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:309
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:187
DsssParameterSet GetDsssParameterSet(void) const
Return the DSSS Parameter Set that we support.
Definition: ap-wifi-mac.cc:419
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
uint8_t GetVhtOperationalChannelWidth(void) const
Determine the VHT operational channel width (in MHz).
Definition: ap-wifi-mac.cc:249
bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:366
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
Definition: ap-wifi-mac.h:299
uint16_t GetNextAssociationId(void)
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
HeOperation GetHeOperation(void) const
Return the HE operation of the current AP.
Definition: ap-wifi-mac.cc:649
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:301
void SendAssocResp(Mac48Address to, bool success, bool isReassoc)
Forward an association or a reassociation response packet to the DCF.
Definition: ap-wifi-mac.cc:722
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:356
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:266
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:216
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:308
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:302
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:900
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: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:233
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:43
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:665
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:373
void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:886
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:801
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:443
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:303
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current AP.
Definition: ap-wifi-mac.cc:432
Time m_beaconInterval
Interval between beacons.
Definition: ap-wifi-mac.h:300
std::list< Mac48Address > m_nonErpStations
List of all non-ERP stations currently associated to the AP.
Definition: ap-wifi-mac.h:306
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:304
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:873
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:307
bool GetShortSlotTimeEnabled(void) const
Determine whether short slot time should be enabled or not in the BSS.
Definition: ap-wifi-mac.cc:195
VhtOperation GetVhtOperation(void) const
Return the VHT operation of the current AP.
Definition: ap-wifi-mac.cc:611
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:127