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 
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 SetSsid (Ssid ssid) = 0;
80  virtual void SetShortSlotTimeSupported (bool enable) = 0;
88  virtual void SetPromisc (void) = 0;
89 
93  virtual Mac48Address GetAddress (void) const = 0;
97  virtual Ssid GetSsid (void) const = 0;
101  virtual void SetAddress (Mac48Address address) = 0;
105  virtual Mac48Address GetBssid (void) const = 0;
109  virtual bool GetShortSlotTimeSupported (void) const = 0;
110 
122  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) = 0;
131  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
139  virtual bool SupportsSendFrom (void) const = 0;
143  virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
147  virtual Ptr<WifiPhy> GetWifiPhy (void) const = 0;
151  virtual void ResetWifiPhy (void) = 0;
155  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager) = 0;
160 
165  virtual void SetForwardUpCallback (Callback<void, Ptr<const Packet>, Mac48Address, Mac48Address> upCallback) = 0;
169  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
173  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
174  /* Next functions are not pure virtual so non QoS WifiMacs are not
175  * forced to implement them.
176  */
177 
185  void NotifyTx (Ptr<const Packet> packet);
193  void NotifyTxDrop (Ptr<const Packet> packet);
199  void NotifyRx (Ptr<const Packet> packet);
205  void NotifyPromiscRx (Ptr<const Packet> packet);
211  void NotifyRxDrop (Ptr<const Packet> packet);
212 
220  virtual void ConfigureStandard (WifiStandard standard) = 0;
221 
234 
235 
236 protected:
246  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
247 
248 
249 private:
251 
289 };
290 
291 } //namespace ns3
292 
293 #endif /* WIFI_MAC_H */
294 
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:195
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
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:288
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:265
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:118
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:273
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:124
virtual void SetSsid(Ssid ssid)=0
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:88
phy
Definition: third.py:93
virtual Ssid GetSsid(void) const =0
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:181
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:82
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:258
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:46
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:100
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
ssid
Definition: third.py:100
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:112
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:76
virtual void SetAddress(Mac48Address address)=0
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:94
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:106
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:281
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:188
virtual bool GetShortSlotTimeSupported(void) const =0
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:250
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.
a unique identifier for an interface.
Definition: type-id.h:58
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:38
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38