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 
Callback template class.
Definition: callback.h:1279
an EUI-48 address
Definition: mac48-address.h:44
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:71
Ptr< HtConfiguration > GetHtConfiguration(void) const
Definition: wifi-mac.cc:184
virtual void SetWifiPhy(Ptr< WifiPhy > phy)=0
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)=0
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-mac.cc:198
virtual void SetSsid(Ssid ssid)=0
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const =0
virtual Mac48Address GetAddress(void) const =0
virtual void ConfigureStandard(WifiStandard standard)=0
virtual Mac48Address GetBssid(void) const =0
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to)=0
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
void ConfigureDcf(Ptr< Txop > dcf, uint32_t cwmin, uint32_t cwmax, bool isDsss, AcIndex ac)
Definition: wifi-mac.cc:127
virtual void SetTypeOfStation(TypeOfStation type)=0
This method is invoked by a subclass to specify what type of station it is implementing.
virtual void DoDispose()
Destructor implementation.
Definition: wifi-mac.cc:79
virtual void SetLinkUpCallback(Callback< void > linkUp)=0
virtual TypeOfStation GetTypeOfStation(void) const =0
Return the type of station.
virtual Ssid GetSsid(void) const =0
void NotifyPromiscRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:115
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-mac.cc:38
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
virtual Ptr< WifiPhy > GetWifiPhy(void) const =0
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
void NotifyTx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:97
void NotifyRx(Ptr< const Packet > packet)
Definition: wifi-mac.cc:109
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
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
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Definition: wifi-mac.cc:191
virtual bool GetShortSlotTimeSupported(void) const =0
virtual void SetPromisc(void)=0
Sets the interface in promiscuous mode.
virtual void SetShortSlotTimeSupported(bool enable)=0
Enable or disable short slot time feature.
Ptr< NetDevice > m_device
Pointer to the device.
Definition: wifi-mac.h:299
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)=0
virtual void SetLinkDownCallback(Callback< void > linkDown)=0
virtual void SetAddress(Mac48Address address)=0
void NotifyRxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:121
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:91
virtual void ResetWifiPhy(void)=0
Remove currently attached WifiPhy device from this MAC.
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
void NotifyTxDrop(Ptr< const Packet > packet)
Definition: wifi-mac.cc:103
virtual bool SupportsSendFrom(void) const =0
virtual void SetForwardUpCallback(ForwardUpCallback upCallback)=0
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TypeOfStation
Enumeration for type of station.
Definition: wifi-mac.h:41
@ ADHOC_STA
Definition: wifi-mac.h:44
@ MESH
Definition: wifi-mac.h:45
@ STA
Definition: wifi-mac.h:42
@ AP
Definition: wifi-mac.h:43
@ OCB
Definition: wifi-mac.h:46
@ WIFI_MAC_DROP_FAILED_ENQUEUE
Definition: wifi-mac.h:56
@ WIFI_MAC_DROP_EXPIRED_LIFETIME
Definition: wifi-mac.h:57
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
Definition: wifi-mac.h:58
ssid
Definition: third.py:100
phy
Definition: third.py:93