A Discrete-Event Network Simulator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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 #ifndef WIFI_MAC_H
21 #define WIFI_MAC_H
23 #include "ns3/packet.h"
24 #include "ns3/mac48-address.h"
26 #include "wifi-phy.h"
28 #include "ssid.h"
29 #include "qos-utils.h"
31 namespace ns3 {
33 class Dcf;
44 class WifiMac : public Object
45 {
46 public:
47  static TypeId GetTypeId (void);
52  virtual void SetSlot (Time slotTime) = 0;
56  virtual void SetSifs (Time sifs) = 0;
63  virtual void SetEifsNoDifs (Time eifsNoDifs) = 0;
67  virtual void SetPifs (Time pifs) = 0;
72  virtual void SetRifs (Time rifs) = 0;
76  virtual void SetCtsTimeout (Time ctsTimeout) = 0;
80  virtual void SetAckTimeout (Time ackTimeout) = 0;
86  void SetMaxPropagationDelay (Time delay);
91  virtual Time GetRifs (void) const = 0;
96  virtual Time GetPifs (void) const = 0;
100  virtual Time GetSifs (void) const = 0;
104  virtual Time GetSlot (void) const = 0;
108  virtual Time GetEifsNoDifs (void) const = 0;
112  virtual Time GetCtsTimeout (void) const = 0;
116  virtual Time GetAckTimeout (void) const = 0;
122  Time GetMsduLifetime (void) const;
128  Time GetMaxPropagationDelay (void) const;
133  virtual Mac48Address GetAddress (void) const = 0;
137  virtual Ssid GetSsid (void) const = 0;
141  virtual void SetAddress (Mac48Address address) = 0;
145  virtual void SetSsid (Ssid ssid) = 0;
149  virtual Mac48Address GetBssid (void) const = 0;
157  virtual void SetPromisc (void) = 0;
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 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
199  virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback) = 0;
203  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
207  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
208  /* Next functions are not pure virtual so non Qos WifiMacs are not
209  * forced to implement them.
210  */
217  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
221  virtual Time GetBasicBlockAckTimeout (void) const;
227  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
231  virtual Time GetCompressedBlockAckTimeout (void) const;
240  void NotifyTx (Ptr<const Packet> packet);
249  void NotifyTxDrop (Ptr<const Packet> packet);
257  void NotifyRx (Ptr<const Packet> packet);
265  void NotifyPromiscRx (Ptr<const Packet> packet);
273  void NotifyRxDrop (Ptr<const Packet> packet);
277  void ConfigureStandard (enum WifiPhyStandard standard);
279 protected:
288  void ConfigureDcf (Ptr<Dcf> dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac);
289 private:
296  static Time GetDefaultMaxPropagationDelay (void);
302  static Time GetDefaultSlot (void);
308  static Time GetDefaultSifs (void);
314  static Time GetDefaultRifs (void);
321  static Time GetDefaultEifsNoDifs (void);
327  static Time GetDefaultCtsAckDelay (void);
336  static Time GetDefaultCtsAckTimeout (void);
343  static Time GetDefaultBasicBlockAckDelay (void);
349  static Time GetDefaultBasicBlockAckTimeout (void);
371  virtual void FinishConfigureStandard (enum WifiPhyStandard standard) = 0;
378  void Configure80211a (void);
382  void Configure80211b (void);
386  void Configure80211g (void);
390  void Configure80211_10Mhz (void);
394  void Configure80211_5Mhz ();
398  void Configure80211n_2_4Ghz (void);
402  void Configure80211n_5Ghz (void);
446 };
448 } // namespace ns3
450 #endif /* WIFI_MAC_H */
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)=0
virtual Time GetPifs(void) const =0
virtual void SetBasicBlockAckTimeout(Time blockAckTimeout)
Definition: wifi-mac.cc:112
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
virtual Time GetRifs(void) const =0
void Configure80211b(void)
Configure appropriate timing parameters for 802.11b.
Definition: wifi-mac.cc:322
Callback template class.
Definition: callback.h:924
virtual void SetPifs(Time pifs)=0
virtual void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Definition: wifi-mac.cc:125
virtual Mac48Address GetBssid(void) const =0
virtual void SetAckTimeout(Time ackTimeout)=0
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
virtual void SetWifiPhy(Ptr< WifiPhy > phy)=0
virtual Time GetCompressedBlockAckTimeout(void) const
Definition: wifi-mac.cc:131
static Time GetDefaultMaxPropagationDelay(void)
Definition: wifi-mac.cc:31
void ConfigureStandard(enum WifiPhyStandard standard)
Definition: wifi-mac.cc:275
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:444
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:60
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:418
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:269
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:427
static Time GetDefaultSifs(void)
Definition: wifi-mac.cc:43
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)=0
virtual void SetSsid(Ssid ssid)=0
virtual Ssid GetSsid(void) const =0
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:410
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:44
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:251
void ConfigureDcf(Ptr< Dcf > dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac)
Definition: wifi-mac.cc:384
virtual Time GetSlot(void) const =0
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:263
virtual void SetAddress(Mac48Address address)=0
void Configure80211n_5Ghz(void)
Configure appropriate timing parameters for 802.11n operating at 5Ghz.
Definition: wifi-mac.cc:375
void Configure80211_10Mhz(void)
Configure appropriate timing parameters for 802.11 with 10Mhz channel spacing.
Definition: wifi-mac.cc:345
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:245
virtual void SetRifs(Time rifs)=0
void Configure80211n_2_4Ghz(void)
Configure appropriate timing parameters for 802.11n operating at 2.4Ghz.
Definition: wifi-mac.cc:367
static Time GetDefaultSlot(void)
Definition: wifi-mac.cc:37
virtual void SetEifsNoDifs(Time eifsNoDifs)=0
an EUI-48 address
Definition: mac48-address.h:41
void Configure80211g(void)
Configure appropriate timing parameters for 802.11g.
Definition: wifi-mac.cc:333
virtual void SetCtsTimeout(Time ctsTimeout)=0
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
Time GetMaxPropagationDelay(void) const
Definition: wifi-mac.cc:239
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:257
static Time GetDefaultBasicBlockAckDelay(void)
Return the default basic block ACK delay.
Definition: wifi-mac.cc:80
static Time GetDefaultCompressedBlockAckDelay(void)
Return the default compressed block ACK delay.
Definition: wifi-mac.cc:86
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:436
void SetMaxPropagationDelay(Time delay)
Definition: wifi-mac.cc:228
void Configure80211a(void)
Configure appropriate timing parameters for 802.11a.
Definition: wifi-mac.cc:311
void Configure80211_5Mhz()
Configure appropriate timing parameters for 802.11 with 5Mhz channel spacing.
Definition: wifi-mac.cc:356
virtual void SetSifs(Time sifs)=0
virtual Time GetSifs(void) const =0
virtual bool SupportsSendFrom(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:102
static Time GetDefaultCtsAckTimeout(void)
Definition: wifi-mac.cc:66
Time m_maxPropagationDelay
Definition: wifi-mac.h:373
a base class which provides memory management and object aggregation
Definition: object.h:64
tuple address
Definition: first.py:37
virtual Mac48Address GetAddress(void) const =0
static Time GetDefaultEifsNoDifs(void)
Definition: wifi-mac.cc:55
static Time GetDefaultRifs(void)
Definition: wifi-mac.cc:49
static Time GetDefaultBasicBlockAckTimeout(void)
Return the default basic block ACK timeout.
Definition: wifi-mac.cc:93
Time GetMsduLifetime(void) const
Definition: wifi-mac.cc:234
virtual Time GetCtsTimeout(void) const =0
a unique identifier for an interface.
Definition: type-id.h:49
static TypeId GetTypeId(void)
Definition: wifi-mac.cc:138
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:35
virtual Time GetBasicBlockAckTimeout(void) const
Definition: wifi-mac.cc:118
virtual Time GetEifsNoDifs(void) const =0
virtual void SetSlot(Time slotTime)=0
virtual void SetForwardUpCallback(Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > upCallback)=0