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,
46  OCB
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;
199 
209 
214  virtual void SetForwardUpCallback (ForwardUpCallback upCallback) = 0;
218  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
222  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
223  /* Next functions are not pure virtual so non QoS WifiMacs are not
224  * forced to implement them.
225  */
226 
234  void NotifyTx (Ptr<const Packet> packet);
242  void NotifyTxDrop (Ptr<const Packet> packet);
248  void NotifyRx (Ptr<const Packet> packet);
254  void NotifyPromiscRx (Ptr<const Packet> packet);
260  void NotifyRxDrop (Ptr<const Packet> packet);
261 
269  virtual void ConfigureStandard (WifiStandard standard) = 0;
270 
283 
284 
285 protected:
295  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
296 
297 
298 private:
300 
338 };
339 
340 } //namespace ns3
341 
342 #endif /* WIFI_MAC_H */
343 
ns3::WifiMac::NotifyPromiscRx
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:115
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::WifiMac::SetDevice
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
ns3::WifiMac::NotifyTxDrop
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:103
ns3::WifiMacDropReason
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
ns3::Callback
Callback template class.
Definition: callback.h:1279
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMac::NotifyTx
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:97
qos-utils.h
ns3::WifiMac::GetWifiPhy
virtual Ptr< WifiPhy > GetWifiPhy(void) const =0
ns3::WifiMac::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:79
ns3::WifiMac::GetShortSlotTimeSupported
virtual bool GetShortSlotTimeSupported(void) const =0
ns3::WifiMac::SetShortSlotTimeSupported
virtual void SetShortSlotTimeSupported(bool enable)=0
Enable or disable short slot time feature.
ns3::WifiMac::GetAddress
virtual Mac48Address GetAddress(void) const =0
ns3::WIFI_MAC_DROP_REACHED_RETRY_LIMIT
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
Definition: wifi-mac.h:58
wifi-remote-station-manager.h
ns3::WIFI_MAC_DROP_EXPIRED_LIFETIME
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
Definition: wifi-mac.h:57
ns3::WifiMac::GetVhtConfiguration
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:191
ns3::WifiMac::NotifyRx
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:109
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::WifiMac::m_device
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:299
ns3::ADHOC_STA
@ ADHOC_STA
Definition: wifi-mac.h:44
ns3::TypeOfStation
TypeOfStation
Enumeration for type of station.
Definition: wifi-mac.h:41
ns3::WifiMac::m_macRxTrace
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:330
ns3::WifiMac::SetLinkUpCallback
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
ns3::AP
@ AP
Definition: wifi-mac.h:43
ns3::Ssid
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
wifi-standards.h
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::WifiMac::GetTypeOfStation
virtual TypeOfStation GetTypeOfStation(void) const =0
Return the type of station.
ns3::WifiMac::SetWifiPhy
virtual void SetWifiPhy(Ptr< WifiPhy > phy)=0
ns3::WifiMac
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:71
ns3::WifiMac::GetHeConfiguration
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:198
ns3::WifiMac::SetPromisc
virtual void SetPromisc(void)=0
Sets the interface in promiscuous mode.
ns3::WifiMac::SupportsSendFrom
virtual bool SupportsSendFrom(void) const =0
ns3::WifiMac::Enqueue
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to)=0
first.address
address
Definition: first.py:44
ns3::WIFI_MAC_DROP_FAILED_ENQUEUE
@ WIFI_MAC_DROP_FAILED_ENQUEUE
Definition: wifi-mac.h:56
ns3::WifiMac::ConfigureStandard
virtual void ConfigureStandard(WifiStandard standard)=0
ns3::WifiMac::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:38
ns3::WifiMac::m_macPromiscRxTrace
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:322
ns3::WifiMac::NotifyRxDrop
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:121
ns3::STA
@ STA
Definition: wifi-mac.h:42
ns3::WifiMac::GetSsid
virtual Ssid GetSsid(void) const =0
ns3::WifiMac::m_macTxDropTrace
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:314
ns3::WifiMac::GetHtConfiguration
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:184
ns3::OCB
@ OCB
Definition: wifi-mac.h:46
ns3::WifiMac::SetWifiRemoteStationManager
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)=0
ns3::WifiMac::SetLinkDownCallback
virtual void SetLinkDownCallback(Callback< void > linkDown)=0
ns3::WifiMac::GetBssid
virtual Mac48Address GetBssid(void) const =0
ns3::WifiMac::SetSsid
virtual void SetSsid(Ssid ssid)=0
third.ssid
ssid
Definition: third.py:100
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
ns3::WifiMac::GetWifiRemoteStationManager
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
ns3::WifiMac::m_macRxDropTrace
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:337
ns3::WifiMac::ConfigureDcf
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:127
ns3::WifiMac::SetAddress
virtual void SetAddress(Mac48Address address)=0
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::WifiMac::Enqueue
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)=0
ns3::WifiStandard
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
Definition: wifi-standards.h:126
ns3::WifiMac::SetForwardUpCallback
virtual void SetForwardUpCallback(ForwardUpCallback upCallback)=0
ns3::WifiMac::ForwardUpCallback
Callback< void, Ptr< const Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
Definition: wifi-mac.h:208
ns3::WifiMac::ResetWifiPhy
virtual void ResetWifiPhy(void)=0
Remove currently attached WifiPhy device from this MAC.
ns3::WifiMac::m_macTxTrace
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:307
ns3::MESH
@ MESH
Definition: wifi-mac.h:45
ns3::WifiMac::GetDevice
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:91
ns3::WifiMac::SetTypeOfStation
virtual void SetTypeOfStation(TypeOfStation type)=0
This method is invoked by a subclass to specify what type of station it is implementing.
third.phy
phy
Definition: third.py:93