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-standards.h"
26 #include "qos-utils.h"
27 
28 namespace ns3 {
29 
30 class Ssid;
31 class Txop;
32 class WifiNetDevice;
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 {
60 };
61 
71 class WifiMac : public Object
72 {
73 public:
74  virtual void DoDispose ();
75 
80  static TypeId GetTypeId (void);
81 
87  void SetDevice (const Ptr<WifiNetDevice> device);
93  Ptr<WifiNetDevice> GetDevice (void) const;
94 
102  virtual void SetTypeOfStation (TypeOfStation type) = 0;
108  virtual TypeOfStation GetTypeOfStation (void) const = 0;
109 
113  virtual void SetSsid (Ssid ssid) = 0;
120  virtual void SetShortSlotTimeSupported (bool enable) = 0;
128  virtual void SetPromisc (void) = 0;
129 
133  virtual Mac48Address GetAddress (void) const = 0;
137  virtual Ssid GetSsid (void) const = 0;
141  virtual void SetAddress (Mac48Address address) = 0;
145  virtual Mac48Address GetBssid (void) const = 0;
149  virtual bool GetShortSlotTimeSupported (void) const = 0;
150 
162  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) = 0;
171  virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
179  virtual bool SupportsSendFrom (void) const = 0;
183  virtual void SetWifiPhy (Ptr<WifiPhy> phy) = 0;
187  virtual Ptr<WifiPhy> GetWifiPhy (void) const = 0;
191  virtual void ResetWifiPhy (void) = 0;
200 
210 
215  virtual void SetForwardUpCallback (ForwardUpCallback upCallback) = 0;
219  virtual void SetLinkUpCallback (Callback<void> linkUp) = 0;
223  virtual void SetLinkDownCallback (Callback<void> linkDown) = 0;
224  /* Next functions are not pure virtual so non QoS WifiMacs are not
225  * forced to implement them.
226  */
227 
235  void NotifyTx (Ptr<const Packet> packet);
243  void NotifyTxDrop (Ptr<const Packet> packet);
249  void NotifyRx (Ptr<const Packet> packet);
255  void NotifyPromiscRx (Ptr<const Packet> packet);
261  void NotifyRxDrop (Ptr<const Packet> packet);
262 
270  virtual void ConfigureStandard (WifiStandard standard) = 0;
271 
284 
285 
286 protected:
296  void ConfigureDcf (Ptr<Txop> dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac);
297 
298 
299 private:
301 
339 };
340 
341 } //namespace ns3
342 
343 #endif /* WIFI_MAC_H */
344 
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::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:193
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::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:331
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< WifiNetDevice >
ns3::WifiMac::SetDevice
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
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:72
ns3::WifiMac::GetHeConfiguration
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:199
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:323
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:315
ns3::WifiMac::GetHtConfiguration
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:187
ns3::OCB
@ OCB
Definition: wifi-mac.h:46
ns3::WIFI_MAC_DROP_QOS_OLD_PACKET
@ WIFI_MAC_DROP_QOS_OLD_PACKET
Definition: wifi-mac.h:59
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:338
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::GetDevice
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:91
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::m_device
Ptr< WifiNetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:300
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:209
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:308
ns3::MESH
@ MESH
Definition: wifi-mac.h:45
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