A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef REGULAR_WIFI_MAC_H
21 #define REGULAR_WIFI_MAC_H
22 
23 #include "ns3/wifi-mac.h"
24 
25 #include "dca-txop.h"
26 #include "edca-txop-n.h"
28 #include "ssid.h"
29 #include "qos-utils.h"
30 
31 #include <map>
32 
33 namespace ns3 {
34 
35 class Dcf;
36 class MacLow;
37 class MacRxMiddle;
38 class MacTxMiddle;
39 class DcfManager;
40 
50 class RegularWifiMac : public WifiMac
51 {
52 public:
53  static TypeId GetTypeId (void);
54 
55  RegularWifiMac ();
56  virtual ~RegularWifiMac ();
57 
61  void SetSlot (Time slotTime);
65  void SetSifs (Time sifs);
72  void SetEifsNoDifs (Time eifsNoDifs);
76  void SetPifs (Time pifs);
77 
78  void SetRifs (Time rifs);
82  void SetCtsTimeout (Time ctsTimeout);
86  void SetAckTimeout (Time ackTimeout);
87 
88  Time GetRifs (void) const;
92  Time GetPifs (void) const;
96  Time GetSifs (void) const;
100  Time GetSlot (void) const;
104  Time GetEifsNoDifs (void) const;
108  Time GetCtsTimeout (void) const;
112  Time GetAckTimeout (void) const;
113 
114  void SetCtsToSelfSupported (bool enable);
115 
116  bool GetCtsToSelfSupported () const;
120  virtual Mac48Address GetAddress (void) const;
124  virtual Ssid GetSsid (void) const;
128  virtual void SetAddress (Mac48Address address);
132  virtual void SetSsid (Ssid ssid);
136  virtual void SetBssid (Mac48Address bssid);
140  virtual Mac48Address GetBssid (void) const;
148  virtual void SetPromisc (void);
149 
161  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
162  virtual bool SupportsSendFrom (void) const;
163 
172  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
176  virtual void SetWifiPhy (Ptr<WifiPhy> phy);
180  virtual Ptr<WifiPhy> GetWifiPhy () const;
184  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
189 
204  virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
208  virtual void SetLinkUpCallback (Callback<void> linkUp);
212  virtual void SetLinkDownCallback (Callback<void> linkDown);
213  /* Next functions are not pure virtual so non Qos WifiMacs are not
214  * forced to implement them.
215  */
216  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
217  virtual Time GetBasicBlockAckTimeout (void) const;
218  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
219  virtual Time GetCompressedBlockAckTimeout (void) const;
220 
221 protected:
222  virtual void DoInitialize ();
223  virtual void DoDispose ();
224 
230 
232 
236 
238 
242 
245  typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
249 
262  virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
263 
272  void SetTypeOfStation (TypeOfStation type);
273 
288  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
289  virtual void TxOk (const WifiMacHeader &hdr);
290  virtual void TxFailed (const WifiMacHeader &hdr);
291 
292  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
293 
301  virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
302  const WifiMacHeader *hdr);
303 
311  virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
312  Mac48Address originator);
313 
329  void SetQosSupported (bool enable);
331  bool GetQosSupported () const;
332 
348  void SetHtSupported (bool enable);
350  bool GetHtSupported () const;
351 
352 private:
353  RegularWifiMac (const RegularWifiMac &);
355 
362  void SetupEdcaQueue (enum AcIndex ac);
363 
365  Ptr<DcaTxop> GetDcaTxop (void) const;
366 
368  Ptr<EdcaTxopN> GetVOQueue (void) const;
370  Ptr<EdcaTxopN> GetVIQueue (void) const;
372  Ptr<EdcaTxopN> GetBEQueue (void) const;
374  Ptr<EdcaTxopN> GetBKQueue (void) const;
375 
378 };
379 
380 } // namespace ns3
381 
382 #endif /* REGULAR_WIFI_MAC_H */