A Discrete-Event Network Simulator
API
regular-wifi-mac.cc
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 #include "regular-wifi-mac.h"
22 #include "ns3/log.h"
23 #include "ns3/boolean.h"
24 #include "ns3/pointer.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/trace-source-accessor.h"
27 #include "mac-rx-middle.h"
28 #include "mac-tx-middle.h"
29 #include "mac-low.h"
30 #include "dcf.h"
31 #include "dcf-manager.h"
32 #include "wifi-phy.h"
33 #include "msdu-aggregator.h"
34 
35 namespace ns3 {
36 
37 NS_LOG_COMPONENT_DEFINE ("RegularWifiMac");
38 
39 NS_OBJECT_ENSURE_REGISTERED (RegularWifiMac);
40 
42 {
43  NS_LOG_FUNCTION (this);
44  m_rxMiddle = new MacRxMiddle ();
46 
47  m_txMiddle = new MacTxMiddle ();
48 
49  m_low = CreateObject<MacLow> ();
51 
52  m_dcfManager = new DcfManager ();
54 
55  m_dca = CreateObject<DcaTxop> ();
56  m_dca->SetLow (m_low);
57  m_dca->SetManager (m_dcfManager);
58  m_dca->SetTxMiddle (m_txMiddle);
59  m_dca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
60  m_dca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
61 
62  //Construct the EDCAFs. The ordering is important - highest
63  //priority (Table 9-1 UP-to-AC mapping; IEEE 802.11-2012) must be created
64  //first.
69 }
70 
72 {
73  NS_LOG_FUNCTION (this);
74 }
75 
76 void
78 {
79  NS_LOG_FUNCTION (this);
80  m_dca->Initialize ();
81 
82  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
83  {
84  i->second->Initialize ();
85  }
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION (this);
92  delete m_rxMiddle;
93  m_rxMiddle = 0;
94 
95  delete m_txMiddle;
96  m_txMiddle = 0;
97 
98  delete m_dcfManager;
99  m_dcfManager = 0;
100 
101  m_low->Dispose ();
102  m_low = 0;
103 
104  m_phy = 0;
105  m_stationManager = 0;
106 
107  m_dca->Dispose ();
108  m_dca = 0;
109 
110  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
111  {
112  i->second = 0;
113  }
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION (this << stationManager);
120  m_stationManager = stationManager;
123  m_low->SetWifiRemoteStationManager (stationManager);
124 
125  m_dca->SetWifiRemoteStationManager (stationManager);
126 
127  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
128  {
129  i->second->SetWifiRemoteStationManager (stationManager);
130  }
131 }
132 
135 {
136  return m_stationManager;
137 }
138 
139 void
141 {
142  NS_LOG_FUNCTION (this << ac);
143 
144  //Our caller shouldn't be attempting to setup a queue that is
145  //already configured.
146  NS_ASSERT (m_edca.find (ac) == m_edca.end ());
147 
148  Ptr<EdcaTxopN> edca = CreateObject<EdcaTxopN> ();
149  edca->SetLow (m_low);
150  edca->SetManager (m_dcfManager);
151  edca->SetTxMiddle (m_txMiddle);
152  edca->SetTxOkCallback (MakeCallback (&RegularWifiMac::TxOk, this));
153  edca->SetTxFailedCallback (MakeCallback (&RegularWifiMac::TxFailed, this));
154  edca->SetAccessCategory (ac);
155  edca->CompleteConfig ();
156  m_edca.insert (std::make_pair (ac, edca));
157 }
158 
159 void
161 {
162  NS_LOG_FUNCTION (this << type);
163  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
164  {
165  i->second->SetTypeOfStation (type);
166  }
167 }
168 
171 {
172  return m_dca;
173 }
174 
177 {
178  return m_edca.find (AC_VO)->second;
179 }
180 
183 {
184  return m_edca.find (AC_VI)->second;
185 }
186 
189 {
190  return m_edca.find (AC_BE)->second;
191 }
192 
195 {
196  return m_edca.find (AC_BK)->second;
197 }
198 
199 void
201 {
202  NS_LOG_FUNCTION (this << phy);
203  m_phy = phy;
205  m_low->SetPhy (phy);
206 }
207 
210 {
211  NS_LOG_FUNCTION (this);
212  return m_phy;
213 }
214 
215 void
217 {
218  NS_LOG_FUNCTION (this);
219  m_low->ResetPhy ();
221  m_phy = 0;
222 }
223 
224 void
226 {
227  NS_LOG_FUNCTION (this);
228  m_forwardUp = upCallback;
229 }
230 
231 void
233 {
234  NS_LOG_FUNCTION (this);
235  m_linkUp = linkUp;
236 }
237 
238 void
240 {
241  NS_LOG_FUNCTION (this);
242  m_linkDown = linkDown;
243 }
244 
245 void
247 {
248  NS_LOG_FUNCTION (this);
249  m_qosSupported = enable;
250 }
251 
252 bool
254 {
255  return m_qosSupported;
256 }
257 
258 void
260 {
261  NS_LOG_FUNCTION (this);
262  m_htSupported = enable;
263 }
264 
265 bool
267 {
268  return m_vhtSupported;
269 }
270 
271 void
273 {
274  NS_LOG_FUNCTION (this);
275  m_vhtSupported = enable;
276 }
277 
278 bool
280 {
281  return m_htSupported;
282 }
283 
284 void
286 {
287  NS_LOG_FUNCTION (this);
288  m_low->SetCtsToSelfSupported (enable);
289 }
290 
291 bool
293 {
294  return m_low->GetCtsToSelfSupported ();
295 }
296 
297 void
299 {
300  NS_LOG_FUNCTION (this << slotTime);
301  m_dcfManager->SetSlot (slotTime);
302  m_low->SetSlotTime (slotTime);
303 }
304 
305 Time
307 {
308  return m_low->GetSlotTime ();
309 }
310 
311 void
313 {
314  NS_LOG_FUNCTION (this << sifs);
315  m_dcfManager->SetSifs (sifs);
316  m_low->SetSifs (sifs);
317 }
318 
319 Time
321 {
322  return m_low->GetSifs ();
323 }
324 
325 void
327 {
328  NS_LOG_FUNCTION (this << eifsNoDifs);
329  m_dcfManager->SetEifsNoDifs (eifsNoDifs);
330 }
331 
332 Time
334 {
335  return m_dcfManager->GetEifsNoDifs ();
336 }
337 
338 void
340 {
341  NS_LOG_FUNCTION (this << rifs);
342  m_low->SetRifs (rifs);
343 }
344 
345 Time
347 {
348  return m_low->GetRifs ();
349 }
350 
351 void
353 {
354  NS_LOG_FUNCTION (this << pifs);
355  m_low->SetPifs (pifs);
356 }
357 
358 Time
360 {
361  return m_low->GetPifs ();
362 }
363 
364 void
366 {
367  NS_LOG_FUNCTION (this << ackTimeout);
368  m_low->SetAckTimeout (ackTimeout);
369 }
370 
371 Time
373 {
374  return m_low->GetAckTimeout ();
375 }
376 
377 void
379 {
380  NS_LOG_FUNCTION (this << ctsTimeout);
381  m_low->SetCtsTimeout (ctsTimeout);
382 }
383 
384 Time
386 {
387  return m_low->GetCtsTimeout ();
388 }
389 
390 void
392 {
393  NS_LOG_FUNCTION (this << blockAckTimeout);
394  m_low->SetBasicBlockAckTimeout (blockAckTimeout);
395 }
396 
397 Time
399 {
400  return m_low->GetBasicBlockAckTimeout ();
401 }
402 
403 void
405 {
406  NS_LOG_FUNCTION (this << blockAckTimeout);
407  m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
408 }
409 
410 Time
412 {
414 }
415 
416 void
418 {
419  NS_LOG_FUNCTION (this << address);
420  m_low->SetAddress (address);
421 }
422 
425 {
426  return m_low->GetAddress ();
427 }
428 
429 void
431 {
432  NS_LOG_FUNCTION (this << ssid);
433  m_ssid = ssid;
434 }
435 
436 Ssid
438 {
439  return m_ssid;
440 }
441 
442 void
444 {
445  NS_LOG_FUNCTION (this << bssid);
446  m_low->SetBssid (bssid);
447 }
448 
451 {
452  return m_low->GetBssid ();
453 }
454 
455 void
457 {
458  m_low->SetPromisc ();
459 }
460 
461 void
463  Mac48Address to, Mac48Address from)
464 {
465  //We expect RegularWifiMac subclasses which do support forwarding (e.g.,
466  //AP) to override this method. Therefore, we throw a fatal error if
467  //someone tries to invoke this method on a class which has not done
468  //this.
469  NS_FATAL_ERROR ("This MAC entity (" << this << ", " << GetAddress ()
470  << ") does not support Enqueue() with from address");
471 }
472 
473 bool
475 {
476  return false;
477 }
478 
479 void
481 {
482  NS_LOG_FUNCTION (this << packet << from);
483  m_forwardUp (packet, from, to);
484 }
485 
486 void
488 {
489  NS_LOG_FUNCTION (this << packet << hdr);
490 
491  Mac48Address to = hdr->GetAddr1 ();
492  Mac48Address from = hdr->GetAddr2 ();
493 
494  //We don't know how to deal with any frame that is not addressed to
495  //us (and odds are there is nothing sensible we could do anyway),
496  //so we ignore such frames.
497  //
498  //The derived class may also do some such filtering, but it doesn't
499  //hurt to have it here too as a backstop.
500  if (to != GetAddress ())
501  {
502  return;
503  }
504 
505  if (hdr->IsMgt () && hdr->IsAction ())
506  {
507  //There is currently only any reason for Management Action
508  //frames to be flying about if we are a QoS STA.
510 
511  WifiActionHeader actionHdr;
512  packet->RemoveHeader (actionHdr);
513 
514  switch (actionHdr.GetCategory ())
515  {
517 
518  switch (actionHdr.GetAction ().blockAck)
519  {
521  {
522  MgtAddBaRequestHeader reqHdr;
523  packet->RemoveHeader (reqHdr);
524 
525  //We've received an ADDBA Request. Our policy here is
526  //to automatically accept it, so we get the ADDBA
527  //Response on it's way immediately.
528  SendAddBaResponse (&reqHdr, from);
529  //This frame is now completely dealt with, so we're done.
530  return;
531  }
533  {
534  MgtAddBaResponseHeader respHdr;
535  packet->RemoveHeader (respHdr);
536 
537  //We've received an ADDBA Response. We assume that it
538  //indicates success after an ADDBA Request we have
539  //sent (we could, in principle, check this, but it
540  //seems a waste given the level of the current model)
541  //and act by locally establishing the agreement on
542  //the appropriate queue.
543  AcIndex ac = QosUtilsMapTidToAc (respHdr.GetTid ());
544  m_edca[ac]->GotAddBaResponse (&respHdr, from);
545  //This frame is now completely dealt with, so we're done.
546  return;
547  }
549  {
550  MgtDelBaHeader delBaHdr;
551  packet->RemoveHeader (delBaHdr);
552 
553  if (delBaHdr.IsByOriginator ())
554  {
555  //This DELBA frame was sent by the originator, so
556  //this means that an ingoing established
557  //agreement exists in MacLow and we need to
558  //destroy it.
559  m_low->DestroyBlockAckAgreement (from, delBaHdr.GetTid ());
560  }
561  else
562  {
563  //We must have been the originator. We need to
564  //tell the correct queue that the agreement has
565  //been torn down
566  AcIndex ac = QosUtilsMapTidToAc (delBaHdr.GetTid ());
567  m_edca[ac]->GotDelBaFrame (&delBaHdr, from);
568  }
569  //This frame is now completely dealt with, so we're done.
570  return;
571  }
572  default:
573  NS_FATAL_ERROR ("Unsupported Action field in Block Ack Action frame");
574  return;
575  }
576  default:
577  NS_FATAL_ERROR ("Unsupported Action frame received");
578  return;
579  }
580  }
581  NS_FATAL_ERROR ("Don't know how to handle frame (type=" << hdr->GetType ());
582 }
583 
584 void
586  const WifiMacHeader *hdr)
587 {
589  MsduAggregator::Deaggregate (aggregatedPacket);
590 
591  for (MsduAggregator::DeaggregatedMsdusCI i = packets.begin ();
592  i != packets.end (); ++i)
593  {
594  ForwardUp ((*i).first, (*i).second.GetSourceAddr (),
595  (*i).second.GetDestinationAddr ());
596  }
597 }
598 
599 void
601  Mac48Address originator)
602 {
603  NS_LOG_FUNCTION (this);
604  WifiMacHeader hdr;
605  hdr.SetAction ();
606  hdr.SetAddr1 (originator);
607  hdr.SetAddr2 (GetAddress ());
608  hdr.SetAddr3 (GetAddress ());
609  hdr.SetDsNotFrom ();
610  hdr.SetDsNotTo ();
611 
612  MgtAddBaResponseHeader respHdr;
613  StatusCode code;
614  code.SetSuccess ();
615  respHdr.SetStatusCode (code);
616  //Here a control about queues type?
617  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
618 
619  if (reqHdr->IsImmediateBlockAck ())
620  {
621  respHdr.SetImmediateBlockAck ();
622  }
623  else
624  {
625  respHdr.SetDelayedBlockAck ();
626  }
627  respHdr.SetTid (reqHdr->GetTid ());
628  //For now there's not no control about limit of reception. We
629  //assume that receiver has no limit on reception. However we assume
630  //that a receiver sets a bufferSize in order to satisfy next
631  //equation: (bufferSize + 1) % 16 = 0 So if a recipient is able to
632  //buffer a packet, it should be also able to buffer all possible
633  //packet's fragments. See section 7.3.1.14 in IEEE802.11e for more details.
634  respHdr.SetBufferSize (1023);
635  respHdr.SetTimeout (reqHdr->GetTimeout ());
636 
637  WifiActionHeader actionHdr;
640  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
641 
642  Ptr<Packet> packet = Create<Packet> ();
643  packet->AddHeader (respHdr);
644  packet->AddHeader (actionHdr);
645 
646  //We need to notify our MacLow object as it will have to buffer all
647  //correctly received packets for this Block Ack session
648  m_low->CreateBlockAckAgreement (&respHdr, originator,
649  reqHdr->GetStartingSequence ());
650 
651  //It is unclear which queue this frame should go into. For now we
652  //bung it into the queue corresponding to the TID for which we are
653  //establishing an agreement, and push it to the head.
654  m_edca[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr);
655 }
656 
657 TypeId
659 {
660  static TypeId tid = TypeId ("ns3::RegularWifiMac")
661  .SetParent<WifiMac> ()
662  .SetGroupName ("Wifi")
663  .AddAttribute ("QosSupported",
664  "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
665  BooleanValue (false),
669  .AddAttribute ("HtSupported",
670  "This Boolean attribute is set to enable 802.11n support at this STA",
671  BooleanValue (false),
675  .AddAttribute ("VhtSupported",
676  "This Boolean attribute is set to enable 802.11ac support at this STA",
677  BooleanValue (false),
681  .AddAttribute ("CtsToSelfSupported",
682  "Use CTS to Self when using a rate that is not in the basic set rate",
683  BooleanValue (false),
687  .AddAttribute ("DcaTxop", "The DcaTxop object",
688  PointerValue (),
690  MakePointerChecker<DcaTxop> ())
691  .AddAttribute ("VO_EdcaTxopN",
692  "Queue that manages packets belonging to AC_VO access class",
693  PointerValue (),
695  MakePointerChecker<EdcaTxopN> ())
696  .AddAttribute ("VI_EdcaTxopN",
697  "Queue that manages packets belonging to AC_VI access class",
698  PointerValue (),
700  MakePointerChecker<EdcaTxopN> ())
701  .AddAttribute ("BE_EdcaTxopN",
702  "Queue that manages packets belonging to AC_BE access class",
703  PointerValue (),
705  MakePointerChecker<EdcaTxopN> ())
706  .AddAttribute ("BK_EdcaTxopN",
707  "Queue that manages packets belonging to AC_BK access class",
708  PointerValue (),
710  MakePointerChecker<EdcaTxopN> ())
711  .AddTraceSource ("TxOkHeader",
712  "The header of successfully transmitted packet",
714  "ns3::WifiMacHeader::TracedCallback")
715  .AddTraceSource ("TxErrHeader",
716  "The header of unsuccessfully transmitted packet",
718  "ns3::WifiMacHeader::TracedCallback")
719  ;
720  return tid;
721 }
722 
723 void
725 {
726  uint32_t cwmin;
727  uint32_t cwmax;
728 
729  switch (standard)
730  {
739  cwmin = 15;
740  cwmax = 1023;
741  break;
743  cwmin = 31;
744  cwmax = 1023;
745  break;
746  default:
747  NS_FATAL_ERROR ("Unsupported WifiPhyStandard in RegularWifiMac::FinishConfigureStandard ()");
748  }
749 
750  //The special value of AC_BE_NQOS which exists in the Access
751  //Category enumeration allows us to configure plain old DCF.
752  ConfigureDcf (m_dca, cwmin, cwmax, AC_BE_NQOS);
753 
754  //Now we configure the EDCA functions
755  for (EdcaQueues::iterator i = m_edca.begin (); i != m_edca.end (); ++i)
756  {
757  ConfigureDcf (i->second, cwmin, cwmax, i->first);
758  }
759 }
760 
761 void
763 {
764  NS_LOG_FUNCTION (this << hdr);
765  m_txOkCallback (hdr);
766 }
767 
768 void
770 {
771  NS_LOG_FUNCTION (this << hdr);
772  m_txErrCallback (hdr);
773 }
774 
775 } //namespace ns3
void SetQosSupported(bool enable)
Enable or disable QoS support for the device.
ERP-OFDM PHY (Clause 19, Section 19.5)
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:266
void Dispose(void)
Dispose of this Object.
Definition: object.cc:208
void SetAction()
Set Type/Subtype values for an action header.
Time GetPifs(void) const
Return PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:673
void SetPifs(Time pifs)
Set PCF Interframe Space (PIFS) of this MacLow.
Definition: mac-low.cc:601
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetSifs(Time sifs)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
AttributeValue implementation for Boolean.
Definition: boolean.h:34
HT OFDM PHY for the 5 GHz band (clause 20)
bool GetVhtSupported() const
Return whether the device supports VHT.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
void SetPromisc(void)
Enable promiscuous mode.
Definition: mac-low.cc:619
ForwardUpCallback m_forwardUp
Callback to forward packet up the stack.
void SetForwardCallback(ForwardUpCallback callback)
Set a callback to forward the packet up.
bool GetCtsToSelfSupported() const
Return whether the device supports CTS-to-self capability.
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:419
static TypeId GetTypeId(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:81
bool IsAction() const
Return true if the header is an Action header.
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Definition: mac-low.cc:679
void SetSifs(Time sifs)
Set Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:589
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:538
void SetPifs(Time pifs)
virtual void SetCompressedBlockAckTimeout(Time blockAckTimeout)
void SetupLowListener(Ptr< MacLow > low)
Set up listener for MacLow events.
Definition: dcf-manager.cc:357
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
Callback< void > m_linkUp
Callback when a link is up.
MacTxMiddle * m_txMiddle
TX middle (aggregation etc.)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
enum WifiMacType GetType(void) const
Return the type (enum WifiMacType)
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > >::const_iterator DeaggregatedMsdusCI
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
virtual void SetSsid(Ssid ssid)
void SetSlot(Time slotTime)
virtual Time GetCompressedBlockAckTimeout(void) const
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:619
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:145
bool GetQosSupported() const
Return whether the device supports QoS.
void SetRxCallback(Callback< void, Ptr< Packet >, const WifiMacHeader * > callback)
Definition: mac-low.cc:691
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...
Time GetCompressedBlockAckTimeout() const
Return Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:643
virtual void SetLinkDownCallback(Callback< void > linkDown)
void SetHtSupported(bool enable)
Enable or disable HT support for the device.
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:653
HT OFDM PHY for the 2.4 GHz band (clause 20)
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetDelayedBlockAck()
Enable delayed Block ACK.
void SetRifs(Time rifs)
Time GetCtsTimeout(void) const
Return CTS timeout of this MacLow.
Definition: mac-low.cc:649
void SetStatusCode(StatusCode code)
Set the status code.
virtual Ssid GetSsid(void) const
Video.
Definition: qos-utils.h:43
Voice.
Definition: qos-utils.h:45
Best Effort.
Definition: qos-utils.h:39
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to, Mac48Address from)
void SetTimeout(uint16_t timeout)
Set timeout.
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
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
TracedCallback< const WifiMacHeader & > m_txErrCallback
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void SetCtsToSelfSupported(bool enable)
Enable or disable CTS-to-self capability.
Definition: mac-low.cc:571
Handles sequence numbering of IEEE 802.11 data frames.
Definition: mac-tx-middle.h:39
void SetBasicBlockAckTimeout(Time blockAckTimeout)
Set Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:559
void SetTid(uint8_t tid)
Set Traffic ID (TID).
virtual void SetBssid(Mac48Address bssid)
Ptr< EdcaTxopN > GetVOQueue(void) const
Accessor for the AC_VO channel access function.
Time GetSifs(void) const
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:437
Background.
Definition: qos-utils.h:41
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
void SetVhtSupported(bool enable)
Enable or disable VHT capability support.
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2419
Time GetCtsTimeout(void) const
virtual void SetForwardUpCallback(ForwardUpCallback upCallback)
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:32
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
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:220
virtual void SetBasicBlockAckTimeout(Time blockAckTimeout)
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
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.
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: mac-low.cc:2377
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
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.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
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
void ConfigureDcf(Ptr< Dcf > dcf, uint32_t cwmin, uint32_t cwmax, enum AcIndex ac)
Definition: wifi-mac.cc:411
void SetImmediateBlockAck()
Enable immediate Block ACK.
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for Phy events.
Definition: dcf-manager.cc:345
Time GetAckTimeout(void) const
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
Definition: dcf-manager.cc:333
Time GetSlot(void) const
void SetAckTimeout(Time ackTimeout)
Set ACK timeout of this MacLow.
Definition: mac-low.cc:553
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:252
enum BlockAckActionValue blockAck
Definition: mgt-headers.h:491
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:28
virtual void SetAddress(Mac48Address address)
Time GetRifs(void) const
Return Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:661
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1480
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:625
virtual void ResetWifiPhy(void)
removes attached WifiPhy device from this MAC.
bool IsMgt(void) const
Return true if the Type is Management.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
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.
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
TracedCallback< const WifiMacHeader & > m_txOkCallback
void SetHtSupported(bool enable)
Enable or disable HT capability support.
Status code for association response.
Definition: status-code.h:33
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Ptr< EdcaTxopN > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
virtual void SetLinkUpCallback(Callback< void > linkUp)
virtual void DoDispose()
Destructor implementation.
std::list< std::pair< Ptr< Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Definition: pointer.h:36
VHT OFDM PHY (clause 22)
void SetBssid(Mac48Address ad)
Set the Basic Service Set Identification.
Definition: mac-low.cc:613
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
void SetVhtSupported(bool enable)
Enable or disable HT support for the device.
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void SetBufferSize(uint16_t size)
Set buffer size.
DcfManager * m_dcfManager
DCF manager (access to channel)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
virtual Ptr< WifiPhy > GetWifiPhy(void) const
an EUI-48 address
Definition: mac48-address.h:43
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is setted.
tuple ssid
Definition: third.py:93
void SetEifsNoDifs(Time eifsNoDifs)
Definition: dcf-manager.cc:383
void SetCtsTimeout(Time ctsTimeout)
virtual bool SupportsSendFrom(void) const
void SetPhy(Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
Definition: mac-low.cc:517
uint8_t GetTid(void) const
Return the Traffic ID (TID).
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
Time GetRifs(void) const
Time GetSlotTime(void) const
Return slot duration of this MacLow.
Definition: mac-low.cc:667
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
virtual Mac48Address GetBssid(void) const
void SetSlot(Time slotTime)
Definition: dcf-manager.cc:369
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void SetRifs(Time rifs)
Set Reduced Interframe Space (RIFS) of this MacLow.
Definition: mac-low.cc:607
Ptr< EdcaTxopN > GetBKQueue(void) const
Accessor for the AC_BK channel access function.
virtual Time GetBasicBlockAckTimeout(void) const
void SetSlotTime(Time slotTime)
Set slot duration of this MacLow.
Definition: mac-low.cc:595
Time GetSifs(void) const
Return Short Interframe Space (SIFS) of this MacLow.
Definition: mac-low.cc:655
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:670
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:791
virtual Mac48Address GetAddress(void) const
typedef for union of different ActionValues
Definition: mgt-headers.h:486
Total number of ACs.
Definition: qos-utils.h:47
bool GetCtsToSelfSupported() const
Return whether CTS-to-self capability is supported.
Definition: mac-low.cc:577
Time GetEifsNoDifs() const
Definition: dcf-manager.cc:390
virtual void DoInitialize()
Initialize() implementation.
void SetCtsTimeout(Time ctsTimeout)
Set CTS timeout of this MacLow.
Definition: mac-low.cc:583
Time GetAckTimeout(void) const
Return ACK timeout of this MacLow.
Definition: mac-low.cc:631
bool GetHtSupported() const
Return whether the device supports HT.
virtual Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
Definition: mac-low.cc:547
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
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
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.)
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:674
virtual void SetPromisc(void)
Sets the interface in promiscuous mode.
void ResetPhy(void)
Remove WifiPhy associated with this MacLow.
Definition: mac-low.cc:532
Time GetBasicBlockAckTimeout() const
Return Basic Block ACK timeout of this MacLow.
Definition: mac-low.cc:637
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:826
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
void SetSifs(Time sifs)
Definition: dcf-manager.cc:376
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:255
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetCompressedBlockAckTimeout(Time blockAckTimeout)
Set Compressed Block ACK timeout of this MacLow.
Definition: mac-low.cc:565
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Definition: mac-low.cc:541
uint16_t GetTimeout(void) const
Return the timeout.
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
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...