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-standards.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 
41 {
42  STA,
43  AP,
47 };
48 
54 enum WifiMacDropReason : uint8_t
55 {
59 };
60 
70 class WifiMac : public Object
71 {
72 public:
73  virtual void DoDispose ();
74 
79  static TypeId GetTypeId (void);
80 
86  void SetDevice (const Ptr<NetDevice> device);
92  Ptr<NetDevice> GetDevice (void) const;
93 
101  virtual void SetTypeOfStation (TypeOfStation type) = 0;
107  virtual TypeOfStation GetTypeOfStation (void) const = 0;
108 
112  virtual void SetSsid (Ssid ssid) = 0;
119  virtual void SetShortSlotTimeSupported (bool enable) = 0;
127  virtual void SetPromisc (void) = 0;
128 
132  virtual Mac48Address GetAddress (void) const = 0;
136  virtual Ssid GetSsid (void) const = 0;
140  virtual void SetAddress (Mac48Address address) = 0;
144  virtual Mac48Address GetBssid (void) const = 0;
148  virtual bool GetShortSlotTimeSupported (void) const = 0;
149 
161  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) = 0;
170  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
178  virtual bool SupportsSendFrom (void) const = 0;
182  virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
186  virtual Ptr<WifiPhy> GetWifiPhy (void) const = 0;
190  virtual void ResetWifiPhy (void) = 0;
194  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
199 
204  virtual void SetForwardUpCallback (Callback<void, Ptr<const Packet>, Mac48Address, Mac48Address> upCallback) = 0;
208  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
212  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
213  /* Next functions are not pure virtual so non QoS WifiMacs are not
214  * forced to implement them.
215  */
216 
224  void NotifyTx (Ptr<const Packet> packet);
232  void NotifyTxDrop (Ptr<const Packet> packet);
238  void NotifyRx (Ptr<const Packet> packet);
244  void NotifyPromiscRx (Ptr<const Packet> packet);
250  void NotifyRxDrop (Ptr<const Packet> packet);
251 
259  virtual void ConfigureStandard (WifiStandard standard) = 0;
260 
273 
274 
275 protected:
285  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
286 
287 
288 private:
290 
328 };
329 
330 } //namespace ns3
331 
332 #endif /* WIFI_MAC_H */
333 
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:198
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Callback template class.
Definition: callback.h:1278
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:57
virtual Mac48Address GetBssid(void) const =0
Forward calls to a chain of Callback.
virtual void SetWifiPhy(Ptr< WifiPhy > phy)=0
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:327
virtual void SetLinkDownCallback(Callback< void > linkDown)=0
virtual void SetPromisc(void)=0
Sets the interface in promiscuous mode.
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:304
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:121
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:312
virtual void ConfigureStandard(WifiStandard standard)=0
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:127
virtual void SetSsid(Ssid ssid)=0
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:91
phy
Definition: third.py:93
virtual Ssid GetSsid(void) const =0
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:184
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
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:297
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:70
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:103
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
ssid
Definition: third.py:100
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:115
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:79
virtual void SetAddress(Mac48Address address)=0
virtual void SetTypeOfStation(TypeOfStation type)=0
This method is invoked by a subclass to specify what type of station it is implementing.
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:97
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.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
address
Definition: first.py:44
an EUI-48 address
Definition: mac48-address.h:43
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:35
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:109
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:320
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:191
virtual bool GetShortSlotTimeSupported(void) const =0
virtual TypeOfStation GetTypeOfStation(void) const =0
Return the type of station.
virtual bool SupportsSendFrom(void) const =0
virtual Ptr< WifiPhy > GetWifiPhy(void) const =0
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:289
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
TypeOfStation
Enumeration for type of station.
Definition: wifi-mac.h:40
virtual Mac48Address GetAddress(void) const =0
virtual void SetShortSlotTimeSupported(bool enable)=0
Enable or disable short slot time feature.
a unique identifier for an interface.
Definition: type-id.h:58
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:38
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:54