This documentation is not the Latest Release.
A Discrete-Event Network Simulator
API
regular-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 REGULAR_WIFI_MAC_H
22 #define REGULAR_WIFI_MAC_H
23 
24 #include "ns3/wifi-mac.h"
25 #include "dca-txop.h"
26 #include "edca-txop-n.h"
28 #include "ssid.h"
29 #include "qos-utils.h"
30 #include <map>
31 
32 namespace ns3 {
33 
34 class Dcf;
35 class MacLow;
36 class MacRxMiddle;
37 class MacTxMiddle;
38 class DcfManager;
39 
49 class RegularWifiMac : public WifiMac
50 {
51 public:
52  static TypeId GetTypeId (void);
53 
54  RegularWifiMac ();
55  virtual ~RegularWifiMac ();
56 
60  void SetSlot (Time slotTime);
64  void SetSifs (Time sifs);
71  void SetEifsNoDifs (Time eifsNoDifs);
75  void SetPifs (Time pifs);
79  void SetRifs (Time rifs);
83  void SetCtsTimeout (Time ctsTimeout);
87  void SetAckTimeout (Time ackTimeout);
88 
89  Time GetRifs (void) const;
93  Time GetPifs (void) const;
97  Time GetSifs (void) const;
101  Time GetSlot (void) const;
105  Time GetEifsNoDifs (void) const;
109  Time GetCtsTimeout (void) const;
113  Time GetAckTimeout (void) const;
114 
121  void SetCtsToSelfSupported (bool enable);
122 
130  bool GetCtsToSelfSupported () const;
134  virtual Mac48Address GetAddress (void) const;
138  virtual Ssid GetSsid (void) const;
142  virtual void SetAddress (Mac48Address address);
146  virtual void SetSsid (Ssid ssid);
150  virtual void SetBssid (Mac48Address bssid);
154  virtual Mac48Address GetBssid (void) const;
162  virtual void SetPromisc (void);
163 
175  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
176 
177  virtual bool SupportsSendFrom (void) const;
178 
187  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
191  virtual void SetWifiPhy (Ptr<WifiPhy> phy);
195  virtual Ptr<WifiPhy> GetWifiPhy (void) const;
199  virtual void ResetWifiPhy (void);
203  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
208 
222  virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
226  virtual void SetLinkUpCallback (Callback<void> linkUp);
230  virtual void SetLinkDownCallback (Callback<void> linkDown);
231 
232  /* Next functions are not pure virtual so non Qos WifiMacs are not
233  * forced to implement them.
234  */
235  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
236  virtual Time GetBasicBlockAckTimeout (void) const;
237  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
238  virtual Time GetCompressedBlockAckTimeout (void) const;
239 
240 
241 protected:
242  virtual void DoInitialize ();
243  virtual void DoDispose ();
244 
250 
252 
253  ForwardUpCallback m_forwardUp;
256 
258 
262 
265  typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
266 
269  EdcaQueues m_edca;
270 
276  Ptr<DcaTxop> GetDcaTxop (void) const;
277 
283  Ptr<EdcaTxopN> GetVOQueue (void) const;
289  Ptr<EdcaTxopN> GetVIQueue (void) const;
295  Ptr<EdcaTxopN> GetBEQueue (void) const;
301  Ptr<EdcaTxopN> GetBKQueue (void) const;
302 
315  virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
316 
325  void SetTypeOfStation (TypeOfStation type);
326 
341  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
348  virtual void TxOk (const WifiMacHeader &hdr);
355  virtual void TxFailed (const WifiMacHeader &hdr);
356 
364  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
365 
373  virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
374  const WifiMacHeader *hdr);
375 
383  virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
384  Mac48Address originator);
385 
400 
406  void SetQosSupported (bool enable);
412  bool GetQosSupported () const;
413 
427 
433  void SetHtSupported (bool enable);
439  bool GetHtSupported () const;
440 
451  void SetVhtSupported (bool enable);
457  bool GetVhtSupported () const;
458 
459 
460 private:
461  RegularWifiMac (const RegularWifiMac &);
463 
470  void SetupEdcaQueue (enum AcIndex ac);
471 
474 };
475 
476 } //namespace ns3
477 
478 #endif /* REGULAR_WIFI_MAC_H */
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetSifs(Time sifs)
Callback template class.
Definition: callback.h:1164
RegularWifiMac & operator=(const RegularWifiMac &)
bool GetVhtSupported() const
Return whether the device supports VHT.
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
bool GetCtsToSelfSupported() const
Return whether the device supports CTS-to-self capability.
static TypeId GetTypeId(void)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Forward calls to a chain of Callback.
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:571
void SetPifs(Time pifs)
virtual void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Callback< void > m_linkUp
Callback when a link is up.
MacTxMiddle * m_txMiddle
TX middle (aggregation etc.)
virtual void SetSsid(Ssid ssid)
void SetSlot(Time slotTime)
virtual Time GetCompressedBlockAckTimeout(void) const
bool GetQosSupported() const
Return whether the device supports QoS.
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
virtual void SetLinkDownCallback(Callback< void > linkDown)
void SetHtSupported(bool enable)
Enable or disable HT support for the device.
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetRifs(Time rifs)
virtual Ssid GetSsid(void) const
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
MacRxMiddle * m_rxMiddle
RX middle (de-fragmentation etc.)
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
This class handles duplicate detection and recomposition of fragments.
Definition: mac-rx-middle.h:40
TracedCallback< const WifiMacHeader & > m_txErrCallback
Handles sequence numbering of IEEE 802.11 data frames.
Definition: mac-tx-middle.h:39
virtual void SetBssid(Mac48Address bssid)
Ptr< EdcaTxopN > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
Time GetSifs(void) const
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
std::map< AcIndex, Ptr< EdcaTxopN > > EdcaQueues
This type defines a mapping between an Access Category index, and a pointer to the corresponding chan...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Time GetCtsTimeout(void) const
virtual void SetForwardUpCallback(ForwardUpCallback upCallback)
base class for all MAC-level wifi objects.
void SetEifsNoDifs(Time eifsNoDifs)
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
tuple phy
Definition: third.py:86
virtual void SetBasicBlockAckTimeout(Time blockAckTimeout)
virtual void SetWifiPhy(Ptr< WifiPhy > phy)
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
Ptr< EdcaTxopN > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Ssid m_ssid
Service Set ID (SSID)
Ptr< DcaTxop > GetDcaTxop(void) const
Accessor for the DCF object.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:44
Time GetAckTimeout(void) const
Time GetSlot(void) const
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:252
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
virtual void SetAddress(Mac48Address address)
virtual void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
Time GetPifs(void) const
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
virtual void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
Callback< void > m_linkDown
Callback when a link is down.
TracedCallback< const WifiMacHeader & > m_txOkCallback
Ptr< EdcaTxopN > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
virtual void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetVhtSupported(bool enable)
Enable or disable VHT support for the device.
DcfManager * m_dcfManager
DCF manager (access to channel)
virtual Ptr< WifiPhy > GetWifiPhy(void) const
an EUI-48 address
Definition: mac48-address.h:43
tuple ssid
Definition: third.py:93
void SetCtsTimeout(Time ctsTimeout)
virtual bool SupportsSendFrom(void) const
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
Time GetRifs(void) const
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
virtual Mac48Address GetBssid(void) const
Ptr< EdcaTxopN > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
virtual Time GetBasicBlockAckTimeout(void) const
virtual Mac48Address GetAddress(void) const
virtual void DoInitialize()
Initialize() implementation.
bool GetHtSupported() const
Return whether the device supports HT.
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
tuple address
Definition: first.py:37
TypeOfStation
Enumeration for type of station.
Definition: edca-txop-n.h:57
Callback< void, Ptr< Packet >, Mac48Address, Mac48Address > ForwardUpCallback
This type defines the callback of a higher layer that a WifiMac(-derived) object invokes to pass a pa...
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self feature.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
virtual void SetPromisc(void)
Sets the interface in promiscuous mode.
a unique identifier for an interface.
Definition: type-id.h:58
void SetAckTimeout(Time ackTimeout)
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:36
Implements the IEEE 802.11 MAC header.
virtual void FinishConfigureStandard(enum WifiPhyStandard standard)
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Time GetEifsNoDifs(void) const
void SetupEdcaQueue(enum AcIndex ac)
This method is a private utility invoked to configure the channel access function for the specified A...