A Discrete-Event Network Simulator
API
regular-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) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef REGULAR_WIFI_MAC_H
22 #define REGULAR_WIFI_MAC_H
23 
24 #include "wifi-mac.h"
25 #include "dca-txop.h"
26 #include "edca-txop-n.h"
27 
28 namespace ns3 {
29 
30 class MacLow;
31 class MacRxMiddle;
32 class MacTxMiddle;
33 class DcfManager;
34 
44 class RegularWifiMac : public WifiMac
45 {
46 public:
51  static TypeId GetTypeId (void);
52 
53  RegularWifiMac ();
54  virtual ~RegularWifiMac ();
55 
59  void SetSlot (Time slotTime);
63  void SetSifs (Time sifs);
70  void SetEifsNoDifs (Time eifsNoDifs);
74  void SetPifs (Time pifs);
78  void SetRifs (Time rifs);
82  void SetCtsTimeout (Time ctsTimeout);
86  void SetAckTimeout (Time ackTimeout);
87 
88  Time GetRifs (void) const;
92  Time GetPifs (void) const;
96  Time GetSifs (void) const;
100  Time GetSlot (void) const;
104  Time GetEifsNoDifs (void) const;
108  Time GetCtsTimeout (void) const;
112  Time GetAckTimeout (void) const;
113 
120  void SetCtsToSelfSupported (bool enable);
128  bool GetCtsToSelfSupported () const;
129 
136  void SetShortSlotTimeSupported (bool enable);
143  bool GetShortSlotTimeSupported (void) const;
150  void SetRifsSupported (bool enable);
157  bool GetRifsSupported (void) const;
158 
162  Mac48Address GetAddress (void) const;
166  Ssid GetSsid (void) const;
174  void SetSsid (Ssid ssid);
178  void SetBssid (Mac48Address bssid);
182  Mac48Address GetBssid (void) const;
190  void SetPromisc (void);
191 
203  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
204 
205  virtual bool SupportsSendFrom (void) const;
206 
215  void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
219  virtual void SetWifiPhy (const Ptr<WifiPhy> phy);
223  Ptr<WifiPhy> GetWifiPhy (void) const;
227  void ResetWifiPhy (void);
231  virtual void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager);
247  HtCapabilities GetHtCapabilities (void) const;
253  VhtCapabilities GetVhtCapabilities (void) const;
259  HeCapabilities GetHeCapabilities (void) const;
260 
274  void SetForwardUpCallback (ForwardUpCallback upCallback);
278  void SetLinkUpCallback (Callback<void> linkUp);
282  void SetLinkDownCallback (Callback<void> linkDown);
283 
284  /* Next functions are not pure virtual so non Qos WifiMacs are not
285  * forced to implement them.
286  */
287  void SetBasicBlockAckTimeout (Time blockAckTimeout);
288  Time GetBasicBlockAckTimeout (void) const;
289  void SetCompressedBlockAckTimeout (Time blockAckTimeout);
290  Time GetCompressedBlockAckTimeout (void) const;
291 
292 
293 protected:
294  virtual void DoInitialize ();
295  virtual void DoDispose ();
296 
302 
304 
305  ForwardUpCallback m_forwardUp;
308 
310 
314 
317  typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
318 
321  EdcaQueues m_edca;
322 
328  Ptr<DcaTxop> GetDcaTxop (void) const;
329 
335  Ptr<EdcaTxopN> GetVOQueue (void) const;
341  Ptr<EdcaTxopN> GetVIQueue (void) const;
347  Ptr<EdcaTxopN> GetBEQueue (void) const;
353  Ptr<EdcaTxopN> GetBKQueue (void) const;
354 
368 
376  void ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax);
377 
386  void SetTypeOfStation (TypeOfStation type);
387 
402  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
409  virtual void TxOk (const WifiMacHeader &hdr);
416  virtual void TxFailed (const WifiMacHeader &hdr);
417 
425  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
426 
434  virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
435  const WifiMacHeader *hdr);
436 
444  void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
445  Mac48Address originator);
446 
461 
467  void SetQosSupported (bool enable);
473  bool GetQosSupported () const;
474 
488 
494  void SetHtSupported (bool enable);
500  bool GetHtSupported () const;
501 
512  void SetVhtSupported (bool enable);
518  bool GetVhtSupported () const;
519 
530  void SetErpSupported (bool enable);
536  bool GetErpSupported () const;
537 
548  void SetDsssSupported (bool enable);
554  bool GetDsssSupported () const;
555 
566  void SetHeSupported (bool enable);
572  bool GetHeSupported () const;
573 
574 
575 private:
577  RegularWifiMac (const RegularWifiMac &);
585 
592  void SetupEdcaQueue (AcIndex ac);
593 
599  void SetVoMaxAmsduSize (uint16_t size);
605  void SetViMaxAmsduSize (uint16_t size);
611  void SetBeMaxAmsduSize (uint16_t size);
617  void SetBkMaxAmsduSize (uint16_t size);
618 
624  void SetVoMaxAmpduSize (uint16_t size);
630  void SetViMaxAmpduSize (uint16_t size);
636  void SetBeMaxAmpduSize (uint16_t size);
642  void SetBkMaxAmpduSize (uint16_t size);
643 
649  void SetVoBlockAckThreshold (uint8_t threshold);
655  void SetViBlockAckThreshold (uint8_t threshold);
661  void SetBeBlockAckThreshold (uint8_t threshold);
667  void SetBkBlockAckThreshold (uint8_t threshold);
668 
674  void SetVoBlockAckInactivityTimeout (uint16_t timeout);
680  void SetViBlockAckInactivityTimeout (uint16_t timeout);
686  void SetBeBlockAckInactivityTimeout (uint16_t timeout);
692  void SetBkBlockAckInactivityTimeout (uint16_t timeout);
693 
695  void ConfigureAggregation (void);
697  void EnableAggregation (void);
699  void DisableAggregation (void);
700 
701  uint16_t m_voMaxAmsduSize;
702  uint16_t m_viMaxAmsduSize;
703  uint16_t m_beMaxAmsduSize;
704  uint16_t m_bkMaxAmsduSize;
705 
706  uint16_t m_voMaxAmpduSize;
707  uint16_t m_viMaxAmpduSize;
708  uint16_t m_beMaxAmpduSize;
709  uint16_t m_bkMaxAmpduSize;
710 
713 
716 };
717 
718 } //namespace ns3
719 
720 #endif /* REGULAR_WIFI_MAC_H */
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
void SetHeSupported(bool enable)
Enable or disable HE support for the device.
uint16_t m_voMaxAmsduSize
maximum A-MSDU size for AC_VO
Ptr< DcfManager > m_dcfManager
DCF manager (access to channel)
void SetVoBlockAckInactivityTimeout(uint16_t timeout)
Set VO block ack inactivity timeout.
void SetupEdcaQueue(AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void ConfigureAggregation(void)
Configure aggregation function.
void SetSifs(Time sifs)
Callback template class.
Definition: callback.h:1176
bool GetDsssSupported() const
Return whether the device supports DSSS.
bool GetVhtSupported() const
Return whether the device supports VHT.
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
bool GetCtsToSelfSupported() const
Return whether the device supports CTS-to-self capability.
static TypeId GetTypeId(void)
Get the type ID.
void SetBkMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_BK.
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Forward calls to a chain of Callback.
void SetErpSupported(bool enable)
Enable or disable ERP support for the device.
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:983
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
The Extended Capabilities Information ElementThis class knows how to serialise and deserialise the Ex...
Callback< void > m_linkUp
Callback when a link is up.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetVoMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_VO.
void SetSsid(Ssid ssid)
void SetSlot(Time slotTime)
Time GetCompressedBlockAckTimeout(void) const
bool GetQosSupported() const
Return whether the device supports QoS.
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
void SetLinkDownCallback(Callback< void > linkDown)
void SetHtSupported(bool enable)
Enable or disable HT support for the device.
void SetRifsSupported(bool enable)
Enable or disable RIFS feature.
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetVoMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_VO.
ns3::Time timeout
void SetRifs(Time rifs)
Ssid GetSsid(void) const
void SetViMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_VI.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
virtual 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...
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
TracedCallback< const WifiMacHeader & > m_txErrCallback
transmit error callback
bool m_rifsSupported
flag whether RIFS is supported
void SetVoBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_VO.
void SetBssid(Mac48Address bssid)
Ptr< EdcaTxopN > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
Time GetSifs(void) const
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
std::map< AcIndex, Ptr< EdcaTxopN > > EdcaQueues
This type defines a mapping between an Access Category index, and a pointer to the corresponding chan...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Time GetCtsTimeout(void) const
void SetForwardUpCallback(ForwardUpCallback upCallback)
base class for all MAC-level wifi objects.
void EnableAggregation(void)
Enable aggregation function.
void SetEifsNoDifs(Time eifsNoDifs)
void SetBkBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_BK.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
tuple phy
Definition: third.py:86
void SetBasicBlockAckTimeout(Time blockAckTimeout)
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
Ptr< EdcaTxopN > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
void FinishConfigureStandard(WifiPhyStandard standard)
The IEEE 802.11ac VHT Capabilities.
Ssid m_ssid
Service Set ID (SSID)
Ptr< DcaTxop > GetDcaTxop(void) const
Accessor for the DCF object.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:41
Time GetAckTimeout(void) const
Time GetSlot(void) const
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
void SetAddress(Mac48Address address)
Ptr< MacRxMiddle > m_rxMiddle
RX middle (de-fragmentation etc.)
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE
void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
bool m_heSupported
This Boolean is set true iff this WifiMac is to model 802.11ax.
tuple mac
Definition: third.py:92
Time GetPifs(void) const
bool GetHeSupported() const
Return whether the device supports HE.
bool GetErpSupported() const
Return whether the device supports ERP.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBeBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_BE.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
Callback< void > m_linkDown
Callback when a link is down.
TracedCallback< const WifiMacHeader & > m_txOkCallback
transmit OK callback
Ptr< EdcaTxopN > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void DisableAggregation(void)
Disable aggregation function.
void SetVhtSupported(bool enable)
Enable or disable VHT support for the device.
Ptr< WifiPhy > GetWifiPhy(void) const
an EUI-48 address
Definition: mac48-address.h:43
tuple ssid
Definition: third.py:93
uint16_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK
void SetCtsTimeout(Time ctsTimeout)
virtual bool SupportsSendFrom(void) const
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
Time GetRifs(void) const
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
uint16_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO
Mac48Address GetBssid(void) const
Ptr< EdcaTxopN > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
void SetViBlockAckThreshold(uint8_t threshold)
Set the Block ACK threshold for AC_VI.
uint16_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE
Time GetBasicBlockAckTimeout(void) const
Mac48Address GetAddress(void) const
uint16_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI
void SetViMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_VI.
virtual void DoInitialize()
Initialize() implementation.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
bool GetHtSupported() const
Return whether the device supports HT.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
bool m_shortSlotTimeSupported
flag whether short slot time is supported
bool GetShortSlotTimeSupported(void) const
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
tuple address
Definition: first.py:37
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
TypeOfStation
Enumeration for type of station.
Definition: edca-txop-n.h:44
Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
bool GetRifsSupported(void) const
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
RegularWifiMac & operator=(const RegularWifiMac &mac)
assignment operator
void SetBeMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_BE.
void SetShortSlotTimeSupported(bool enable)
Enable or disable short slot time feature.
void SetDsssSupported(bool enable)
Enable or disable DSSS support for the device.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
void SetPromisc(void)
Sets the interface in promiscuous mode.
The IEEE 802.11ax HE Capabilities.
void SetBeBlockAckInactivityTimeout(uint16_t timeout)
Set BE block ack inactivity timeout.
a unique identifier for an interface.
Definition: type-id.h:58
bool m_dsssSupported
This Boolean is set true iff this WifiMac is to model 802.11b.
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
void SetBkMaxAmpduSize(uint16_t size)
Set the maximum A-MPDU size for AC_BK.
void SetAckTimeout(Time ackTimeout)
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Implements the IEEE 802.11 MAC header.
void SetBeMaxAmsduSize(uint16_t size)
Set the maximum A-MSDU size for AC_BE.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Time GetEifsNoDifs(void) const