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 "qos-txop.h"
26 #include "ssid.h"
27 
28 namespace ns3 {
29 
30 class MacLow;
31 class MacRxMiddle;
32 class MacTxMiddle;
33 class ChannelAccessManager;
34 class ExtendedCapabilities;
35 
44 class RegularWifiMac : public WifiMac
45 {
46 public:
51  static TypeId GetTypeId (void);
52 
53  RegularWifiMac ();
54  virtual ~RegularWifiMac ();
55 
56  // Implementations of pure virtual methods.
57  void SetSlot (Time slotTime);
58  void SetSifs (Time sifs);
59  void SetEifsNoDifs (Time eifsNoDifs);
60  void SetPifs (Time pifs);
61  void SetRifs (Time rifs);
62  void SetAckTimeout (Time ackTimeout);
63  void SetShortSlotTimeSupported (bool enable);
64  void SetSsid (Ssid ssid);
66  void SetPromisc (void);
67  Time GetRifs (void) const;
68  Time GetPifs (void) const;
69  Time GetSifs (void) const;
70  Time GetSlot (void) const;
71  Time GetEifsNoDifs (void) const;
72  Time GetAckTimeout (void) const;
73  bool GetShortSlotTimeSupported (void) const;
74  Ssid GetSsid (void) const;
75  Mac48Address GetAddress (void) const;
76  Mac48Address GetBssid (void) const;
77  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from);
78  virtual bool SupportsSendFrom (void) const;
79  virtual void SetWifiPhy (const Ptr<WifiPhy> phy);
80  Ptr<WifiPhy> GetWifiPhy (void) const;
81  void ResetWifiPhy (void);
82  virtual void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager);
83 
93 
94  void SetForwardUpCallback (ForwardUpCallback upCallback);
95  void SetLinkUpCallback (Callback<void> linkUp);
96  void SetLinkDownCallback (Callback<void> linkDown);
97 
98  /* Next functions are not pure virtual so non-QoS WifiMacs are not
99  * forced to implement them.
100  */
101  void SetBasicBlockAckTimeout (Time blockAckTimeout);
102  Time GetBasicBlockAckTimeout (void) const;
103  void SetCompressedBlockAckTimeout (Time blockAckTimeout);
104  Time GetCompressedBlockAckTimeout (void) const;
105 
106  // Should be implemented by child classes
107  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
108 
115  void SetCtsToSelfSupported (bool enable);
123  void SetRifsSupported (bool enable);
131  bool GetRifsSupported (void) const;
135  void SetBssid (Mac48Address bssid);
136 
152  HtCapabilities GetHtCapabilities (void) const;
158  VhtCapabilities GetVhtCapabilities (void) const;
164  HeCapabilities GetHeCapabilities (void) const;
165 
166 protected:
167  virtual void DoInitialize ();
168  virtual void DoDispose ();
169 
175 
177 
181 
183 
187 
190  typedef std::map<AcIndex, Ptr<QosTxop> > EdcaQueues;
191 
195 
201  Ptr<Txop> GetTxop (void) const;
202 
208  Ptr<QosTxop> GetVOQueue (void) const;
214  Ptr<QosTxop> GetVIQueue (void) const;
220  Ptr<QosTxop> GetBEQueue (void) const;
226  Ptr<QosTxop> GetBKQueue (void) const;
227 
241 
249  void ConfigureContentionWindow (uint32_t cwMin, uint32_t cwMax);
250 
259  void SetTypeOfStation (TypeOfStation type);
260 
274  virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
281  virtual void TxOk (const WifiMacHeader &hdr);
288  virtual void TxFailed (const WifiMacHeader &hdr);
289 
297  void ForwardUp (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
298 
306 
314  void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
315  Mac48Address originator);
316 
322  virtual void SetQosSupported (bool enable);
328  bool GetQosSupported () const;
329 
335  void SetHtSupported (bool enable);
341  bool GetHtSupported () const;
342 
348  void SetVhtSupported (bool enable);
354  bool GetVhtSupported () const;
355 
361  void SetErpSupported (bool enable);
367  bool GetErpSupported () const;
368 
374  void SetDsssSupported (bool enable);
380  bool GetDsssSupported () const;
381 
387  void SetHeSupported (bool enable);
393  bool GetHeSupported () const;
394 
395 private:
397  RegularWifiMac (const RegularWifiMac &);
405 
412  void SetupEdcaQueue (AcIndex ac);
413 
419  void SetVoBlockAckThreshold (uint8_t threshold);
425  void SetViBlockAckThreshold (uint8_t threshold);
431  void SetBeBlockAckThreshold (uint8_t threshold);
437  void SetBkBlockAckThreshold (uint8_t threshold);
438 
444  void SetVoBlockAckInactivityTimeout (uint16_t timeout);
450  void SetViBlockAckInactivityTimeout (uint16_t timeout);
456  void SetBeBlockAckInactivityTimeout (uint16_t timeout);
462  void SetBkBlockAckInactivityTimeout (uint16_t timeout);
463 
488 
490  void EnableAggregation (void);
492  void DisableAggregation (void);
493 
494  uint16_t m_voMaxAmsduSize;
495  uint16_t m_viMaxAmsduSize;
496  uint16_t m_beMaxAmsduSize;
497  uint16_t m_bkMaxAmsduSize;
498 
499  uint32_t m_voMaxAmpduSize;
500  uint32_t m_viMaxAmpduSize;
501  uint32_t m_beMaxAmpduSize;
502  uint32_t m_bkMaxAmpduSize;
503 
506 
509 };
510 
511 } //namespace ns3
512 
513 #endif /* REGULAR_WIFI_MAC_H */
virtual 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 (in bytes)
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 SetSifs(Time sifs)
bool GetHeSupported() const
Return whether the device supports HE.
Callback template class.
Definition: callback.h:1278
Time GetSifs(void) const
Ptr< Txop > m_txop
This holds a pointer to the TXOP instance for this WifiMac - used for transmission of frames to non-Q...
uint32_t m_bkMaxAmpduSize
maximum A-MPDU size for AC_BK (in bytes)
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
virtual void DeaggregateAmsduAndForward(Ptr< WifiMacQueueItem > mpdu)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
bool GetQosSupported() const
Return whether the device supports QoS.
static TypeId GetTypeId(void)
Get the type ID.
uint16_t m_bkMaxAmsduSize
maximum A-MSDU size for AC_BK (in bytes)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Forward calls to a chain of Callback.
uint32_t m_beMaxAmpduSize
maximum A-MPDU size for AC_BE (in bytes)
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:1003
void SetPifs(Time pifs)
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
ExtendedCapabilities GetExtendedCapabilities(void) const
Return the extended capabilities of the device.
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)
bool GetRifsSupported(void) const
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetSsid(Ssid ssid)
void SetSlot(Time slotTime)
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.
uint32_t m_voMaxAmpduSize
maximum A-MPDU size for AC_VO (in bytes)
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
ns3::Time timeout
void SetRifs(Time rifs)
Time GetCompressedBlockAckTimeout(void) const
virtual void Receive(Ptr< WifiMacQueueItem > mpdu)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
bool GetShortSlotTimeSupported(void) const
Time GetRifs(void) const
bool GetDsssSupported() const
Return whether the device supports DSSS.
TracedCallback< const WifiMacHeader & > m_txErrCallback
transmit error callback
bool m_rifsSupported
flag whether RIFS is supported (deprecated)
phy
Definition: third.py:93
void SetVoBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VO.
void SetBssid(Mac48Address bssid)
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
virtual bool SupportsSendFrom(void) const
void SetForwardUpCallback(ForwardUpCallback upCallback)
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
base class for all MAC-level wifi objects.
void EnableAggregation(void)
Enable aggregation function.
Time GetBasicBlockAckTimeout(void) const
void SetEifsNoDifs(Time eifsNoDifs)
void SetBkBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BK.
bool GetErpSupported() const
Return whether the device supports ERP.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
void SetBasicBlockAckTimeout(Time blockAckTimeout)
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Time GetEifsNoDifs(void) const
bool GetVhtSupported() const
Return whether the device supports VHT.
void FinishConfigureStandard(WifiPhyStandard standard)
The IEEE 802.11ac VHT Capabilities.
Ssid m_ssid
Service Set ID (SSID)
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:46
ssid
Definition: third.py:100
mac
Definition: third.py:99
void SetAddress(Mac48Address address)
Ptr< MacRxMiddle > m_rxMiddle
RX middle (defragmentation etc.)
Ptr< QosTxop > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
uint16_t m_viMaxAmsduSize
maximum A-MSDU size for AC_VI (in bytes)
Mac48Address GetBssid(void) const
uint16_t m_beMaxAmsduSize
maximum A-MSDU size for AC_BE (in bytes)
HeCapabilities GetHeCapabilities(void) const
Return the HE capabilities of the device.
void ResetWifiPhy(void)
Remove currently attached WifiPhy device from this MAC.
Ptr< MacLow > m_low
MacLow (RTS, CTS, Data, Ack etc.)
void SetBeBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_BE.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
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
Time GetAckTimeout(void) const
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.
address
Definition: first.py:44
void DisableAggregation(void)
Disable aggregation function.
void SetVhtSupported(bool enable)
Enable or disable VHT support for the device.
an EUI-48 address
Definition: mac48-address.h:43
Ssid GetSsid(void) const
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
void SetViBlockAckInactivityTimeout(uint16_t timeout)
Set VI block ack inactivity timeout.
std::map< AcIndex, Ptr< QosTxop > > EdcaQueues
This type defines a mapping between an Access Category index, and a pointer to the corresponding chan...
Mac48Address GetAddress(void) const
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Ptr< Txop > GetTxop(void) const
Accessor for the DCF object.
Time GetPifs(void) const
void SetViBlockAckThreshold(uint8_t threshold)
Set the block ack threshold for AC_VI.
bool GetHtSupported() const
Return whether the device supports HT.
virtual void DoInitialize()
Initialize() implementation.
void SetBkBlockAckInactivityTimeout(uint16_t timeout)
Set BK block ack inactivity timeout.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
bool m_shortSlotTimeSupported
flag whether short slot time is supported
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
uint32_t m_viMaxAmpduSize
maximum A-MPDU size for AC_VI (in bytes)
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
TypeOfStation
Enumeration for type of station.
Definition: qos-txop.h:47
Ptr< QosTxop > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
RegularWifiMac & operator=(const RegularWifiMac &mac)
assignment operator
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.
Ptr< WifiPhy > GetWifiPhy(void) const
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities of the device.
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)
Time GetSlot(void) const
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.
Callback< void, Ptr< const Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities of the device.
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.