A Discrete-Event Network Simulator
API
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 WIFI_MAC_H
22 #define WIFI_MAC_H
23 
24 #include "ns3/net-device.h"
25 #include "wifi-phy-standard.h"
27 #include "qos-utils.h"
28 
29 namespace ns3 {
30 
31 class Ssid;
32 class Txop;
33 class HtConfiguration;
34 class VhtConfiguration;
35 class HeConfiguration;
36 
46 class WifiMac : public Object
47 {
48 public:
49  virtual void DoDispose ();
50 
55  static TypeId GetTypeId (void);
56 
62  void SetDevice (const Ptr<NetDevice> device);
68  Ptr<NetDevice> GetDevice (void) const;
69 
73  virtual void SetSlot (Time slotTime) = 0;
77  virtual void SetSifs (Time sifs) = 0;
84  virtual void SetEifsNoDifs (Time eifsNoDifs) = 0;
88  virtual void SetPifs (Time pifs) = 0;
92  virtual void SetRifs (Time rifs) = 0;
96  virtual void SetAckTimeout (Time ackTimeout) = 0;
102  void SetMaxPropagationDelay (Time delay);
106  virtual void SetSsid (Ssid ssid) = 0;
113  virtual void SetShortSlotTimeSupported (bool enable) = 0;
121  virtual void SetPromisc (void) = 0;
122 
126  virtual Time GetRifs (void) const = 0;
130  virtual Time GetPifs (void) const = 0;
134  virtual Time GetSifs (void) const = 0;
138  virtual Time GetSlot (void) const = 0;
142  virtual Time GetEifsNoDifs (void) const = 0;
146  virtual Time GetAckTimeout (void) const = 0;
150  virtual Mac48Address GetAddress (void) const = 0;
154  virtual Ssid GetSsid (void) const = 0;
158  virtual void SetAddress (Mac48Address address) = 0;
162  virtual Mac48Address GetBssid (void) const = 0;
166  virtual bool GetShortSlotTimeSupported (void) const = 0;
167 
179  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) = 0;
188  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
196  virtual bool SupportsSendFrom (void) const = 0;
200  virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
204  virtual Ptr<WifiPhy> GetWifiPhy (void) const = 0;
208  virtual void ResetWifiPhy (void) = 0;
212  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
217 
222  virtual void SetForwardUpCallback (Callback<void, Ptr<const Packet>, Mac48Address, Mac48Address> upCallback) = 0;
226  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
230  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
231  /* Next functions are not pure virtual so non QoS WifiMacs are not
232  * forced to implement them.
233  */
234 
240  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout) = 0;
244  virtual Time GetBasicBlockAckTimeout (void) const = 0;
250  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout) = 0;
254  virtual Time GetCompressedBlockAckTimeout (void) const = 0;
255 
263  void NotifyTx (Ptr<const Packet> packet);
271  void NotifyTxDrop (Ptr<const Packet> packet);
277  void NotifyRx (Ptr<const Packet> packet);
283  void NotifyPromiscRx (Ptr<const Packet> packet);
289  void NotifyRxDrop (Ptr<const Packet> packet);
290 
309  void ConfigureStandard (WifiPhyStandard standard);
310 
323 
324 
325 protected:
335  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
336 
337 
338 private:
345  static Time GetDefaultMaxPropagationDelay (void);
351  static Time GetDefaultSlot (void);
357  static Time GetDefaultSifs (void);
363  static Time GetDefaultRifs (void);
370  static Time GetDefaultEifsNoDifs (void);
376  static Time GetDefaultCtsAckDelay (void);
385  static Time GetDefaultCtsAckTimeout (void);
392  static Time GetDefaultBasicBlockAckDelay (void);
398  static Time GetDefaultBasicBlockAckTimeout (void);
412 
421  virtual void FinishConfigureStandard (WifiPhyStandard standard) = 0;
422 
425 
430  void Configure80211a (void);
435  void Configure80211b (void);
441  void Configure80211g (void);
446  void Configure80211_10Mhz (void);
451  void Configure80211_5Mhz ();
457  void Configure80211n_2_4Ghz (void);
462  void Configure80211n_5Ghz (void);
467  void Configure80211ac (void);
473  void Configure80211ax_2_4Ghz (void);
478  void Configure80211ax_5Ghz (void);
479 
517 };
518 
519 } //namespace ns3
520 
521 #endif /* WIFI_MAC_H */
522 
virtual Time GetPifs(void) const =0
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:483
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
virtual Time GetRifs(void) const =0
virtual void SetCompressedBlockAckTimeout(Time blockAckTimeout)=0
void Configure80211b(void)
This method sets 802.11b standards-compliant defaults for following attributes: SIFS, Slot, EifsNoDifs, PIFS, CtsTimeout, and AckTimeout.
Definition: wifi-mac.cc:323
Callback template class.
Definition: callback.h:1273
virtual void SetPifs(Time pifs)=0
virtual void FinishConfigureStandard(WifiPhyStandard standard)=0
virtual Mac48Address GetBssid(void) const =0
virtual void SetAckTimeout(Time ackTimeout)=0
Forward calls to a chain of Callback.
virtual void SetWifiPhy(Ptr< WifiPhy > phy)=0
static Time GetDefaultMaxPropagationDelay(void)
Definition: wifi-mac.cc:38
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:516
virtual void SetLinkDownCallback(Callback< void > linkDown)=0
virtual void SetPromisc(void)=0
Sets the interface in promiscuous mode.
virtual Time GetAckTimeout(void) const =0
static Time GetDefaultCtsAckDelay(void)
Definition: wifi-mac.cc:72
void Configure80211ac(void)
This method sets 802.11ac standards-compliant defaults for following attributes: SIFS, Slot, EifsNoDifs, PIFS, CtsTimeout, and AckTimeout.
Definition: wifi-mac.cc:390
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Definition: wifi-mac.h:493
void ConfigureStandard(WifiPhyStandard standard)
Definition: wifi-mac.cc:265
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:259
virtual Time GetBasicBlockAckTimeout(void) const =0
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:501
static Time GetDefaultSifs(void)
Definition: wifi-mac.cc:52
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)=0
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)=0
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:412
virtual void SetSsid(Ssid ssid)=0
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:222
void Configure80211ax_5Ghz(void)
This method sets 802.11ax 5 GHz standards-compliant defaults for following attributes: SIFS...
Definition: wifi-mac.cc:404
phy
Definition: third.py:93
virtual Ssid GetSsid(void) const =0
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:469
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:216
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
Definition: wifi-mac.h:486
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:46
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:241
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
ssid
Definition: third.py:100
virtual Time GetSlot(void) const =0
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:253
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:210
virtual void SetAddress(Mac48Address address)=0
void Configure80211n_5Ghz(void)
This method sets 802.11n 5 GHz standards-compliant defaults for following attributes: SIFS...
Definition: wifi-mac.cc:380
void Configure80211_10Mhz(void)
This method sets 802.11 with 10 MHz channel spacing standards-compliant defaults for following attrib...
Definition: wifi-mac.cc:349
virtual void SetBasicBlockAckTimeout(Time blockAckTimeout)=0
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:235
virtual void SetRifs(Time rifs)=0
void Configure80211n_2_4Ghz(void)
This method sets 802.11n 2.4 GHz standards-compliant defaults for following attributes: SIFS...
Definition: wifi-mac.cc:371
virtual void ResetWifiPhy(void)=0
Remove currently attached WifiPhy device from this MAC.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
address
Definition: first.py:44
static Time GetDefaultSlot(void)
Definition: wifi-mac.cc:45
virtual void SetEifsNoDifs(Time eifsNoDifs)=0
an EUI-48 address
Definition: mac48-address.h:43
void Configure80211g(void)
This method sets 802.11g standards-compliant defaults for following attributes: SIFS, Slot, EifsNoDifs, PIFS, CtsTimeout, and AckTimeout.
Definition: wifi-mac.cc:334
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
virtual Time GetCompressedBlockAckTimeout(void) const =0
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:247
static Time GetDefaultBasicBlockAckDelay(void)
Return the default basic BlockAck delay.
Definition: wifi-mac.cc:93
static Time GetDefaultCompressedBlockAckDelay(void)
Return the default compressed BlockAck delay.
Definition: wifi-mac.cc:100
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Definition: wifi-mac.h:509
void SetMaxPropagationDelay(Time delay)
Definition: wifi-mac.cc:228
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:476
void Configure80211a(void)
This method sets 802.11a standards-compliant defaults for following attributes: SIFS, Slot, EifsNoDifs, PIFS, CtsTimeout, and AckTimeout.
Definition: wifi-mac.cc:312
void Configure80211_5Mhz()
This method sets 802.11 with 5 MHz channel spacing standards-compliant defaults for following attribu...
Definition: wifi-mac.cc:360
virtual void SetSifs(Time sifs)=0
virtual bool GetShortSlotTimeSupported(void) const =0
virtual Time GetSifs(void) const =0
virtual bool SupportsSendFrom(void) const =0
virtual Ptr< WifiPhy > GetWifiPhy(void) const =0
static Time GetDefaultCompressedBlockAckTimeout(void)
Return the default compressed BlockAck timeout.
Definition: wifi-mac.cc:118
static Time GetDefaultCtsAckTimeout(void)
Definition: wifi-mac.cc:79
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:424
Time m_maxPropagationDelay
maximum propagation delay
Definition: wifi-mac.h:423
virtual void SetForwardUpCallback(Callback< void, Ptr< const Packet >, Mac48Address, Mac48Address > upCallback)=0
A base class which provides memory management and object aggregation.
Definition: object.h:87
virtual Mac48Address GetAddress(void) const =0
virtual void SetShortSlotTimeSupported(bool enable)=0
Enable or disable short slot time feature.
static Time GetDefaultEifsNoDifs(void)
Definition: wifi-mac.cc:66
static Time GetDefaultRifs(void)
Definition: wifi-mac.cc:59
static Time GetDefaultBasicBlockAckTimeout(void)
Return the default basic BlockAck timeout.
Definition: wifi-mac.cc:108
void Configure80211ax_2_4Ghz(void)
This method sets 802.11ax 2.4 GHz standards-compliant defaults for following attributes: SIFS...
Definition: wifi-mac.cc:397
a unique identifier for an interface.
Definition: type-id.h:58
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:128
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
virtual Time GetEifsNoDifs(void) const =0
virtual void SetSlot(Time slotTime)=0