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 "wifi-phy-standard.h"
26 #include "qos-utils.h"
27 
28 namespace ns3 {
29 
30 class Ssid;
31 class Txop;
32 
42 class WifiMac : public Object
43 {
44 public:
49  static TypeId GetTypeId (void);
50 
54  virtual void SetSlot (Time slotTime) = 0;
58  virtual void SetSifs (Time sifs) = 0;
65  virtual void SetEifsNoDifs (Time eifsNoDifs) = 0;
69  virtual void SetPifs (Time pifs) = 0;
73  virtual void SetRifs (Time rifs) = 0;
77  virtual void SetCtsTimeout (Time ctsTimeout) = 0;
81  virtual void SetAckTimeout (Time ackTimeout) = 0;
87  void SetMaxPropagationDelay (Time delay);
91  virtual void SetSsid (Ssid ssid) = 0;
96  virtual void SetShortSlotTimeSupported (bool enable) = 0;
104  virtual void SetPromisc (void) = 0;
105 
109  virtual Time GetRifs (void) const = 0;
113  virtual Time GetPifs (void) const = 0;
117  virtual Time GetSifs (void) const = 0;
121  virtual Time GetSlot (void) const = 0;
125  virtual Time GetEifsNoDifs (void) const = 0;
129  virtual Time GetCtsTimeout (void) const = 0;
133  virtual Time GetAckTimeout (void) const = 0;
137  virtual Mac48Address GetAddress (void) const = 0;
141  virtual Ssid GetSsid (void) const = 0;
145  virtual void SetAddress (Mac48Address address) = 0;
149  virtual Mac48Address GetBssid (void) const = 0;
153  virtual bool GetShortSlotTimeSupported (void) const = 0;
157  virtual bool GetRifsSupported (void) const = 0;
158 
170  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from) = 0;
179  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
187  virtual bool SupportsSendFrom (void) const = 0;
191  virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
195  virtual Ptr<WifiPhy> GetWifiPhy (void) const = 0;
199  virtual void ResetWifiPhy (void) = 0;
203  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
208 
212  virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback) = 0;
216  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
220  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
221  /* Next functions are not pure virtual so non Qos WifiMacs are not
222  * forced to implement them.
223  */
224 
230  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout) = 0;
234  virtual Time GetBasicBlockAckTimeout (void) const = 0;
240  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout) = 0;
244  virtual Time GetCompressedBlockAckTimeout (void) const = 0;
245 
253  void NotifyTx (Ptr<const Packet> packet);
261  void NotifyTxDrop (Ptr<const Packet> packet);
267  void NotifyRx (Ptr<const Packet> packet);
273  void NotifyPromiscRx (Ptr<const Packet> packet);
279  void NotifyRxDrop (Ptr<const Packet> packet);
280 
299  void ConfigureStandard (WifiPhyStandard standard);
300 
301 
302 protected:
312  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
313 
314 
315 private:
322  static Time GetDefaultMaxPropagationDelay (void);
328  static Time GetDefaultSlot (void);
334  static Time GetDefaultSifs (void);
340  static Time GetDefaultRifs (void);
347  static Time GetDefaultEifsNoDifs (void);
353  static Time GetDefaultCtsAckDelay (void);
362  static Time GetDefaultCtsAckTimeout (void);
369  static Time GetDefaultBasicBlockAckDelay (void);
375  static Time GetDefaultBasicBlockAckTimeout (void);
389 
398  virtual void FinishConfigureStandard (WifiPhyStandard standard) = 0;
399 
401 
406  void Configure80211a (void);
411  void Configure80211b (void);
417  void Configure80211g (void);
422  void Configure80211_10Mhz (void);
427  void Configure80211_5Mhz ();
433  void Configure80211n_2_4Ghz (void);
438  void Configure80211n_5Ghz (void);
443  void Configure80211ac (void);
449  void Configure80211ax_2_4Ghz (void);
454  void Configure80211ax_5Ghz (void);
455 
493 };
494 
495 } //namespace ns3
496 
497 #endif /* WIFI_MAC_H */
498 
virtual Time GetPifs(void) const =0
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
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:307
Callback template class.
Definition: callback.h:1176
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:34
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:492
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:68
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:378
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:469
void ConfigureStandard(WifiPhyStandard standard)
Definition: wifi-mac.cc:248
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:242
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:477
static Time GetDefaultSifs(void)
Definition: wifi-mac.cc:48
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)=0
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:399
virtual void SetSsid(Ssid ssid)=0
void Configure80211ax_5Ghz(void)
This method sets 802.11ax 5 GHz standards-compliant defaults for following attributes: Sifs...
Definition: wifi-mac.cc:392
phy
Definition: third.py:86
virtual Ssid GetSsid(void) const =0
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
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:462
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:42
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:224
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
ssid
Definition: third.py:93
virtual Time GetSlot(void) const =0
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:236
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:368
void Configure80211_10Mhz(void)
This method sets 802.11 with 10Mhz channel spacing standards-compliant defaults for following attribu...
Definition: wifi-mac.cc:335
virtual void SetBasicBlockAckTimeout(Time blockAckTimeout)=0
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:218
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:359
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:37
static Time GetDefaultSlot(void)
Definition: wifi-mac.cc:41
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:319
virtual void SetCtsTimeout(Time ctsTimeout)=0
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:230
static Time GetDefaultBasicBlockAckDelay(void)
Return the default basic block ACK delay.
Definition: wifi-mac.cc:89
virtual bool GetRifsSupported(void) const =0
static Time GetDefaultCompressedBlockAckDelay(void)
Return the default compressed block ACK delay.
Definition: wifi-mac.cc:96
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:485
void SetMaxPropagationDelay(Time delay)
Definition: wifi-mac.cc:211
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:295
void Configure80211_5Mhz()
This method sets 802.11 with 5Mhz channel spacing standards-compliant defaults for following attribut...
Definition: wifi-mac.cc:347
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
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)=0
static Time GetDefaultCompressedBlockAckTimeout(void)
Return the default compressed block ACK timeout.
Definition: wifi-mac.cc:114
static Time GetDefaultCtsAckTimeout(void)
Definition: wifi-mac.cc:75
Time m_maxPropagationDelay
maximum propagation delay
Definition: wifi-mac.h:400
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
static Time GetDefaultEifsNoDifs(void)
Definition: wifi-mac.cc:62
static Time GetDefaultRifs(void)
Definition: wifi-mac.cc:55
static Time GetDefaultBasicBlockAckTimeout(void)
Return the default basic block ACK timeout.
Definition: wifi-mac.cc:104
virtual Time GetCtsTimeout(void) const =0
void Configure80211ax_2_4Ghz(void)
This method sets 802.11ax 2.4 GHz standards-compliant defaults for following attributes: Sifs...
Definition: wifi-mac.cc:385
a unique identifier for an interface.
Definition: type-id.h:58
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:124
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:37
virtual Time GetEifsNoDifs(void) const =0
virtual void SetSlot(Time slotTime)=0
virtual void SetForwardUpCallback(Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > upCallback)=0