A Discrete-Event Network Simulator
API
frame-exchange-manager.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
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: Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/abort.h"
23 #include "frame-exchange-manager.h"
24 #include "wifi-utils.h"
25 #include "snr-tag.h"
26 #include "wifi-mac-queue.h"
27 #include "wifi-mac-trailer.h"
28 
29 #undef NS_LOG_APPEND_CONTEXT
30 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
31 
32 // Time (in nanoseconds) to be added to the PSDU duration to yield the duration
33 // of the timer that is started when the PHY indicates the start of the reception
34 // of a frame and we are waiting for a response.
35 #define PSDU_DURATION_SAFEGUARD 400
36 
37 namespace ns3 {
38 
39 NS_LOG_COMPONENT_DEFINE ("FrameExchangeManager");
40 
41 NS_OBJECT_ENSURE_REGISTERED (FrameExchangeManager);
42 
43 TypeId
45 {
46  static TypeId tid = TypeId ("ns3::FrameExchangeManager")
47  .SetParent<Object> ()
48  .AddConstructor<FrameExchangeManager> ()
49  .SetGroupName ("Wifi")
50  ;
51  return tid;
52 }
53 
55  : m_navEnd (Seconds (0)),
56  m_promisc (false),
57  m_moreFragments (false)
58 {
59  NS_LOG_FUNCTION (this);
60 }
61 
63 {
65 }
66 
67 void
69 {
70  NS_LOG_FUNCTION (this);
71  m_txTimer.Cancel ();
73  {
75  }
77  m_mpdu = 0;
78  m_txParams.Clear ();
79  m_dcf = 0;
80 }
81 
82 void
84 {
85  NS_LOG_FUNCTION (this);
86  Reset ();
88  m_mac = 0;
89  m_txMiddle = 0;
90  m_rxMiddle = 0;
93  m_ackManager = 0;
94  if (m_phy != 0)
95  {
96  m_phy->TraceDisconnectWithoutContext ("PhyRxPayloadBegin",
98  }
99  m_phy = 0;
101 }
102 
103 void
105 {
106  NS_LOG_FUNCTION (this << protectionManager);
107  m_protectionManager = protectionManager;
108 }
109 
112 {
113  return m_protectionManager;
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION (this << ackManager);
120  m_ackManager = ackManager;
121 }
122 
125 {
126  return m_ackManager;
127 }
128 
129 void
131 {
132  NS_LOG_FUNCTION (this << mac);
133  m_mac = mac;
134 }
135 
136 void
138 {
139  NS_LOG_FUNCTION (this << txMiddle);
140  m_txMiddle = txMiddle;
141 }
142 
143 void
145 {
146  NS_LOG_FUNCTION (this << rxMiddle);
147  m_rxMiddle = rxMiddle;
148 }
149 
150 void
152 {
153  NS_LOG_FUNCTION (this << channelAccessManager);
154  m_channelAccessManager = channelAccessManager;
155 }
156 
157 void
159 {
160  NS_LOG_FUNCTION (this << phy);
161  m_phy = phy;
162  m_phy->TraceConnectWithoutContext ("PhyRxPayloadBegin",
165 }
166 
167 void
169 {
170  m_phy->TraceDisconnectWithoutContext ("PhyRxPayloadBegin",
173  m_phy = 0;
174 }
175 
176 void
178 {
179  NS_LOG_FUNCTION (this << address);
180  m_self = address;
181 }
182 
183 void
185 {
186  NS_LOG_FUNCTION (this << bssid);
187  m_bssid = bssid;
188 }
189 
190 void
192 {
193  NS_LOG_FUNCTION (this << &callback);
194  m_droppedMpduCallback = callback;
195 }
196 
197 void
199 {
200  NS_LOG_FUNCTION (this << &callback);
201  m_ackedMpduCallback = callback;
202 }
203 
204 void
206 {
207  m_promisc = true;
208 }
209 
210 bool
212 {
213  return m_promisc;
214 }
215 
216 const WifiTxTimer&
218 {
219  return m_txTimer;
220 }
221 
222 void
224 {
226  {
228  }
229 }
230 
231 void
233 {
234  NS_LOG_FUNCTION (this << "PSDU reception started for " << psduDuration.As (Time::US)
235  << " (txVector: " << txVector << ")");
236 
238  "The TX timer and the NAV reset event cannot be both running");
239 
240  // No need to reschedule timeouts if PSDU duration is null. In this case,
241  // PHY-RXEND immediately follows PHY-RXSTART (e.g. when PPDU has been filtered)
242  // and CCA will take over
243  if (m_txTimer.IsRunning () && psduDuration.IsStrictlyPositive ())
244  {
245  // we are waiting for a response and something arrived
246  NS_LOG_DEBUG ("Rescheduling timeout event");
248  // PHY has switched to RX, so we can reset the ack timeout
249  m_channelAccessManager->NotifyAckTimeoutResetNow ();
250  }
251 
252  if (m_navResetEvent.IsRunning ())
253  {
255  }
256 }
257 
258 bool
260 {
261  NS_LOG_FUNCTION (this << dcf);
262 
263  NS_ASSERT (m_mpdu == 0);
264  if (m_txTimer.IsRunning ())
265  {
266  m_txTimer.Cancel ();
267  }
268  m_dcf = dcf;
269 
270  Ptr<WifiMacQueue> queue = dcf->GetWifiMacQueue ();
271 
272  // Even though channel access is requested when the queue is not empty, at
273  // the time channel access is granted the lifetime of the packet might be
274  // expired and the queue might be empty.
275  if (queue->IsEmpty ())
276  {
277  NS_LOG_DEBUG ("Queue empty");
279  m_dcf = 0;
280  return false;
281  }
282 
284  Ptr<WifiMacQueueItem> mpdu = *queue->Peek ()->GetQueueIterator ();
285  NS_ASSERT (mpdu != 0);
286  NS_ASSERT (mpdu->GetHeader ().IsData () || mpdu->GetHeader ().IsMgt ());
287 
288  // assign a sequence number if this is not a fragment nor a retransmission
289  if (!mpdu->IsFragment () && !mpdu->GetHeader ().IsRetry ())
290  {
291  uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor (&mpdu->GetHeader ());
292  mpdu->GetHeader ().SetSequenceNumber (sequence);
293  }
294 
295  NS_LOG_DEBUG ("MPDU payload size=" << mpdu->GetPacketSize () <<
296  ", to=" << mpdu->GetHeader ().GetAddr1 () <<
297  ", seq=" << mpdu->GetHeader ().GetSequenceControl ());
298 
299  // check if the MSDU needs to be fragmented
300  mpdu = GetFirstFragmentIfNeeded (mpdu);
301 
303  NS_ASSERT (m_ackManager != 0);
304  WifiTxParameters txParams;
305  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (mpdu->GetHeader ());
306  txParams.m_protection = m_protectionManager->TryAddMpdu (mpdu, txParams);
307  txParams.m_acknowledgment = m_ackManager->TryAddMpdu (mpdu, txParams);
308  txParams.AddMpdu (mpdu);
309  UpdateTxDuration (mpdu->GetHeader ().GetAddr1 (), txParams);
310 
311  SendMpduWithProtection (mpdu, txParams);
312 
313  return true;
314 }
315 
318 {
319  NS_LOG_FUNCTION (this << *mpdu);
320 
321  if (mpdu->IsFragment ())
322  {
323  // a fragment cannot be further fragmented
325  }
326  else if (m_mac->GetWifiRemoteStationManager ()->NeedFragmentation (mpdu))
327  {
328  NS_LOG_DEBUG ("Fragmenting the MSDU");
329  m_fragmentedPacket = mpdu->GetPacket ()->Copy ();
330  AcIndex ac = mpdu->GetQueueAc ();
331  // dequeue the MSDU
332  DequeueMpdu (mpdu);
333  // create the first fragment
334  mpdu->GetHeader ().SetMoreFragments ();
335  Ptr<Packet> fragment = m_fragmentedPacket->CreateFragment (0, m_mac->GetWifiRemoteStationManager ()->GetFragmentSize (mpdu, 0));
336  // enqueue the first fragment
337  Ptr<WifiMacQueueItem> item = Create<WifiMacQueueItem> (fragment, mpdu->GetHeader (), mpdu->GetTimeStamp ());
338  m_mac->GetTxopQueue (ac)->PushFront (item);
339  return item;
340  }
341  return mpdu;
342 }
343 
344 void
346 {
347  NS_LOG_FUNCTION (this << *mpdu << &txParams);
348 
349  m_mpdu = mpdu;
350  m_txParams = std::move (txParams);
351 
352  // If protection is required, the MPDU must be stored in some queue because
353  // it is not put back in a queue if the RTS/CTS exchange fails
355  || m_mpdu->GetHeader ().IsCtl ()
356  || m_mpdu->IsQueued ());
357 
358  // Make sure that the acknowledgment time has been computed, so that SendRts()
359  // and SendCtsToSelf() can reuse this value.
361 
362  if (m_txParams.m_acknowledgment->acknowledgmentTime == Time::Min ())
363  {
365  }
366 
367  // Set QoS Ack policy if this is a QoS data frame
369 
370  switch (m_txParams.m_protection->method)
371  {
374  break;
377  break;
379  SendMpdu ();
380  break;
381  default:
382  NS_ABORT_MSG ("Unknown protection type");
383  }
384 }
385 
386 void
388 {
389  NS_LOG_FUNCTION (this);
390 
392 
394 
396  {
398 
399  if (!m_mpdu->GetHeader ().IsQosData ()
401  {
402  // No acknowledgment, hence dequeue the MPDU if it is stored in a queue
404  }
405  }
407  {
410 
411  // the timeout duration is "aSIFSTime + aSlotTime + aRxPHYStartDelay, starting
412  // at the PHY-TXEND.confirm primitive" (section 10.3.2.9 or 10.22.2.2 of 802.11-2016).
413  // aRxPHYStartDelay equals the time to transmit the PHY header.
414  WifiNormalAck* normalAcknowledgment = static_cast<WifiNormalAck*> (m_txParams.m_acknowledgment.get ());
415 
416  Time timeout = txDuration
417  + m_phy->GetSifs ()
418  + m_phy->GetSlot ()
419  + m_phy->CalculatePhyPreambleAndHeaderDuration (normalAcknowledgment->ackTxVector);
422  this, m_mpdu, m_txParams.m_txVector);
423  m_channelAccessManager->NotifyAckTimeoutStartNow (timeout);
424  }
425  else
426  {
427  NS_ABORT_MSG ("Unable to handle the selected acknowledgment method ("
428  << m_txParams.m_acknowledgment.get () << ")");
429  }
430 
431  // transmit the MPDU
433 
435  {
436  // we are done with frames that do not require acknowledgment
437  m_mpdu = 0;
438  }
439 }
440 
441 void
443 {
444  NS_LOG_FUNCTION (this << *mpdu << txVector);
445 
446  m_phy->Send (Create<WifiPsdu> (mpdu, false), txVector);
447 }
448 
449 void
451 {
452  NS_LOG_DEBUG (this << *mpdu);
453 
454  if (mpdu->IsQueued ())
455  {
456  m_mac->GetTxopQueue (mpdu->GetQueueAc ())->DequeueIfQueued (mpdu);
457  }
458 }
459 
460 void
462 {
463  NS_LOG_FUNCTION (this << protection);
464  NS_ASSERT (protection != nullptr);
465 
466  if (protection->method == WifiProtection::NONE)
467  {
468  protection->protectionTime = Seconds (0);
469  }
470  else if (protection->method == WifiProtection::RTS_CTS)
471  {
472  WifiRtsCtsProtection* rtsCtsProtection = static_cast<WifiRtsCtsProtection*> (protection);
473  rtsCtsProtection->protectionTime = m_phy->CalculateTxDuration (GetRtsSize (), rtsCtsProtection->rtsTxVector,
474  m_phy->GetPhyBand ())
475  + m_phy->CalculateTxDuration (GetCtsSize (), rtsCtsProtection->ctsTxVector,
476  m_phy->GetPhyBand ())
477  + 2 * m_phy->GetSifs ();
478  }
479  else if (protection->method == WifiProtection::CTS_TO_SELF)
480  {
481  WifiCtsToSelfProtection* ctsToSelfProtection = static_cast<WifiCtsToSelfProtection*> (protection);
482  ctsToSelfProtection->protectionTime = m_phy->CalculateTxDuration (GetCtsSize (),
483  ctsToSelfProtection->ctsTxVector,
484  m_phy->GetPhyBand ())
485  + m_phy->GetSifs ();
486  }
487 }
488 
489 void
491 {
492  NS_LOG_FUNCTION (this << acknowledgment);
493  NS_ASSERT (acknowledgment != nullptr);
494 
495  if (acknowledgment->method == WifiAcknowledgment::NONE)
496  {
497  acknowledgment->acknowledgmentTime = Seconds (0);
498  }
499  else if (acknowledgment->method == WifiAcknowledgment::NORMAL_ACK)
500  {
501  WifiNormalAck* normalAcknowledgment = static_cast<WifiNormalAck*> (acknowledgment);
502  normalAcknowledgment->acknowledgmentTime = m_phy->GetSifs ()
504  normalAcknowledgment->ackTxVector,
505  m_phy->GetPhyBand ());
506  }
507 }
508 
509 Time
510 FrameExchangeManager::GetTxDuration (uint32_t ppduPayloadSize, Mac48Address receiver,
511  const WifiTxParameters& txParams) const
512 {
513  return m_phy->CalculateTxDuration (ppduPayloadSize, txParams.m_txVector, m_phy->GetPhyBand ());
514 }
515 
516 void
518 {
519  txParams.m_txDuration = GetTxDuration (txParams.GetSize (receiver), receiver, txParams);
520 }
521 
522 Time
524  const WifiTxParameters& txParams,
525  Ptr<Packet> fragmentedPacket) const
526 {
527  NS_LOG_FUNCTION (this << header << size << &txParams << fragmentedPacket);
528 
529  NS_ASSERT (txParams.m_acknowledgment && txParams.m_acknowledgment->acknowledgmentTime != Time::Min ());
530  Time durationId = txParams.m_acknowledgment->acknowledgmentTime;
531 
532  // if the current frame is a fragment followed by another fragment, we have to
533  // update the Duration/ID to cover the next fragment and the corresponding Ack
534  if (header.IsMoreFragments ())
535  {
536  uint32_t payloadSize = size - header.GetSize () - WIFI_MAC_FCS_LENGTH;
537  uint32_t nextFragmentOffset = (header.GetFragmentNumber () + 1) * payloadSize;
538  uint32_t nextFragmentSize = std::min (fragmentedPacket->GetSize () - nextFragmentOffset,
539  payloadSize);
540  WifiTxVector ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (header.GetAddr1 (),
541  txParams.m_txVector);
542 
543  durationId += 2 * m_phy->GetSifs ()
544  + m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetPhyBand ())
545  + m_phy->CalculateTxDuration (nextFragmentSize, txParams.m_txVector, m_phy->GetPhyBand ());
546  }
547  return durationId;
548 }
549 
550 Time
551 FrameExchangeManager::GetRtsDurationId (const WifiTxVector& rtsTxVector, Time txDuration, Time response) const
552 {
553  NS_LOG_FUNCTION (this << rtsTxVector << txDuration << response);
554 
555  WifiTxVector ctsTxVector;
556  ctsTxVector = m_mac->GetWifiRemoteStationManager ()->GetCtsTxVector (m_self, rtsTxVector.GetMode ());
557 
558  return m_phy->GetSifs ()
559  + m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetPhyBand ()) /* CTS */
560  + m_phy->GetSifs () + txDuration + response;
561 }
562 
563 void
565 {
566  NS_LOG_FUNCTION (this << &txParams);
567 
568  NS_ASSERT (txParams.GetPsduInfoMap ().size () == 1);
569  Mac48Address receiver = txParams.GetPsduInfoMap ().begin ()->first;
570 
571  WifiMacHeader rts;
573  rts.SetDsNotFrom ();
574  rts.SetDsNotTo ();
575  rts.SetNoRetry ();
576  rts.SetNoMoreFragments ();
577  rts.SetAddr1 (receiver);
578  rts.SetAddr2 (m_self);
579 
580  NS_ASSERT (txParams.m_protection && txParams.m_protection->method == WifiProtection::RTS_CTS);
581  WifiRtsCtsProtection* rtsCtsProtection = static_cast<WifiRtsCtsProtection*> (txParams.m_protection.get ());
582 
583  NS_ASSERT (txParams.m_txDuration != Time::Min ());
584  rts.SetDuration (GetRtsDurationId (rtsCtsProtection->rtsTxVector, txParams.m_txDuration,
585  txParams.m_acknowledgment->acknowledgmentTime));
586  Ptr<WifiMacQueueItem> mpdu = Create<WifiMacQueueItem> (Create<Packet> (), rts);
587 
588  // After transmitting an RTS frame, the STA shall wait for a CTSTimeout interval with
589  // a value of aSIFSTime + aSlotTime + aRxPHYStartDelay (IEEE 802.11-2016 sec. 10.3.2.7).
590  // aRxPHYStartDelay equals the time to transmit the PHY header.
592  + m_phy->GetSifs ()
593  + m_phy->GetSlot ()
597  mpdu, rtsCtsProtection->rtsTxVector);
598  m_channelAccessManager->NotifyCtsTimeoutStartNow (timeout);
599 
600  ForwardMpduDown (mpdu, rtsCtsProtection->rtsTxVector);
601 }
602 
603 void
605  double rtsSnr)
606 {
607  NS_LOG_FUNCTION (this << rtsHdr << ctsTxVector << rtsSnr);
608 
609  WifiMacHeader cts;
611  cts.SetDsNotFrom ();
612  cts.SetDsNotTo ();
613  cts.SetNoMoreFragments ();
614  cts.SetNoRetry ();
615  cts.SetAddr1 (rtsHdr.GetAddr2 ());
616  Time duration = rtsHdr.GetDuration () - m_phy->GetSifs ()
617  - m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetPhyBand ());
618  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8 of 802.11-2016)
619  if (duration.IsStrictlyNegative ())
620  {
621  duration = Seconds (0);
622  }
623  cts.SetDuration (duration);
624 
625  Ptr<Packet> packet = Create<Packet> ();
626 
627  SnrTag tag;
628  tag.Set (rtsSnr);
629  packet->AddPacketTag (tag);
630 
631  // CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
632  ForwardMpduDown (Create<WifiMacQueueItem> (packet, cts), ctsTxVector);
633 }
634 
635 void
636 FrameExchangeManager::SendCtsAfterRts (const WifiMacHeader& rtsHdr, WifiMode rtsTxMode, double rtsSnr)
637 {
638  NS_LOG_FUNCTION (this << rtsHdr << rtsTxMode << rtsSnr);
639 
640  WifiTxVector ctsTxVector = m_mac->GetWifiRemoteStationManager ()->GetCtsTxVector (rtsHdr.GetAddr2 (), rtsTxMode);
641  DoSendCtsAfterRts (rtsHdr, ctsTxVector, rtsSnr);
642 }
643 
644 Time
646  Time txDuration, Time response) const
647 {
648  NS_LOG_FUNCTION (this << ctsTxVector << txDuration << response);
649 
650  return m_phy->GetSifs () + txDuration + response;
651 }
652 
653 void
655 {
656  NS_LOG_FUNCTION (this << &txParams);
657 
658  WifiMacHeader cts;
660  cts.SetDsNotFrom ();
661  cts.SetDsNotTo ();
662  cts.SetNoMoreFragments ();
663  cts.SetNoRetry ();
664  cts.SetAddr1 (m_self);
665 
666  NS_ASSERT (txParams.m_protection && txParams.m_protection->method == WifiProtection::CTS_TO_SELF);
667  WifiCtsToSelfProtection* ctsToSelfProtection = static_cast<WifiCtsToSelfProtection*> (txParams.m_protection.get ());
668 
669  NS_ASSERT (txParams.m_txDuration != Time::Min ());
670  cts.SetDuration (GetCtsToSelfDurationId (ctsToSelfProtection->ctsTxVector, txParams.m_txDuration,
671  txParams.m_acknowledgment->acknowledgmentTime));
672 
673  ForwardMpduDown (Create<WifiMacQueueItem> (Create<Packet> (), cts), ctsToSelfProtection->ctsTxVector);
674 
675  Time ctsDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsToSelfProtection->ctsTxVector,
676  m_phy->GetPhyBand ());
678 }
679 
680 void
682  double dataSnr)
683 {
684  NS_LOG_FUNCTION (this << hdr << dataTxVector << dataSnr);
685 
686  WifiTxVector ackTxVector = m_mac->GetWifiRemoteStationManager ()->GetAckTxVector (hdr.GetAddr2 (), dataTxVector);
687  WifiMacHeader ack;
689  ack.SetDsNotFrom ();
690  ack.SetDsNotTo ();
691  ack.SetNoRetry ();
692  ack.SetNoMoreFragments ();
693  ack.SetAddr1 (hdr.GetAddr2 ());
694  // 802.11-2016, Section 9.2.5.7: Duration/ID is received duration value
695  // minus the time to transmit the Ack frame and its SIFS interval
696  Time duration = hdr.GetDuration () - m_phy->GetSifs ()
697  - m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetPhyBand ());
698  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8 of 802.11-2016)
699  if (duration.IsStrictlyNegative ())
700  {
701  duration = Seconds (0);
702  }
703  ack.SetDuration (duration);
704 
705  Ptr<Packet> packet = Create<Packet> ();
706 
707  SnrTag tag;
708  tag.Set (dataSnr);
709  packet->AddPacketTag (tag);
710 
711  ForwardMpduDown (Create<WifiMacQueueItem> (packet, ack), ackTxVector);
712 }
713 
716 {
717  NS_LOG_FUNCTION (this);
719 
720  WifiMacHeader& hdr = m_mpdu->GetHeader ();
721  hdr.SetFragmentNumber (hdr.GetFragmentNumber () + 1);
722 
723  uint32_t startOffset = hdr.GetFragmentNumber () * m_mpdu->GetPacketSize ();
724  uint32_t size = m_fragmentedPacket->GetSize () - startOffset;
725 
726  if (size > m_mpdu->GetPacketSize ())
727  {
728  // this is not the last fragment
729  size = m_mpdu->GetPacketSize ();
730  hdr.SetMoreFragments ();
731  }
732  else
733  {
734  hdr.SetNoMoreFragments ();
735  }
736 
737  return Create<WifiMacQueueItem> (m_fragmentedPacket->CreateFragment (startOffset, size), hdr);
738 }
739 
740 void
742 {
743  NS_LOG_FUNCTION (this);
744 
745  // Upon a transmission success, a non-QoS station transmits the next fragment,
746  // if any, or releases the channel, otherwise
747  if (m_moreFragments)
748  {
749  NS_LOG_DEBUG ("Schedule transmission of next fragment in a SIFS");
751  m_moreFragments = false;
752  }
753  else
754  {
756  m_dcf = 0;
757  }
758 }
759 
760 void
762 {
763  NS_LOG_FUNCTION (this);
764  // A non-QoS station always releases the channel upon a transmission failure
766  m_dcf = 0;
767 }
768 
769 void
771 {
772  NS_LOG_FUNCTION (this << *mpdu << txVector);
773 
774  m_mac->GetWifiRemoteStationManager ()->ReportDataFailed (mpdu);
775 
776  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (mpdu))
777  {
778  NS_LOG_DEBUG ("Missed Ack, discard MPDU");
779  NotifyPacketDiscarded (mpdu);
780  // Dequeue the MPDU if it is stored in a queue
781  DequeueMpdu (mpdu);
782  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (mpdu);
783  m_dcf->ResetCw ();
784  }
785  else
786  {
787  NS_LOG_DEBUG ("Missed Ack, retransmit MPDU");
788  mpdu->GetHeader ().SetRetry ();
790  m_dcf->UpdateFailedCw ();
791  }
792 
793  m_mpdu = 0;
795 }
796 
797 void
799 {
800  NS_LOG_FUNCTION (this << *mpdu);
801 }
802 
803 void
805 {
806  NS_LOG_FUNCTION (this << *rts << txVector);
807 
808  m_mac->GetWifiRemoteStationManager ()->ReportRtsFailed (m_mpdu->GetHeader ());
809 
810  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (m_mpdu))
811  {
812  NS_LOG_DEBUG ("Missed CTS, discard MPDU");
813  // Dequeue the MPDU if it is stored in a queue
816  m_mac->GetWifiRemoteStationManager ()->ReportFinalRtsFailed (m_mpdu->GetHeader ());
817  m_dcf->ResetCw ();
818  }
819  else
820  {
821  NS_LOG_DEBUG ("Missed CTS, retransmit RTS");
823  m_dcf->UpdateFailedCw ();
824  }
825  m_mpdu = 0;
827 }
828 
829 void
831 {
832  NS_LOG_FUNCTION (this << *mpdu);
833 
834  // the MPDU should be still in the DCF queue, unless it expired.
835  // If the MPDU has never been transmitted, it will be assigned a sequence
836  // number again the next time we try to transmit it. Therefore, we need to
837  // make its sequence number available again
838  if (!mpdu->GetHeader ().IsRetry ())
839  {
840  m_txMiddle->SetSequenceNumberFor (&mpdu->GetHeader ());
841  }
842 }
843 
844 void
846 {
847  NS_LOG_FUNCTION (this);
848 
849  // For internal collisions occurring with the EDCA access method, the appropriate
850  // retry counters (short retry counter for MSDU, A-MSDU, or MMPDU and QSRC[AC] or
851  // long retry counter for MSDU, A-MSDU, or MMPDU and QLRC[AC]) are incremented
852  // (Sec. 10.22.2.11.1 of 802.11-2016).
853  // We do not prepare the PSDU that the AC losing the internal collision would have
854  // sent. As an approximation, we consider the frame peeked from the queues of the AC.
855  Ptr<QosTxop> qosTxop = (txop->IsQosTxop () ? StaticCast<QosTxop> (txop) : nullptr);
856 
857  Ptr<const WifiMacQueueItem> mpdu = (qosTxop != nullptr ? qosTxop->PeekNextMpdu ()
858  : txop->GetWifiMacQueue ()->Peek ());
859 
860  if (mpdu != nullptr)
861  {
862  m_mac->GetWifiRemoteStationManager ()->ReportDataFailed (mpdu);
863 
864  if (!mpdu->GetHeader ().GetAddr1 ().IsGroup ()
865  && !m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (mpdu))
866  {
867  NS_LOG_DEBUG ("reset DCF");
868  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (mpdu);
869  DequeueMpdu (mpdu);
870  NotifyPacketDiscarded (mpdu);
871  txop->ResetCw ();
872  }
873  else
874  {
875  NS_LOG_DEBUG ("Update CW");
876  txop->UpdateFailedCw ();
877  }
878  }
879 
880  txop->Txop::NotifyChannelReleased ();
881 }
882 
883 void
885 {
886  NS_LOG_DEBUG ("Switching channel. Cancelling MAC pending events");
887  m_mac->GetWifiRemoteStationManager ()->Reset ();
888  Reset ();
889 }
890 
891 void
893 {
894  NS_LOG_DEBUG ("Device in sleep mode. Cancelling MAC pending events");
895  Reset ();
896 }
897 
898 void
900 {
901  NS_LOG_DEBUG ("Device is switched off. Cancelling MAC pending events");
902  Reset ();
903 }
904 
905 void
907  WifiTxVector txVector, std::vector<bool> perMpduStatus)
908 {
909  NS_LOG_FUNCTION (this << psdu << rxSignalInfo << txVector << perMpduStatus.size ()
910  << std::all_of (perMpduStatus.begin(), perMpduStatus.end(), [](bool v) { return v; }));
911 
912  if (!perMpduStatus.empty ())
913  {
914  // for A-MPDUs, we get here only once
915  PreProcessFrame (psdu, txVector);
916  }
917 
918  // ignore unicast frames that are not addressed to us
919  Mac48Address addr1 = psdu->GetAddr1 ();
920  if (!addr1.IsGroup () && addr1 != m_self)
921  {
922  if (m_promisc && psdu->GetNMpdus () == 1 && psdu->GetHeader (0).IsData ())
923  {
924  m_rxMiddle->Receive (*psdu->begin ());
925  }
926  return;
927  }
928 
929  if (psdu->GetNMpdus () == 1)
930  {
931  // if perMpduStatus is not empty (i.e., this MPDU is not included in an A-MPDU)
932  // then it must contain a single value which must be true (i.e., the MPDU
933  // has been correctly received)
934  NS_ASSERT (perMpduStatus.empty () || (perMpduStatus.size () == 1 && perMpduStatus[0]));
935  // Ack and CTS do not carry Addr2
936  if (!psdu->GetHeader (0).IsAck () && !psdu->GetHeader (0).IsCts ())
937  {
938  m_mac->GetWifiRemoteStationManager ()->ReportRxOk (psdu->GetHeader (0).GetAddr2 (),
939  rxSignalInfo, txVector);
940  }
941  ReceiveMpdu (*(psdu->begin ()), rxSignalInfo, txVector, perMpduStatus.empty ());
942  }
943  else
944  {
945  EndReceiveAmpdu (psdu, rxSignalInfo, txVector, perMpduStatus);
946  }
947 }
948 
949 void
951 {
952  NS_LOG_FUNCTION (this << psdu << txVector);
953 
954  UpdateNav (psdu, txVector);
955 }
956 
957 void
959 {
960  NS_LOG_FUNCTION (this << psdu << txVector);
961 
962  if (psdu->GetHeader (0).GetRawDuration () > 32767)
963  {
964  // When the contents of a received Duration/ID field, treated as an unsigned
965  // integer, are greater than 32 768, the contents are interpreted as appropriate
966  // for the frame type and subtype or ignored if the receiving MAC entity does
967  // not have a defined interpretation for that type and subtype (IEEE 802.11-2016
968  // sec. 10.27.3)
969  return;
970  }
971 
972  Time duration = psdu->GetDuration ();
973  NS_LOG_DEBUG ("Duration/ID=" << duration);
974 
975  if (psdu->GetAddr1 () == m_self)
976  {
977  // When the received frame’s RA is equal to the STA’s own MAC address, the STA
978  // shall not update its NAV (IEEE 802.11-2016, sec. 10.3.2.4)
979  return;
980  }
981 
982  // For all other received frames the STA shall update its NAV when the received
983  // Duration is greater than the STA’s current NAV value (IEEE 802.11-2016 sec. 10.3.2.4)
984  Time navEnd = Simulator::Now () + duration;
985  if (navEnd > m_navEnd)
986  {
987  m_navEnd = navEnd;
988  NS_LOG_DEBUG ("Updated NAV=" << m_navEnd);
989 
990  // A STA that used information from an RTS frame as the most recent basis to update
991  // its NAV setting is permitted to reset its NAV if no PHY-RXSTART.indication
992  // primitive is received from the PHY during a NAVTimeout period starting when the
993  // MAC receives a PHY-RXEND.indication primitive corresponding to the detection of
994  // the RTS frame. NAVTimeout period is equal to:
995  // (2 x aSIFSTime) + (CTS_Time) + aRxPHYStartDelay + (2 x aSlotTime)
996  // The “CTS_Time” shall be calculated using the length of the CTS frame and the data
997  // rate at which the RTS frame used for the most recent NAV update was received
998  // (IEEE 802.11-2016 sec. 10.3.2.4)
999  if (psdu->GetHeader (0).IsRts ())
1000  {
1001  Time navResetDelay = 2 * m_phy->GetSifs ()
1002  + WifiPhy::CalculateTxDuration (GetCtsSize (), txVector,
1003  m_phy->GetPhyBand ())
1005  + 2 * m_phy->GetSlot ();
1007  }
1008  }
1009  NS_LOG_DEBUG ("Current NAV=" << m_navEnd);
1010 
1011  m_channelAccessManager->NotifyNavStartNow (duration);
1012 }
1013 
1014 void
1016 {
1017  NS_LOG_FUNCTION (this);
1018  m_navEnd = Simulator::Now ();
1019  m_channelAccessManager->NotifyNavResetNow (Seconds (0));
1020 }
1021 
1022 void
1024  const WifiTxVector& txVector, bool inAmpdu)
1025 {
1026  NS_LOG_FUNCTION (this << *mpdu << rxSignalInfo << txVector << inAmpdu);
1027  // The received MPDU is either broadcast or addressed to this station
1028  NS_ASSERT (mpdu->GetHeader ().GetAddr1 ().IsGroup ()
1029  || mpdu->GetHeader ().GetAddr1 () == m_self);
1030 
1031  double rxSnr = rxSignalInfo.snr;
1032  const WifiMacHeader& hdr = mpdu->GetHeader ();
1033 
1034  if (hdr.IsCtl ())
1035  {
1036  if (hdr.IsRts ())
1037  {
1038  NS_ABORT_MSG_IF (inAmpdu, "Received RTS as part of an A-MPDU");
1039 
1040  // A non-VHT STA that is addressed by an RTS frame behaves as follows:
1041  // - If the NAV indicates idle, the STA shall respond with a CTS frame after a SIFS
1042  // - Otherwise, the STA shall not respond with a CTS frame
1043  // (IEEE 802.11-2016 sec. 10.3.2.7)
1044  if (m_navEnd <= Simulator::Now ())
1045  {
1046  NS_LOG_DEBUG ("Received RTS from=" << hdr.GetAddr2 () << ", schedule CTS");
1048  this, hdr, txVector.GetMode (), rxSnr);
1049  }
1050  else
1051  {
1052  NS_LOG_DEBUG ("Received RTS from=" << hdr.GetAddr2 () << ", cannot schedule CTS");
1053  }
1054  }
1055  else if (hdr.IsCts () && m_txTimer.IsRunning () && m_txTimer.GetReason () == WifiTxTimer::WAIT_CTS
1056  && m_mpdu != 0)
1057  {
1058  NS_ABORT_MSG_IF (inAmpdu, "Received CTS as part of an A-MPDU");
1059  NS_ASSERT (hdr.GetAddr1 () == m_self);
1060 
1061  Mac48Address sender = m_mpdu->GetHeader ().GetAddr1 ();
1062  NS_LOG_DEBUG ("Received CTS from=" << sender);
1063 
1064  SnrTag tag;
1065  mpdu->GetPacket ()->PeekPacketTag (tag);
1066  m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
1067  m_mac->GetWifiRemoteStationManager ()->ReportRtsOk (m_mpdu->GetHeader (),
1068  rxSnr, txVector.GetMode (), tag.Get ());
1069 
1070  m_txTimer.Cancel ();
1071  m_channelAccessManager->NotifyCtsTimeoutResetNow ();
1073  }
1074  else if (hdr.IsAck () && m_mpdu != 0 && m_txTimer.IsRunning ()
1076  {
1077  NS_ASSERT (hdr.GetAddr1 () == m_self);
1078  SnrTag tag;
1079  mpdu->GetPacket ()->PeekPacketTag (tag);
1080  ReceivedNormalAck (m_mpdu, m_txParams.m_txVector, txVector, rxSignalInfo, tag.Get ());
1081  m_mpdu = 0;
1082  }
1083  }
1084  else if (hdr.IsMgt ())
1085  {
1086  NS_ABORT_MSG_IF (inAmpdu, "Received management frame as part of an A-MPDU");
1087 
1088  if (hdr.IsBeacon () || hdr.IsProbeResp ())
1089  {
1090  // Apply SNR tag for beacon quality measurements
1091  SnrTag tag;
1092  tag.Set (rxSnr);
1093  Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
1094  packet->AddPacketTag (tag);
1095  mpdu = Create<WifiMacQueueItem> (packet, hdr);
1096  }
1097 
1098  if (hdr.GetAddr1 () == m_self)
1099  {
1100  NS_LOG_DEBUG ("Received " << hdr.GetTypeString () << " from=" << hdr.GetAddr2 () << ", schedule ACK");
1102  this, hdr, txVector, rxSnr);
1103  }
1104 
1105  m_rxMiddle->Receive (mpdu);
1106  }
1107  else if (hdr.IsData () && !hdr.IsQosData ())
1108  {
1109  if (hdr.GetAddr1 () == m_self)
1110  {
1111  NS_LOG_DEBUG ("Received " << hdr.GetTypeString () << " from=" << hdr.GetAddr2 () << ", schedule ACK");
1113  this, hdr, txVector, rxSnr);
1114  }
1115 
1116  m_rxMiddle->Receive (mpdu);
1117  }
1118 }
1119 
1120 void
1122  const WifiTxVector& ackTxVector, const RxSignalInfo& rxInfo,
1123  double snr)
1124 {
1125  Mac48Address sender = mpdu->GetHeader ().GetAddr1 ();
1126  NS_LOG_DEBUG ("Received ACK from=" << sender);
1127 
1128  NotifyReceivedNormalAck (mpdu);
1129 
1130  // When fragmentation is used, only update manager when the last fragment is acknowledged
1131  if (!mpdu->GetHeader ().IsMoreFragments ())
1132  {
1133  m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxInfo, ackTxVector);
1134  m_mac->GetWifiRemoteStationManager ()->ReportDataOk (mpdu, rxInfo.snr, ackTxVector.GetMode (),
1135  snr, txVector);
1136  }
1137  // cancel the timer
1138  m_txTimer.Cancel ();
1139  m_channelAccessManager->NotifyAckTimeoutResetNow ();
1140 
1141  // The CW shall be reset to aCWmin after every successful attempt to transmit
1142  // a frame containing all or part of an MSDU or MMPDU (sec. 10.3.3 of 802.11-2016)
1143  m_dcf->ResetCw ();
1144 
1145  // The MPDU has been acknowledged, we can now dequeue it if it is stored in a queue
1146  DequeueMpdu (mpdu);
1147 
1148  if (mpdu->GetHeader ().IsMoreFragments ())
1149  {
1150  // enqueue the next fragment
1152  m_dcf->GetWifiMacQueue ()->PushFront (next);
1153  m_moreFragments = true;
1154  }
1155 
1157 }
1158 
1159 void
1161 {
1162  NS_LOG_FUNCTION (this << *mpdu);
1163 
1164  // inform the MAC that the transmission was successful
1165  if (!m_ackedMpduCallback.IsNull ())
1166  {
1167  m_ackedMpduCallback (mpdu);
1168  }
1169 }
1170 
1171 void
1173  const WifiTxVector& txVector, const std::vector<bool>& perMpduStatus)
1174 {
1175  NS_ASSERT_MSG (false, "A non-QoS station should not receive an A-MPDU");
1176 }
1177 
1178 } //namespace ns3
ns3::FrameExchangeManager::CalculateAcknowledgmentTime
virtual void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Definition: frame-exchange-manager.cc:490
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::FrameExchangeManager::RetransmitMpduAfterMissedAck
virtual void RetransmitMpduAfterMissedAck(Ptr< WifiMacQueueItem > mpdu) const
Retransmit an MPDU that was not acknowledged.
Definition: frame-exchange-manager.cc:798
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::FrameExchangeManager::SetChannelAccessManager
virtual void SetChannelAccessManager(const Ptr< ChannelAccessManager > channelAccessManager)
Set the channel access manager to use.
Definition: frame-exchange-manager.cc:151
ns3::WifiAcknowledgment::acknowledgmentTime
Time acknowledgmentTime
time required by the acknowledgment method
Definition: wifi-acknowledgment.h:104
ns3::FrameExchangeManager::m_txTimer
WifiTxTimer m_txTimer
the timer set upon frame transmission
Definition: frame-exchange-manager.h:379
ns3::WifiMacHeader::IsRts
bool IsRts(void) const
Return true if the header is a RTS header.
Definition: wifi-mac-header.cc:651
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#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
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition: wifi-mac-queue-item.cc:59
ns3::WifiMacHeader::SetNoMoreFragments
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
Definition: wifi-mac-header.cc:322
ns3::FrameExchangeManager::ReceiveMpdu
virtual void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu)
This method handles the reception of an MPDU (possibly included in an A-MPDU)
Definition: frame-exchange-manager.cc:1023
ns3::FrameExchangeManager::m_phy
Ptr< WifiPhy > m_phy
the PHY layer on this station
Definition: frame-exchange-manager.h:385
ns3::FrameExchangeManager::NotifyInternalCollision
virtual void NotifyInternalCollision(Ptr< Txop > txop)
Notify that an internal collision has occurred for the given Txop.
Definition: frame-exchange-manager.cc:845
ns3::WifiMacHeader::SetDuration
void SetDuration(Time duration)
Set the Duration/ID field with the given duration (Time object).
Definition: wifi-mac-header.cc:300
ns3::WifiMacHeader::SetMoreFragments
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
Definition: wifi-mac-header.cc:327
ns3::FrameExchangeManager::m_moreFragments
bool m_moreFragments
true if a fragment has to be sent after a SIFS
Definition: frame-exchange-manager.h:549
ns3::WifiMacHeader::IsAck
bool IsAck(void) const
Return true if the header is an Ack header.
Definition: wifi-mac-header.cc:663
ns3::GetRtsSize
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:100
ns3::WifiMacHeader::GetSize
uint32_t GetSize(void) const
Return the size of the WifiMacHeader in octets.
Definition: wifi-mac-header.cc:933
ns3::WifiPsdu::GetAddr1
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:111
min
#define min(a, b)
Definition: 80211b.c:42
ns3::FrameExchangeManager::ResetPhy
virtual void ResetPhy(void)
Remove WifiPhy associated with this FrameExchangeManager.
Definition: frame-exchange-manager.cc:168
ns3::FrameExchangeManager::GetRtsDurationId
virtual Time GetRtsDurationId(const WifiTxVector &rtsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of an RTS frame to send to protect a frame transmitted with ...
Definition: frame-exchange-manager.cc:551
ns3::FrameExchangeManager::SendNormalAck
void SendNormalAck(const WifiMacHeader &hdr, const WifiTxVector &dataTxVector, double dataSnr)
Send Normal Ack.
Definition: frame-exchange-manager.cc:681
ns3::WifiAcknowledgment::NONE
@ NONE
Definition: wifi-acknowledgment.h:52
ns3::WifiPsdu::GetDuration
Time GetDuration(void) const
Get the duration from the Duration/ID field, which is common to all the MPDUs.
Definition: wifi-psdu.cc:141
ns3::Mac48Address::IsGroup
bool IsGroup(void) const
Definition: mac48-address.cc:164
ns3::WifiMacHeader::IsBeacon
bool IsBeacon(void) const
Return true if the header is a Beacon header.
Definition: wifi-mac-header.cc:705
ns3::WifiMacHeader::IsData
bool IsData(void) const
Return true if the Type is DATA.
Definition: wifi-mac-header.cc:558
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Txop::NotifyChannelReleased
virtual void NotifyChannelReleased(void)
Called by the FrameExchangeManager to notify the completion of the transmissions.
Definition: txop.cc:355
ns3::FrameExchangeManager::SetMacTxMiddle
virtual void SetMacTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set the MAC TX Middle to use.
Definition: frame-exchange-manager.cc:137
ns3::WifiPhy::GetSlot
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:922
ns3::Callback< void, WifiMacDropReason, Ptr< const WifiMacQueueItem > >
ns3::WifiTxParameters::m_txDuration
Time m_txDuration
TX duration of the frame.
Definition: wifi-tx-parameters.h:65
ns3::WifiRtsCtsProtection
WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
Definition: wifi-protection.h:96
ns3::WifiProtection::method
const Method method
protection method
Definition: wifi-protection.h:71
ns3::WifiTxParameters::GetPsduInfoMap
const PsduInfoMap & GetPsduInfoMap(void) const
Get a const reference to the map containing information about PSDUs.
Definition: wifi-tx-parameters.cc:92
ns3::Packet::CreateFragment
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
Definition: packet.cc:227
ns3::WifiMacHeader::SetFragmentNumber
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
Definition: wifi-mac-header.cc:317
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3::WifiMacHeader::IsRetry
bool IsRetry(void) const
Return if the Retry bit is set.
Definition: wifi-mac-header.cc:789
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMacHeader::SetRetry
void SetRetry(void)
Set the Retry bit in the Frame Control field.
Definition: wifi-mac-header.cc:342
ns3::WifiPhy::CalculateTxDuration
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1610
ns3::WIFI_MAC_FCS_LENGTH
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
Definition: wifi-mac-trailer.h:31
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition: wifi-mac-header.cc:312
ns3::FrameExchangeManager::SetAckManager
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
Definition: frame-exchange-manager.cc:117
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::WifiProtection::CTS_TO_SELF
@ CTS_TO_SELF
Definition: wifi-protection.h:49
ns3::WifiMacHeader::IsProbeResp
bool IsProbeResp(void) const
Return true if the header is a Probe Response header.
Definition: wifi-mac-header.cc:699
ns3::ObjectBase::TraceDisconnectWithoutContext
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
Definition: object-base.cc:319
ns3::WifiTxTimer::IsRunning
bool IsRunning(void) const
Return true if the timer is running.
Definition: wifi-tx-timer.cc:94
ns3::FrameExchangeManager::CalculateProtectionTime
virtual void CalculateProtectionTime(WifiProtection *protection) const
Calculate the time required to protect a frame according to the given protection method.
Definition: frame-exchange-manager.cc:461
ns3::FrameExchangeManager::m_protectionManager
Ptr< WifiProtectionManager > m_protectionManager
Protection manager.
Definition: frame-exchange-manager.h:550
snr-tag.h
ns3::WIFI_MAC_DROP_REACHED_RETRY_LIMIT
@ WIFI_MAC_DROP_REACHED_RETRY_LIMIT
Definition: wifi-mac.h:58
ns3::FrameExchangeManager::SendCtsToSelf
void SendCtsToSelf(const WifiTxParameters &txParams)
Send CTS for a CTS-to-self mechanism.
Definition: frame-exchange-manager.cc:654
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:90
ns3::WifiMacHeader::NO_ACK
@ NO_ACK
Definition: wifi-mac-header.h:93
ns3::FrameExchangeManager::NavResetTimeout
virtual void NavResetTimeout(void)
Reset the NAV upon expiration of the NAV reset timer.
Definition: frame-exchange-manager.cc:1015
ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1604
ns3::FrameExchangeManager::UpdateNav
virtual void UpdateNav(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Update the NAV, if needed, based on the Duration/ID of the given psdu.
Definition: frame-exchange-manager.cc:958
ns3::WifiTxParameters::GetSize
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
Definition: wifi-tx-parameters.cc:227
ns3::Time::US
@ US
microsecond
Definition: nstime.h:117
ns3::WifiMacQueueItem::GetQueueAc
AcIndex GetQueueAc(void) const
Get the AC of the queue this item is stored into.
Definition: wifi-mac-queue-item.cc:211
ns3::Time::IsStrictlyPositive
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
Definition: nstime.h:333
ns3::FrameExchangeManager::m_channelAccessManager
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
Definition: frame-exchange-manager.h:384
ns3::Txop::ResetCw
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Definition: txop.cc:191
ns3::WifiMacHeader::IsCts
bool IsCts(void) const
Return true if the header is a CTS header.
Definition: wifi-mac-header.cc:657
ns3::FrameExchangeManager::GetNextFragment
Ptr< WifiMacQueueItem > GetNextFragment(void)
Get the next fragment of the current MSDU.
Definition: frame-exchange-manager.cc:715
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
Definition: qos-txop.cc:357
ns3::WifiMacHeader::SetNoRetry
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
Definition: wifi-mac-header.cc:347
ns3::WifiRtsCtsProtection::ctsTxVector
WifiTxVector ctsTxVector
CTS TXVECTOR.
Definition: wifi-protection.h:103
ns3::FrameExchangeManager::SetProtectionManager
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
Definition: frame-exchange-manager.cc:104
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::FrameExchangeManager::CtsTimeout
virtual void CtsTimeout(Ptr< WifiMacQueueItem > rts, const WifiTxVector &txVector)
Called when the CTS timeout expires.
Definition: frame-exchange-manager.cc:804
ns3::FrameExchangeManager::NotifyOffNow
void NotifyOffNow(void)
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
Definition: frame-exchange-manager.cc:899
ns3::WifiMacQueueItem::GetPacketSize
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item.
Definition: wifi-mac-queue-item.cc:89
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition: wifi-mac-header.cc:424
third.mac
mac
Definition: third.py:99
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::WIFI_MAC_CTL_CTS
@ WIFI_MAC_CTL_CTS
Definition: wifi-mac-header.h:41
ns3::WifiPhy::SetReceiveOkCallback
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:635
ns3::FrameExchangeManager::m_self
Mac48Address m_self
the MAC address of this device
Definition: frame-exchange-manager.h:386
ns3::FrameExchangeManager::GetCtsToSelfDurationId
virtual Time GetCtsToSelfDurationId(const WifiTxVector &ctsTxVector, Time txDuration, Time response) const
Compute how to set the Duration/ID field of a CTS-to-self frame to send to protect a frame transmitte...
Definition: frame-exchange-manager.cc:645
ns3::Packet::PeekPacketTag
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
Definition: packet.cc:978
ns3::WifiTxParameters
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
Definition: wifi-tx-parameters.h:45
ns3::FrameExchangeManager::SetMacRxMiddle
virtual void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
Definition: frame-exchange-manager.cc:144
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::WifiMacHeader::GetSequenceControl
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
Definition: wifi-mac-header.cc:771
ns3::FrameExchangeManager::NotifySleepNow
void NotifySleepNow(void)
This method is typically invoked by the PhyListener to notify the MAC layer that the device has been ...
Definition: frame-exchange-manager.cc:892
ns3::FrameExchangeManager::m_ackedMpduCallback
AckedMpdu m_ackedMpduCallback
the acknowledged MPDU callback
Definition: frame-exchange-manager.h:391
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:65
ns3::Txop::NotifyChannelAccessed
virtual void NotifyChannelAccessed(Time txopDuration=Seconds(0))
Called by the FrameExchangeManager to notify that channel access has been granted for the given amoun...
Definition: txop.cc:348
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::Txop::UpdateFailedCw
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: txop.cc:199
ns3::WifiNormalAck::ackTxVector
WifiTxVector ackTxVector
Ack TXVECTOR.
Definition: wifi-acknowledgment.h:152
ns3::FrameExchangeManager::m_droppedMpduCallback
DroppedMpdu m_droppedMpduCallback
the dropped MPDU callback
Definition: frame-exchange-manager.h:390
ns3::WifiTxParameters::m_protection
std::unique_ptr< WifiProtection > m_protection
protection method
Definition: wifi-tx-parameters.h:63
ns3::MakeNullCallback
Callback< R, Ts... > MakeNullCallback(void)
Definition: callback.h:1682
ns3::FrameExchangeManager::DoSendCtsAfterRts
void DoSendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiTxVector &ctsTxVector, double rtsSnr)
Send CTS after receiving RTS.
Definition: frame-exchange-manager.cc:604
ns3::FrameExchangeManager::SetAckedMpduCallback
void SetAckedMpduCallback(AckedMpdu callback)
Set the callback to invoke when an MPDU is successfully acked.
Definition: frame-exchange-manager.cc:198
wifi-mac-queue.h
ns3::FrameExchangeManager::NotifyPacketDiscarded
virtual void NotifyPacketDiscarded(Ptr< const WifiMacQueueItem > mpdu)
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
Definition: frame-exchange-manager.cc:223
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
ns3::FrameExchangeManager::GetFirstFragmentIfNeeded
Ptr< WifiMacQueueItem > GetFirstFragmentIfNeeded(Ptr< WifiMacQueueItem > mpdu)
Fragment the given MPDU if needed.
Definition: frame-exchange-manager.cc:317
ns3::FrameExchangeManager::GetProtectionManager
Ptr< WifiProtectionManager > GetProtectionManager(void) const
Get the Protection Manager used by this node.
Definition: frame-exchange-manager.cc:111
ns3::WifiMacHeader::GetTypeString
const char * GetTypeString(void) const
Return a string corresponds to the header type.
Definition: wifi-mac-header.cc:977
ns3::GetAckSize
uint32_t GetAckSize(void)
Return the total Ack size (including FCS trailer).
Definition: wifi-utils.cc:55
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::FrameExchangeManager::SendRts
void SendRts(const WifiTxParameters &txParams)
Send RTS to begin RTS-CTS-Data-Ack transaction.
Definition: frame-exchange-manager.cc:564
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::FrameExchangeManager::TransmissionSucceeded
virtual void TransmissionSucceeded(void)
Take necessary actions upon a transmission success.
Definition: frame-exchange-manager.cc:741
ns3::FrameExchangeManager::Receive
void Receive(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > perMpduStatus)
This method is intended to be called by the PHY layer every time an MPDU is received and also when th...
Definition: frame-exchange-manager.cc:906
ns3::WifiCtsToSelfProtection::ctsTxVector
WifiTxVector ctsTxVector
CTS TXVECTOR.
Definition: wifi-protection.h:119
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::FrameExchangeManager::m_txParams
WifiTxParameters m_txParams
the TX parameters for the current frame
Definition: frame-exchange-manager.h:547
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::NanoSeconds
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
ns3::FrameExchangeManager::IsPromisc
bool IsPromisc(void) const
Check if the device is operating in promiscuous mode.
Definition: frame-exchange-manager.cc:211
ns3::FrameExchangeManager::SetWifiMac
virtual void SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the MAC layer to use.
Definition: frame-exchange-manager.cc:130
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::WifiTxTimer::Reschedule
void Reschedule(const Time &delay)
Reschedule the timer to time out the given amount of time from the moment this function is called.
Definition: wifi-tx-timer.cc:45
ns3::FrameExchangeManager::SetDroppedMpduCallback
virtual void SetDroppedMpduCallback(DroppedMpdu callback)
Set the callback to invoke when an MPDU is dropped.
Definition: frame-exchange-manager.cc:191
ns3::FrameExchangeManager::GetTxDuration
virtual Time GetTxDuration(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams) const
Get the updated TX duration of the frame associated with the given TX parameters if the size of the P...
Definition: frame-exchange-manager.cc:510
ns3::WifiProtection::NONE
@ NONE
Definition: wifi-protection.h:47
ns3::FrameExchangeManager::SetAddress
virtual void SetAddress(Mac48Address address)
Set the MAC address.
Definition: frame-exchange-manager.cc:177
ns3::WifiProtection::protectionTime
Time protectionTime
time required by the protection method
Definition: wifi-protection.h:72
ns3::FrameExchangeManager::m_rxMiddle
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
Definition: frame-exchange-manager.h:383
ns3::WifiPsdu::GetHeader
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:266
ns3::WifiTxTimer::WAIT_NORMAL_ACK
@ WAIT_NORMAL_ACK
Definition: wifi-tx-timer.h:58
frame-exchange-manager.h
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
ns3::Txop::GetWifiMacQueue
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:154
ns3::WifiNormalAck
WifiNormalAck specifies that acknowledgment via Normal Ack is required.
Definition: wifi-acknowledgment.h:145
ns3::WifiTxParameters::Clear
void Clear(void)
Reset the TX parameters.
Definition: wifi-tx-parameters.cc:67
ns3::WifiRtsCtsProtection::rtsTxVector
WifiTxVector rtsTxVector
RTS TXVECTOR.
Definition: wifi-protection.h:102
ns3::WifiPsdu::GetNMpdus
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:319
ns3::WifiMacHeader::IsQosData
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
Definition: wifi-mac-header.cc:565
ns3::FrameExchangeManager::m_mpdu
Ptr< WifiMacQueueItem > m_mpdu
the MPDU being transmitted
Definition: frame-exchange-manager.h:546
first.address
address
Definition: first.py:44
ns3::WifiPhy::GetPhyBand
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
ns3::FrameExchangeManager::SetWifiPhy
virtual void SetWifiPhy(const Ptr< WifiPhy > phy)
Set the PHY layer to use.
Definition: frame-exchange-manager.cc:158
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::FrameExchangeManager::SetPromisc
void SetPromisc(void)
Enable promiscuous mode.
Definition: frame-exchange-manager.cc:205
ns3::WifiAcknowledgment::NORMAL_ACK
@ NORMAL_ACK
Definition: wifi-acknowledgment.h:53
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
ns3::Txop::IsQosTxop
virtual bool IsQosTxop() const
Check for QoS TXOP.
Definition: txop.cc:419
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
ns3::WifiProtection
WifiProtection is an abstract base struct.
Definition: wifi-protection.h:40
ns3::FrameExchangeManager::Reset
virtual void Reset(void)
Reset this frame exchange manager.
Definition: frame-exchange-manager.cc:68
ns3::SnrTag::Set
void Set(double snr)
Set the SNR to the given value.
Definition: snr-tag.cc:83
ns3::WifiMacHeader::GetQosAckPolicy
QosAckPolicy GetQosAckPolicy(void) const
Return the QoS Ack policy in the QoS control field.
Definition: wifi-mac-header.cc:829
ns3::WifiMacHeader::GetFragmentNumber
uint8_t GetFragmentNumber(void) const
Return the fragment number of the header.
Definition: wifi-mac-header.cc:783
ns3::FrameExchangeManager::GetFrameDurationId
virtual Time GetFrameDurationId(const WifiMacHeader &header, uint32_t size, const WifiTxParameters &txParams, Ptr< Packet > fragmentedPacket) const
Compute how to set the Duration/ID field of a frame being transmitted with the given TX parameters.
Definition: frame-exchange-manager.cc:523
ns3::WIFI_MAC_CTL_ACK
@ WIFI_MAC_CTL_ACK
Definition: wifi-mac-header.h:42
ns3::FrameExchangeManager::m_navEnd
Time m_navEnd
NAV expiration time.
Definition: frame-exchange-manager.h:388
ns3::FrameExchangeManager::GetAckManager
Ptr< WifiAckManager > GetAckManager(void) const
Get the Acknowledgment Manager used by this node.
Definition: frame-exchange-manager.cc:124
ns3::WifiTxParameters::m_acknowledgment
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
Definition: wifi-tx-parameters.h:64
ns3::SnrTag
Introspection did not find any typical Config paths.
Definition: snr-tag.h:35
ns3::FrameExchangeManager::DequeueMpdu
virtual void DequeueMpdu(Ptr< const WifiMacQueueItem > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
Definition: frame-exchange-manager.cc:450
ns3::FrameExchangeManager::StartTransmission
virtual bool StartTransmission(Ptr< Txop > dcf)
Request the FrameExchangeManager to start a frame exchange sequence.
Definition: frame-exchange-manager.cc:259
ns3::WifiMacHeader::IsMgt
bool IsMgt(void) const
Return true if the Type is Management.
Definition: wifi-mac-header.cc:577
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
ns3::WifiAckManager::SetQosAckPolicy
static void SetQosAckPolicy(Ptr< WifiMacQueueItem > item, const WifiAcknowledgment *acknowledgment)
Set the QoS Ack policy for the given MPDU, which must be a QoS data frame.
Definition: wifi-ack-manager.cc:64
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::FrameExchangeManager::m_navResetEvent
EventId m_navResetEvent
the event to reset the NAV after an RTS
Definition: frame-exchange-manager.h:380
ns3::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition: wifi-mac-header.cc:114
ns3::FrameExchangeManager::NotifySwitchingStartNow
void NotifySwitchingStartNow(Time duration)
Definition: frame-exchange-manager.cc:884
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log-macros-enabled.h:209
ns3::Time::Min
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
Definition: nstime.h:274
ns3::FrameExchangeManager::m_ackManager
Ptr< WifiAckManager > m_ackManager
Acknowledgment manager.
Definition: frame-exchange-manager.h:551
ns3::Time::IsStrictlyNegative
bool IsStrictlyNegative(void) const
Exactly equivalent to t < 0.
Definition: nstime.h:325
timeout
ns3::Time timeout
Definition: openflow-switch.cc:52
ns3::FrameExchangeManager::UpdateTxDuration
void UpdateTxDuration(Mac48Address receiver, WifiTxParameters &txParams) const
Update the TX duration field of the given TX parameters after that the PSDU addressed to the given re...
Definition: frame-exchange-manager.cc:517
ns3::WifiMacQueueItem::IsQueued
bool IsQueued(void) const
Return true if this item is stored in some queue, false otherwise.
Definition: wifi-mac-queue-item.cc:205
ns3::FrameExchangeManager::m_txMiddle
Ptr< MacTxMiddle > m_txMiddle
the MAC TX Middle on this station
Definition: frame-exchange-manager.h:382
ns3::RxSignalInfo::snr
double snr
SNR in linear scale.
Definition: phy-entity.h:68
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::WifiTxParameters::m_txVector
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
Definition: wifi-tx-parameters.h:62
wifi-utils.h
ns3::WifiMacQueueItem::GetTimeStamp
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Definition: wifi-mac-queue-item.cc:83
ns3::RxSignalInfo
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::FrameExchangeManager::m_promisc
bool m_promisc
Flag if the device is operating in promiscuous mode.
Definition: frame-exchange-manager.h:389
ns3::WifiAcknowledgment
WifiAcknowledgment is an abstract base struct.
Definition: wifi-acknowledgment.h:45
ns3::Packet::Copy
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
ns3::FrameExchangeManager::NotifyReceivedNormalAck
virtual void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu)
Notify other components that an MPDU was acknowledged.
Definition: frame-exchange-manager.cc:1160
ns3::FrameExchangeManager::SendMpduWithProtection
void SendMpduWithProtection(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams)
Send an MPDU with the given TX parameters (with the specified protection).
Definition: frame-exchange-manager.cc:345
ns3::FrameExchangeManager::m_mac
Ptr< RegularWifiMac > m_mac
the MAC layer on this station
Definition: frame-exchange-manager.h:381
ns3::FrameExchangeManager::m_bssid
Mac48Address m_bssid
BSSID address (Mac48Address)
Definition: frame-exchange-manager.h:387
ns3::SnrTag::Get
double Get(void) const
Return the SNR value.
Definition: snr-tag.cc:89
ns3::WifiTxTimer::WAIT_CTS
@ WAIT_CTS
Definition: wifi-tx-timer.h:57
ns3::WifiMacHeader::GetRawDuration
uint16_t GetRawDuration(void) const
Return the raw duration from the Duration/ID field.
Definition: wifi-mac-header.cc:759
ns3::AcIndex
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::FrameExchangeManager::TransmissionFailed
virtual void TransmissionFailed(void)
Take necessary actions upon a transmission failure.
Definition: frame-exchange-manager.cc:761
ns3::WifiMacHeader::GetDuration
Time GetDuration(void) const
Return the duration from the Duration/ID field (Time object).
Definition: wifi-mac-header.cc:765
ns3::WifiMacHeader::IsMoreFragments
bool IsMoreFragments(void) const
Return if the More Fragment bit is set.
Definition: wifi-mac-header.cc:795
ns3::FrameExchangeManager::ForwardMpduDown
virtual void ForwardMpduDown(Ptr< WifiMacQueueItem > mpdu, WifiTxVector &txVector)
Forward an MPDU down to the PHY layer.
Definition: frame-exchange-manager.cc:442
ns3::FrameExchangeManager::DoDispose
void DoDispose() override
Destructor implementation.
Definition: frame-exchange-manager.cc:83
ns3::WifiTxTimer::GetReason
Reason GetReason(void) const
Get the reason why the timer was started.
Definition: wifi-tx-timer.cc:60
ns3::WifiMacHeader::IsCtl
bool IsCtl(void) const
Return true if the Type is Control.
Definition: wifi-mac-header.cc:571
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition: wifi-mac-header.cc:132
ns3::FrameExchangeManager::RxStartIndication
void RxStartIndication(WifiTxVector txVector, Time psduDuration)
Definition: frame-exchange-manager.cc:232
ns3::FrameExchangeManager::RetransmitMpduAfterMissedCts
virtual void RetransmitMpduAfterMissedCts(Ptr< WifiMacQueueItem > mpdu) const
Retransmit an MPDU that was not sent because a CTS was not received.
Definition: frame-exchange-manager.cc:830
ns3::FrameExchangeManager::SendCtsAfterRts
void SendCtsAfterRts(const WifiMacHeader &rtsHdr, WifiMode rtsTxMode, double rtsSnr)
Send CTS after receiving RTS.
Definition: frame-exchange-manager.cc:636
ns3::WifiTxParameters::AddMpdu
void AddMpdu(Ptr< const WifiMacQueueItem > mpdu)
Record that an MPDU is being added to the current frame.
Definition: wifi-tx-parameters.cc:98
ns3::WifiMacHeader::SetDsNotTo
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:102
ns3::FrameExchangeManager::~FrameExchangeManager
virtual ~FrameExchangeManager()
Definition: frame-exchange-manager.cc:62
ns3::ObjectBase::TraceConnectWithoutContext
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
ns3::WifiProtection::RTS_CTS
@ RTS_CTS
Definition: wifi-protection.h:48
ns3::WifiMacQueueItem::IsFragment
bool IsFragment(void) const
Return true if this item contains an MSDU fragment, false otherwise.
Definition: wifi-mac-queue-item.cc:101
ns3::FrameExchangeManager::GetWifiTxTimer
const WifiTxTimer & GetWifiTxTimer(void) const
Get a const reference to the WifiTxTimer object.
Definition: frame-exchange-manager.cc:217
ns3::WifiPsdu::begin
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
Definition: wifi-psdu.cc:325
ns3::FrameExchangeManager::EndReceiveAmpdu
virtual void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus)
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
Definition: frame-exchange-manager.cc:1172
ns3::FrameExchangeManager::ReceivedNormalAck
virtual void ReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector, const WifiTxVector &ackTxVector, const RxSignalInfo &rxInfo, double snr)
Perform the actions needed when a Normal Ack is received.
Definition: frame-exchange-manager.cc:1121
ns3::WifiMacQueueItem::GetSize
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size.
Definition: wifi-mac-queue-item.cc:95
ns3::WifiAcknowledgment::method
const Method method
acknowledgment method
Definition: wifi-acknowledgment.h:103
ns3::FrameExchangeManager::SetBssid
virtual void SetBssid(Mac48Address bssid)
Set the Basic Service Set Identification.
Definition: frame-exchange-manager.cc:184
ns3::WIFI_MAC_CTL_RTS
@ WIFI_MAC_CTL_RTS
Definition: wifi-mac-header.h:40
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition: wifi-mac-header.cc:430
ns3::GetCtsSize
uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:108
ns3::WifiPhy::GetSifs
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:910
ns3::FrameExchangeManager::PreProcessFrame
virtual void PreProcessFrame(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
Perform actions that are possibly needed when receiving any frame, independently of whether the frame...
Definition: frame-exchange-manager.cc:950
ns3::WifiTxTimer::Set
void Set(Reason reason, const Time &delay, MEM mem_ptr, OBJ obj, Args... args)
This method is called when a frame soliciting a response is transmitted.
Definition: wifi-tx-timer.h:241
ns3::FrameExchangeManager::SendMpdu
void SendMpdu(void)
Send the current MPDU, which can be acknowledged by a Normal Ack.
Definition: frame-exchange-manager.cc:387
ns3::FrameExchangeManager::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: frame-exchange-manager.cc:44
wifi-mac-trailer.h
ns3::FrameExchangeManager::m_fragmentedPacket
Ptr< Packet > m_fragmentedPacket
the MSDU being fragmented
Definition: frame-exchange-manager.h:548
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
ns3::WifiTxTimer::Cancel
void Cancel(void)
Cancel the timer.
Definition: wifi-tx-timer.cc:100
ns3::WifiTxTimer
This class is used to handle the timer that a station starts when transmitting a frame that solicits ...
Definition: wifi-tx-timer.h:48
ns3::WifiPhy::Send
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Definition: wifi-phy.cc:1789
ns3::WifiCtsToSelfProtection
WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
Definition: wifi-protection.h:113
ns3::WifiTxVector::GetMode
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
Definition: wifi-tx-vector.cc:112
ns3::FrameExchangeManager::FrameExchangeManager
FrameExchangeManager()
Definition: frame-exchange-manager.cc:54
third.phy
phy
Definition: third.py:93
ns3::FrameExchangeManager::NormalAckTimeout
void NormalAckTimeout(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
Definition: frame-exchange-manager.cc:770
ns3::FrameExchangeManager::m_dcf
Ptr< Txop > m_dcf
the DCF/EDCAF that gained channel access
Definition: frame-exchange-manager.h:378
PSDU_DURATION_SAFEGUARD
#define PSDU_DURATION_SAFEGUARD
Definition: frame-exchange-manager.cc:35
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50