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);
80  void SetCtsTimeout (Time ctsTimeout);
84  void SetAckTimeout (Time ackTimeout);
88  Time GetPifs (void) const;
92  Time GetSifs (void) const;
96  Time GetSlot (void) const;
100  Time GetEifsNoDifs (void) const;
104  Time GetCtsTimeout (void) const;
108  Time GetAckTimeout (void) const;
112  virtual Mac48Address GetAddress (void) const;
116  virtual Ssid GetSsid (void) const;
120  virtual void SetAddress (Mac48Address address);
124  virtual void SetSsid (Ssid ssid);
128  virtual void SetBssid (Mac48Address bssid);
132  virtual Mac48Address GetBssid (void) const;
140  virtual void SetPromisc (void);
141 
153  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
154  virtual bool SupportsSendFrom (void) const;
155 
164  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
168  virtual void SetWifiPhy (Ptr<WifiPhy> phy);
172  virtual Ptr<WifiPhy> GetWifiPhy () const;
176  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
181 
196  virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
200  virtual void SetLinkUpCallback (Callback<void> linkUp);
204  virtual void SetLinkDownCallback (Callback<void> linkDown);
205  /* Next functions are not pure virtual so non Qos WifiMacs are not
206  * forced to implement them.
207  */
208  virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
209  virtual Time GetBasicBlockAckTimeout (void) const;
210  virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
211  virtual Time GetCompressedBlockAckTimeout (void) const;
212 
213 protected:
214  virtual void DoStart ();
215  virtual void DoDispose ();
216 
222 
224 
228 
230 
234 
237  typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
241 
254  virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
255 
264  void SetTypeOfStation (TypeOfStation type);
265 
280  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
281  virtual void TxOk (const WifiMacHeader &hdr);
282  virtual void TxFailed (const WifiMacHeader &hdr);
283 
284  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
285 
293  virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
294  const WifiMacHeader *hdr);
295 
303  virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
304  Mac48Address originator);
305 
321  void SetQosSupported (bool enable);
323  bool GetQosSupported () const;
324 private:
325  RegularWifiMac (const RegularWifiMac &);
327 
334  void SetupEdcaQueue (enum AcIndex ac);
335 
337  Ptr<DcaTxop> GetDcaTxop (void) const;
338 
340  Ptr<EdcaTxopN> GetVOQueue (void) const;
342  Ptr<EdcaTxopN> GetVIQueue (void) const;
344  Ptr<EdcaTxopN> GetBEQueue (void) const;
346  Ptr<EdcaTxopN> GetBKQueue (void) const;
347 
350 };
351 
352 } // namespace ns3
353 
354 #endif /* REGULAR_WIFI_MAC_H */