A Discrete-Event Network Simulator
API
ht-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"
24 #include "ns3/wifi-mac-queue.h"
25 #include "ns3/mgt-headers.h"
26 #include "ns3/recipient-block-ack-agreement.h"
27 #include "ns3/wifi-utils.h"
28 #include "ns3/snr-tag.h"
29 #include "ns3/ctrl-headers.h"
30 #include <array>
31 #include <optional>
32 
33 #undef NS_LOG_APPEND_CONTEXT
34 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
35 
36 namespace ns3 {
37 
38 NS_LOG_COMPONENT_DEFINE ("HtFrameExchangeManager");
39 
40 NS_OBJECT_ENSURE_REGISTERED (HtFrameExchangeManager);
41 
42 TypeId
44 {
45  static TypeId tid = TypeId ("ns3::HtFrameExchangeManager")
47  .AddConstructor<HtFrameExchangeManager> ()
48  .SetGroupName ("Wifi")
49  ;
50  return tid;
51 }
52 
54 {
55  NS_LOG_FUNCTION (this);
56  m_msduAggregator = CreateObject<MsduAggregator> ();
57  m_mpduAggregator = CreateObject<MpduAggregator> ();
58 }
59 
61 {
63 }
64 
65 void
67 {
68  NS_LOG_FUNCTION (this);
69  m_agreements.clear ();
70  m_msduAggregator = 0;
71  m_mpduAggregator = 0;
72  m_psdu = 0;
73  m_txParams.Clear ();
75 }
76 
77 void
79 {
80  m_msduAggregator->SetWifiMac (mac);
81  m_mpduAggregator->SetWifiMac (mac);
83 }
84 
87 {
88  return m_msduAggregator;
89 }
90 
93 {
94  return m_mpduAggregator;
95 }
96 
99 {
100  return m_mac->GetQosTxop (tid)->GetBaManager ();
101 }
102 
103 bool
105 {
106  Ptr<QosTxop> qosTxop = m_mac->GetQosTxop (tid);
107  bool establish;
108 
109  if (!m_mac->GetWifiRemoteStationManager ()->GetHtSupported (recipient))
110  {
111  establish = false;
112  }
113  else if (qosTxop->GetBaManager ()->ExistsAgreement (recipient, tid)
114  && !qosTxop->GetBaManager ()->ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::RESET))
115  {
116  establish = false;
117  }
118  else
119  {
120  uint32_t packets = qosTxop->GetWifiMacQueue ()->GetNPacketsByTidAndAddress (tid, recipient);
121  establish = ((qosTxop->GetBlockAckThreshold () > 0 && packets >= qosTxop->GetBlockAckThreshold ())
122  || (m_mpduAggregator->GetMaxAmpduSize (recipient, tid, WIFI_MOD_CLASS_HT) > 0 && packets > 1)
123  || m_mac->GetWifiRemoteStationManager ()->GetVhtSupported ());
124  }
125 
126  NS_LOG_FUNCTION (this << recipient << +tid << establish);
127  return establish;
128 }
129 
130 void
131 HtFrameExchangeManager::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startingSeq,
132  uint16_t timeout, bool immediateBAck)
133 {
134  NS_LOG_FUNCTION (this << dest << +tid << startingSeq << timeout << immediateBAck);
135  NS_LOG_DEBUG ("Send ADDBA request to " << dest);
136 
137  WifiMacHeader hdr;
139  hdr.SetAddr1 (dest);
140  hdr.SetAddr2 (m_self);
141  hdr.SetAddr3 (m_bssid);
142  hdr.SetDsNotTo ();
143  hdr.SetDsNotFrom ();
144 
145  WifiActionHeader actionHdr;
148  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
149 
150  Ptr<Packet> packet = Create<Packet> ();
151  // Setting ADDBARequest header
152  MgtAddBaRequestHeader reqHdr;
153  reqHdr.SetAmsduSupport (true);
154  if (immediateBAck)
155  {
156  reqHdr.SetImmediateBlockAck ();
157  }
158  else
159  {
160  reqHdr.SetDelayedBlockAck ();
161  }
162  reqHdr.SetTid (tid);
163  /* For now we don't use buffer size field in the ADDBA request frame. The recipient
164  * will choose how many packets it can receive under block ack.
165  */
166  reqHdr.SetBufferSize (0);
167  reqHdr.SetTimeout (timeout);
168  // set the starting sequence number for the BA agreement
169  reqHdr.SetStartingSequence (startingSeq);
170 
171  GetBaManager (tid)->CreateAgreement (&reqHdr, dest);
172 
173  packet->AddHeader (reqHdr);
174  packet->AddHeader (actionHdr);
175 
176  Ptr<WifiMacQueueItem> mpdu = Create<WifiMacQueueItem> (packet, hdr);
177 
178  // get the sequence number for the ADDBA Request management frame
179  uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor (&mpdu->GetHeader ());
180  mpdu->GetHeader ().SetSequenceNumber (sequence);
181 
182  WifiTxParameters txParams;
183  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (mpdu->GetHeader ());
184  txParams.m_protection = std::unique_ptr<WifiProtection> (new WifiNoProtection);
185  txParams.m_acknowledgment = GetAckManager ()->TryAddMpdu (mpdu, txParams);
186 
187  // Push the MPDU to the front of the queue and transmit it
188  m_mac->GetQosTxop (tid)->GetWifiMacQueue ()->PushFront (mpdu);
189  SendMpduWithProtection (mpdu, txParams);
190 }
191 
192 void
194  Mac48Address originator)
195 {
196  NS_LOG_FUNCTION (this << originator);
197  WifiMacHeader hdr;
199  hdr.SetAddr1 (originator);
200  hdr.SetAddr2 (m_self);
201  hdr.SetAddr3 (m_bssid);
202  hdr.SetDsNotFrom ();
203  hdr.SetDsNotTo ();
204 
205  MgtAddBaResponseHeader respHdr;
206  StatusCode code;
207  code.SetSuccess ();
208  respHdr.SetStatusCode (code);
209  //Here a control about queues type?
210  respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ());
211 
212  if (reqHdr->IsImmediateBlockAck ())
213  {
214  respHdr.SetImmediateBlockAck ();
215  }
216  else
217  {
218  respHdr.SetDelayedBlockAck ();
219  }
220  respHdr.SetTid (reqHdr->GetTid ());
221 
222  respHdr.SetBufferSize (GetSupportedBaBufferSize () - 1);
223  respHdr.SetTimeout (reqHdr->GetTimeout ());
224 
225  WifiActionHeader actionHdr;
228  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
229 
230  Ptr<Packet> packet = Create<Packet> ();
231  packet->AddHeader (respHdr);
232  packet->AddHeader (actionHdr);
233 
234  CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSequence ());
235 
236  //It is unclear which queue this frame should go into. For now we
237  //bung it into the queue corresponding to the TID for which we are
238  //establishing an agreement, and push it to the head.
239  m_mac->GetQosTxop (reqHdr->GetTid ())->PushFront (packet, hdr);
240 }
241 
242 uint16_t
244 {
245  return 64;
246 }
247 
248 void
249 HtFrameExchangeManager::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
250 {
251  NS_LOG_FUNCTION (this << addr << +tid << byOriginator);
252  WifiMacHeader hdr;
254  hdr.SetAddr1 (addr);
255  hdr.SetAddr2 (m_self);
256  hdr.SetAddr3 (m_bssid);
257  hdr.SetDsNotTo ();
258  hdr.SetDsNotFrom ();
259 
260  MgtDelBaHeader delbaHdr;
261  delbaHdr.SetTid (tid);
262  if (byOriginator)
263  {
264  delbaHdr.SetByOriginator ();
265  GetBaManager (tid)->DestroyAgreement (addr, tid);
266  }
267  else
268  {
269  delbaHdr.SetByRecipient ();
270  DestroyBlockAckAgreement (addr, tid);
271  }
272 
273  WifiActionHeader actionHdr;
276  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
277 
278  Ptr<Packet> packet = Create<Packet> ();
279  packet->AddHeader (delbaHdr);
280  packet->AddHeader (actionHdr);
281 
282  m_mac->GetQosTxop (tid)->GetWifiMacQueue ()->PushFront (Create<WifiMacQueueItem> (packet, hdr));
283 }
284 
285 void
287  uint16_t startingSeq)
288 {
289  NS_LOG_FUNCTION (this << *respHdr << originator << startingSeq);
290  uint8_t tid = respHdr->GetTid ();
291 
292  RecipientBlockAckAgreement agreement (originator, respHdr->IsAmsduSupported (), tid,
293  respHdr->GetBufferSize () + 1, respHdr->GetTimeout (),
294  startingSeq,
295  m_mac->GetWifiRemoteStationManager ()->GetHtSupported ()
296  && m_mac->GetWifiRemoteStationManager ()->GetHtSupported (originator));
297  agreement.SetMacRxMiddle (m_rxMiddle);
298  if (respHdr->IsImmediateBlockAck ())
299  {
300  agreement.SetImmediateBlockAck ();
301  }
302  else
303  {
304  agreement.SetDelayedBlockAck ();
305  }
306 
307  if (respHdr->GetTimeout () != 0)
308  {
309  Time timeout = MicroSeconds (1024 * agreement.GetTimeout ());
310 
312  this, originator, tid, false);
313  }
314 
315  m_agreements.insert ({{originator, tid}, agreement});
316  GetBaManager (tid)->SetBlockAckInactivityCallback (MakeCallback (&HtFrameExchangeManager::SendDelbaFrame, this));
317 }
318 
319 void
321 {
322  NS_LOG_FUNCTION (this << originator << +tid);
323 
324  auto agreementIt = m_agreements.find ({originator, tid});
325  if (agreementIt != m_agreements.end ())
326  {
327  // forward up the buffered MPDUs before destroying the agreement
328  agreementIt->second.Flush ();
329  m_agreements.erase (agreementIt);
330  }
331 }
332 
333 bool
334 HtFrameExchangeManager::StartFrameExchange (Ptr<QosTxop> edca, Time availableTime, bool initialFrame)
335 {
336  NS_LOG_FUNCTION (this << edca << availableTime << initialFrame);
337 
338  // First, check if there is a BAR to be transmitted
339  if (SendMpduFromBaManager (edca, availableTime, initialFrame))
340  {
341  return true;
342  }
343 
344  Ptr<const WifiMacQueueItem> peekedItem = edca->PeekNextMpdu ();
345 
346  // Even though channel access is requested when the queue is not empty, at
347  // the time channel access is granted the lifetime of the packet might be
348  // expired and the queue might be empty.
349  if (peekedItem == 0)
350  {
351  NS_LOG_DEBUG ("No frames available for transmission");
352  return false;
353  }
354 
355  const WifiMacHeader& hdr = peekedItem->GetHeader ();
356  // setup a Block Ack agreement if needed
357  if (hdr.IsQosData () && !hdr.GetAddr1 ().IsGroup ()
358  && NeedSetupBlockAck (hdr.GetAddr1 (), hdr.GetQosTid ()))
359  {
360  // if the peeked MPDU has been already transmitted, use its sequence number
361  // as the starting sequence number for the BA agreement, otherwise use the
362  // next available sequence number
363  uint16_t startingSeq = (hdr.IsRetry () ? hdr.GetSequenceNumber ()
364  : m_txMiddle->GetNextSeqNumberByTidAndAddress (hdr.GetQosTid (),
365  hdr.GetAddr1 ()));
366  SendAddBaRequest (hdr.GetAddr1 (), hdr.GetQosTid (), startingSeq,
367  edca->GetBlockAckInactivityTimeout (), true);
368  return true;
369  }
370 
371  // Use SendDataFrame if we can try aggregation
372  if (hdr.IsQosData () && !hdr.GetAddr1 ().IsGroup () && !peekedItem->IsFragment ()
373  && !m_mac->GetWifiRemoteStationManager ()->NeedFragmentation (peekedItem))
374  {
375  return SendDataFrame (peekedItem, availableTime, initialFrame);
376  }
377 
378  // Use the QoS FEM to transmit the frame in all the other cases, i.e.:
379  // - the frame is not a QoS data frame
380  // - the frame is a broadcast QoS data frame
381  // - the frame is a fragment
382  // - the frame must be fragmented
383  return QosFrameExchangeManager::StartFrameExchange (edca, availableTime, initialFrame);
384 }
385 
386 bool
387 HtFrameExchangeManager::SendMpduFromBaManager (Ptr<QosTxop> edca, Time availableTime, bool initialFrame)
388 {
389  NS_LOG_FUNCTION (this << edca << availableTime << initialFrame);
390 
391  // First, check if there is a BAR to be transmitted
392  Ptr<const WifiMacQueueItem> peekedItem = edca->GetBaManager ()->GetBar (false);
393 
394  if (peekedItem == 0)
395  {
396  NS_LOG_DEBUG ("Block Ack Manager returned no frame to send");
397  return false;
398  }
399 
400  NS_ASSERT (peekedItem->GetHeader ().IsBlockAckReq ());
401 
402  // Prepare the TX parameters. Note that the default ack manager expects the
403  // data TxVector in the m_txVector field to compute the BlockAck TxVector.
404  // The m_txVector field of the TX parameters is set to the BlockAckReq TxVector
405  // a few lines below.
406  WifiTxParameters txParams;
407  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peekedItem->GetHeader ());
408  txParams.m_protection = std::unique_ptr<WifiProtection> (new WifiNoProtection);
409  txParams.m_acknowledgment = GetAckManager ()->TryAddMpdu (peekedItem, txParams);
410 
412 
413  WifiBlockAck* blockAcknowledgment = static_cast<WifiBlockAck*> (txParams.m_acknowledgment.get ());
414  CalculateAcknowledgmentTime (blockAcknowledgment);
415  // the BlockAckReq frame is sent using the same TXVECTOR as the BlockAck frame
416  txParams.m_txVector = blockAcknowledgment->blockAckTxVector;
417 
418  Time barTxDuration = m_phy->CalculateTxDuration (peekedItem->GetSize (),
419  blockAcknowledgment->blockAckTxVector,
420  m_phy->GetPhyBand ());
421 
422  // if the available time is limited and we are not transmitting the initial
423  // frame of the TXOP, we have to check that this frame and its response fit
424  // within the given time limits
425  if (availableTime != Time::Min () && !initialFrame
426  && barTxDuration + m_phy->GetSifs () + blockAcknowledgment->acknowledgmentTime > availableTime)
427  {
428  NS_LOG_DEBUG ("Not enough time to send the BAR frame returned by the Block Ack Manager");
429  return false;
430  }
431 
432  // we can transmit the BlockAckReq frame
433  Ptr<const WifiMacQueueItem> mpdu = edca->GetBaManager ()->GetBar ();
434  SendPsduWithProtection (GetWifiPsdu (Copy (mpdu), txParams.m_txVector), txParams);
435  return true;
436 }
437 
438 bool
440  Time availableTime, bool initialFrame)
441 {
442  NS_ASSERT (peekedItem != 0 && peekedItem->GetHeader ().IsQosData ()
443  && !peekedItem->GetHeader ().GetAddr1 ().IsBroadcast ()
444  && !peekedItem->IsFragment ());
445  NS_LOG_FUNCTION (this << *peekedItem << availableTime << initialFrame);
446 
447  Ptr<QosTxop> edca = m_mac->GetQosTxop (peekedItem->GetHeader ().GetQosTid ());
448  WifiTxParameters txParams;
449  txParams.m_txVector = m_mac->GetWifiRemoteStationManager ()->GetDataTxVector (peekedItem->GetHeader ());
450  Ptr<WifiMacQueueItem> mpdu = edca->GetNextMpdu (peekedItem, txParams, availableTime, initialFrame);
451 
452  if (mpdu == nullptr)
453  {
454  NS_LOG_DEBUG ("Not enough time to transmit a frame");
455  return false;
456  }
457 
458  // try A-MPDU aggregation
459  std::vector<Ptr<WifiMacQueueItem>> mpduList = m_mpduAggregator->GetNextAmpdu (mpdu, txParams,
460  availableTime);
461  NS_ASSERT (txParams.m_acknowledgment);
462 
463  if (mpduList.size () > 1)
464  {
465  // A-MPDU aggregation succeeded
466  SendPsduWithProtection (Create<WifiPsdu> (std::move (mpduList)), txParams);
467  }
468  else if (txParams.m_acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK)
469  {
470  // a QoS data frame using the Block Ack policy can be followed by a BlockAckReq
471  // frame and a BlockAck frame. Such a sequence is handled by the HT FEM
472  SendPsduWithProtection (Create<WifiPsdu> (mpdu, false), txParams);
473  }
474  else
475  {
476  // transmission can be handled by the base FEM
477  SendMpduWithProtection (mpdu, txParams);
478  }
479 
480  return true;
481 }
482 
483 void
485 {
486  NS_LOG_FUNCTION (this << acknowledgment);
487  NS_ASSERT (acknowledgment != nullptr);
488 
489  if (acknowledgment->method == WifiAcknowledgment::BLOCK_ACK)
490  {
491  WifiBlockAck* blockAcknowledgment = static_cast<WifiBlockAck*> (acknowledgment);
492  Time baTxDuration = m_phy->CalculateTxDuration (GetBlockAckSize (blockAcknowledgment->baType),
493  blockAcknowledgment->blockAckTxVector,
494  m_phy->GetPhyBand ());
495  blockAcknowledgment->acknowledgmentTime = m_phy->GetSifs () + baTxDuration;
496  }
497  else if (acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK)
498  {
499  WifiBarBlockAck* barBlockAcknowledgment = static_cast<WifiBarBlockAck*> (acknowledgment);
500  Time barTxDuration = m_phy->CalculateTxDuration (GetBlockAckRequestSize (barBlockAcknowledgment->barType),
501  barBlockAcknowledgment->blockAckReqTxVector,
502  m_phy->GetPhyBand ());
503  Time baTxDuration = m_phy->CalculateTxDuration (GetBlockAckSize (barBlockAcknowledgment->baType),
504  barBlockAcknowledgment->blockAckTxVector,
505  m_phy->GetPhyBand ());
506  barBlockAcknowledgment->acknowledgmentTime = 2 * m_phy->GetSifs () + barTxDuration + baTxDuration;
507  }
508  else
509  {
511  }
512 }
513 
514 void
516 {
517  ForwardPsduDown (GetWifiPsdu (mpdu, txVector), txVector);
518 }
519 
522 {
523  return Create<WifiPsdu> (mpdu, false);
524 }
525 
526 void
528 {
529  NS_LOG_FUNCTION (this << *mpdu);
530 
531  if (mpdu->GetHeader ().IsQosData ())
532  {
533  uint8_t tid = mpdu->GetHeader ().GetQosTid ();
534  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
535 
536  if (edca->GetBaAgreementEstablished (mpdu->GetHeader ().GetAddr1 (), tid))
537  {
538  // notify the BA manager that the MPDU was acknowledged
539  edca->GetBaManager ()->NotifyGotAck (mpdu);
540  }
541  }
542  else if (mpdu->GetHeader ().IsAction ())
543  {
544  WifiActionHeader actionHdr;
545  Ptr<Packet> p = mpdu->GetPacket ()->Copy ();
546  p->RemoveHeader (actionHdr);
547  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK)
548  {
550  {
551  MgtDelBaHeader delBa;
552  p->PeekHeader (delBa);
553  if (delBa.IsByOriginator ())
554  {
555  GetBaManager (delBa.GetTid ())->DestroyAgreement (mpdu->GetHeader ().GetAddr1 (),
556  delBa.GetTid ());
557  }
558  else
559  {
560  DestroyBlockAckAgreement (mpdu->GetHeader ().GetAddr1 (), delBa.GetTid ());
561  }
562  }
564  {
565  // Setup ADDBA response timeout
566  MgtAddBaRequestHeader addBa;
567  p->PeekHeader (addBa);
568  Ptr<QosTxop> edca = m_mac->GetQosTxop (addBa.GetTid ());
571  mpdu->GetHeader ().GetAddr1 (), addBa.GetTid ());
572  }
573  }
574  }
576 }
577 
578 void
580 {
581  NS_LOG_DEBUG (this);
582 
583  if (m_edca != 0 && m_edca->GetTxopLimit ().IsZero () && m_edca->GetBaManager ()->GetBar (false) != 0)
584  {
585  // A TXOP limit of 0 indicates that the TXOP holder may transmit or cause to
586  // be transmitted (as responses) the following within the current TXOP:
587  // f) Any number of BlockAckReq frames
588  // (Sec. 10.22.2.8 of 802.11-2016)
589  NS_LOG_DEBUG ("Schedule a transmission from Block Ack Manager in a SIFS");
591 
592  // TXOP limit is null, hence the txopDuration parameter is unused
593  Simulator::Schedule (m_phy->GetSifs (), fp, this, m_edca, Seconds (0));
594  }
595  else
596  {
598  }
599 }
600 
601 void
603 {
604  NS_LOG_FUNCTION (this << *mpdu);
605 
606  if (mpdu->GetHeader ().IsQosData ())
607  {
608  GetBaManager (mpdu->GetHeader ().GetQosTid ())->NotifyDiscardedMpdu (mpdu);
609  }
610  else if (mpdu->GetHeader ().IsAction ())
611  {
612  WifiActionHeader actionHdr;
613  mpdu->GetPacket ()->PeekHeader (actionHdr);
614  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK)
615  {
616  uint8_t tid = GetTid (mpdu->GetPacket (), mpdu->GetHeader ());
617  if (GetBaManager (tid)->ExistsAgreementInState (mpdu->GetHeader ().GetAddr1 (), tid,
619  {
620  NS_LOG_DEBUG ("No ACK after ADDBA request");
621  GetBaManager (tid)->NotifyAgreementNoReply (mpdu->GetHeader ().GetAddr1 (), tid);
622  Ptr<QosTxop> qosTxop = m_mac->GetQosTxop (tid);
624  mpdu->GetHeader ().GetAddr1 (), tid);
625  }
626  }
627  }
629 }
630 
631 void
633 {
634  NS_LOG_FUNCTION (this << *mpdu);
635 
636  if (mpdu->GetHeader ().IsQosData ())
637  {
638  uint8_t tid = mpdu->GetHeader ().GetQosTid ();
639  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
640 
641  if (edca->GetBaAgreementEstablished (mpdu->GetHeader ().GetAddr1 (), tid))
642  {
643  // notify the BA manager that the MPDU was not acknowledged
644  edca->GetBaManager ()->NotifyMissedAck (mpdu);
645  return;
646  }
647  }
649 }
650 
651 void
653 {
654  NS_LOG_FUNCTION (this << *mpdu);
655 
656  // the MPDU should be still in the queue, unless it expired.
657  const WifiMacHeader& hdr = mpdu->GetHeader ();
658  if (hdr.IsQosData ())
659  {
660  uint8_t tid = hdr.GetQosTid ();
661  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
662 
663  if (edca->GetBaAgreementEstablished (hdr.GetAddr1 (), tid)
664  && !hdr.IsRetry ())
665  {
666  // The MPDU has never been transmitted, so we can make its sequence
667  // number available again if it is lower than the sequence number
668  // maintained by the MAC TX middle
669  uint16_t currentNextSeq = m_txMiddle->PeekNextSequenceNumberFor (&hdr);
670  uint16_t startingSeq = edca->GetBaStartingSequence (hdr.GetAddr1 (), tid);
671 
672  if (BlockAckAgreement::GetDistance (hdr.GetSequenceNumber (), startingSeq)
673  < BlockAckAgreement::GetDistance (currentNextSeq, startingSeq))
674  {
675  m_txMiddle->SetSequenceNumberFor (&hdr);
676  }
677 
678  return;
679  }
680  }
682 }
683 
684 Time
686 {
687  NS_LOG_FUNCTION (this << txDuration << &txParams);
688 
689  NS_ASSERT (m_edca != 0);
690 
691  if (m_edca->GetTxopLimit ().IsZero ())
692  {
693  NS_ASSERT (txParams.m_acknowledgment && txParams.m_acknowledgment->acknowledgmentTime != Time::Min ());
694  return txParams.m_acknowledgment->acknowledgmentTime;
695  }
696 
697  // under multiple protection settings, if the TXOP limit is not null, Duration/ID
698  // is set to cover the remaining TXOP time (Sec. 9.2.5.2 of 802.11-2016).
699  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
700  // of 802.11-2016)
701  return std::max (m_edca->GetRemainingTxop () - txDuration, Seconds (0));
702 }
703 
704 void
706 {
707  NS_LOG_FUNCTION (this << psdu << &txParams);
708 
709  m_psdu = psdu;
710  m_txParams = std::move (txParams);
711 
712 #ifdef NS3_BUILD_PROFILE_DEBUG
713  // If protection is required, the MPDUs must be stored in some queue because
714  // they are not put back in a queue if the RTS/CTS exchange fails
716  {
717  for (const auto& mpdu : *PeekPointer (m_psdu))
718  {
719  NS_ASSERT (mpdu->GetHeader ().IsCtl () || mpdu->IsQueued ());
720  }
721  }
722 #endif
723 
724  // Make sure that the acknowledgment time has been computed, so that SendRts()
725  // and SendCtsToSelf() can reuse this value.
727 
728  if (m_txParams.m_acknowledgment->acknowledgmentTime == Time::Min ())
729  {
731  }
732 
733  // Set QoS Ack policy
735 
737  {
739  }
741  {
743  }
744  else if (m_txParams.m_protection->method == WifiProtection::NONE)
745  {
746  SendPsdu ();
747  }
748  else
749  {
750  NS_ABORT_MSG ("Unknown protection type");
751  }
752 }
753 
754 void
756 {
757  NS_LOG_FUNCTION (this << *rts << txVector);
758 
759  if (m_psdu == 0)
760  {
761  // A CTS Timeout occurred when protecting a single MPDU is handled by the
762  // parent classes
763  QosFrameExchangeManager::CtsTimeout (rts, txVector);
764  return;
765  }
766 
767  NS_ASSERT (m_psdu->GetNMpdus () > 1);
768  m_mac->GetWifiRemoteStationManager ()->ReportRtsFailed (m_psdu->GetHeader (0));
769 
770  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*m_psdu->begin ()))
771  {
772  NS_LOG_DEBUG ("Missed CTS, discard MPDUs");
773  m_mac->GetWifiRemoteStationManager ()->ReportFinalRtsFailed (m_psdu->GetHeader (0));
774  // Dequeue the MPDUs if they are stored in a queue
776  for (const auto& mpdu : *PeekPointer (m_psdu))
777  {
778  NotifyPacketDiscarded (mpdu);
779  }
780  m_edca->ResetCw ();
781  }
782  else
783  {
784  NS_LOG_DEBUG ("Missed CTS, retransmit MPDUs");
785  for (const auto& mpdu : *PeekPointer (m_psdu))
786  {
788  }
790  }
791  m_psdu = 0;
793 }
794 
795 void
797 {
798  NS_LOG_FUNCTION (this);
799 
801 
803 
805  {
807 
808  std::set<uint8_t> tids = m_psdu->GetTids ();
809  NS_ASSERT_MSG (tids.size () <= 1, "Multi-TID A-MPDUs are not supported");
810 
811  if (tids.size () == 0 || m_psdu->GetAckPolicyForTid (*tids.begin ()) == WifiMacHeader::NO_ACK)
812  {
813  // No acknowledgment, hence dequeue the PSDU if it is stored in a queue
815  }
816  }
818  {
820 
821  // the timeout duration is "aSIFSTime + aSlotTime + aRxPHYStartDelay, starting
822  // at the PHY-TXEND.confirm primitive" (section 10.3.2.9 or 10.22.2.2 of 802.11-2016).
823  // aRxPHYStartDelay equals the time to transmit the PHY header.
824  WifiBlockAck* blockAcknowledgment = static_cast<WifiBlockAck*> (m_txParams.m_acknowledgment.get ());
825 
826  Time timeout = txDuration
827  + m_phy->GetSifs ()
828  + m_phy->GetSlot ()
832  this, m_psdu, m_txParams.m_txVector);
833  m_channelAccessManager->NotifyAckTimeoutStartNow (timeout);
834  }
836  {
838 
839  // schedule the transmission of a BAR in a SIFS
840  std::set<uint8_t> tids = m_psdu->GetTids ();
841  NS_ABORT_MSG_IF (tids.size () > 1, "Acknowledgment method incompatible with a Multi-TID A-MPDU");
842  uint8_t tid = *tids.begin ();
843 
844  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
845  edca->ScheduleBar (edca->PrepareBlockAckRequest (m_psdu->GetAddr1 (), tid));
846 
848  }
849  else
850  {
851  NS_ABORT_MSG ("Unable to handle the selected acknowledgment method ("
852  << m_txParams.m_acknowledgment.get () << ")");
853  }
854 
855  // transmit the PSDU
856  if (m_psdu->GetNMpdus () > 1)
857  {
859  }
860  else
861  {
863  }
864 
866  {
867  // we are done in case the A-MPDU does not require acknowledgment
868  m_psdu = 0;
869  }
870 }
871 
872 void
874 {
875  NS_LOG_FUNCTION (this << psdu);
876 
877  // use an array to avoid computing the queue size for every MPDU in the PSDU
878  std::array<std::optional<uint8_t>, 8> queueSizeForTid;
879 
880  for (const auto& mpdu : *PeekPointer (psdu))
881  {
882  WifiMacHeader& hdr = mpdu->GetHeader ();
883 
884  if (hdr.IsQosData ())
885  {
886  uint8_t tid = hdr.GetQosTid ();
887  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
888 
889  if (m_mac->GetTypeOfStation () == STA
890  && (m_setQosQueueSize || hdr.IsQosEosp ()))
891  {
892  // set the Queue Size subfield of the QoS Control field
893  if (!queueSizeForTid[tid].has_value ())
894  {
895  queueSizeForTid[tid] = edca->GetQosQueueSize (tid, hdr.GetAddr1 ());
896  }
897 
898  hdr.SetQosEosp ();
899  hdr.SetQosQueueSize (queueSizeForTid[tid].value ());
900  }
901 
902  if (hdr.HasData ())
903  {
904  edca->CompleteMpduTx (mpdu);
905  }
906  }
907  }
908 }
909 
910 void
912 {
913  NS_LOG_DEBUG (this << psdu);
914 
915  for (const auto& mpdu : *PeekPointer (psdu))
916  {
917  DequeueMpdu (mpdu);
918  }
919 }
920 
921 void
923 {
924  NS_LOG_FUNCTION (this << psdu << txVector);
925 
926  NS_LOG_DEBUG ("Transmitting a PSDU: " << *psdu << " TXVECTOR: " << txVector);
927  NotifyTxToEdca (psdu);
928 
929  if (psdu->IsAggregate ())
930  {
931  txVector.SetAggregation (true);
932  }
933 
934  m_phy->Send (psdu, txVector);
935 }
936 
937 bool
939  const WifiTxParameters& txParams,
940  Time ppduDurationLimit) const
941 {
942  NS_ASSERT (mpdu != 0);
943  NS_LOG_FUNCTION (this << *mpdu << &txParams << ppduDurationLimit);
944 
945  Mac48Address receiver = mpdu->GetHeader ().GetAddr1 ();
946  uint32_t ampduSize = txParams.GetSizeIfAddMpdu (mpdu);
947 
948  if (txParams.GetSize (receiver) > 0)
949  {
950  // we are attempting to perform A-MPDU aggregation, hence we have to check
951  // that we meet the limit on the max A-MPDU size
952  uint8_t tid;
953  const WifiTxParameters::PsduInfo* info;
954 
955  if (mpdu->GetHeader ().IsQosData ())
956  {
957  tid = mpdu->GetHeader ().GetQosTid ();
958  }
959  else if ((info = txParams.GetPsduInfo (receiver)) && !info->seqNumbers.empty ())
960  {
961  tid = info->seqNumbers.begin ()->first;
962  }
963  else
964  {
965  NS_ABORT_MSG ("Cannot aggregate a non-QoS data frame to an A-MPDU that does"
966  " not contain any QoS data frame");
967  }
968 
969  WifiModulationClass modulation = txParams.m_txVector.GetModulationClass ();
970 
971  if (!IsWithinAmpduSizeLimit (ampduSize, receiver, tid, modulation))
972  {
973  return false;
974  }
975  }
976 
977  return IsWithinSizeAndTimeLimits (ampduSize, receiver, txParams, ppduDurationLimit);
978 }
979 
980 bool
981 HtFrameExchangeManager::IsWithinAmpduSizeLimit (uint32_t ampduSize, Mac48Address receiver, uint8_t tid,
982  WifiModulationClass modulation) const
983 {
984  NS_LOG_FUNCTION (this << ampduSize << receiver << +tid << modulation);
985 
986  uint32_t maxAmpduSize = m_mpduAggregator->GetMaxAmpduSize (receiver, tid, modulation);
987 
988  if (maxAmpduSize == 0)
989  {
990  NS_LOG_DEBUG ("A-MPDU aggregation disabled");
991  return false;
992  }
993 
994  if (ampduSize > maxAmpduSize)
995  {
996  NS_LOG_DEBUG ("the frame does not meet the constraint on max A-MPDU size ("
997  << maxAmpduSize << ")");
998  return false;
999  }
1000  return true;
1001 }
1002 
1003 bool
1005  Time availableTime) const
1006 {
1007  NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1008  NS_LOG_FUNCTION (this << *msdu << &txParams << availableTime);
1009 
1010  // check if aggregating the given MSDU requires a different protection method
1011  NS_ASSERT (txParams.m_protection);
1012  Time protectionTime = txParams.m_protection->protectionTime;
1013 
1014  std::unique_ptr<WifiProtection> protection;
1015  protection = GetProtectionManager ()->TryAggregateMsdu (msdu, txParams);
1016  bool protectionSwapped = false;
1017 
1018  if (protection)
1019  {
1020  // the protection method has changed, calculate the new protection time
1021  CalculateProtectionTime (protection.get ());
1022  protectionTime = protection->protectionTime;
1023  // swap unique pointers, so that the txParams that is passed to the next
1024  // call to IsWithinLimitsIfAggregateMsdu is the most updated one
1025  txParams.m_protection.swap (protection);
1026  protectionSwapped = true;
1027  }
1028  NS_ASSERT (protectionTime != Time::Min ());
1029 
1030  // check if aggregating the given MSDU requires a different acknowledgment method
1031  NS_ASSERT (txParams.m_acknowledgment);
1032  Time acknowledgmentTime = txParams.m_acknowledgment->acknowledgmentTime;
1033 
1034  std::unique_ptr<WifiAcknowledgment> acknowledgment;
1035  acknowledgment = GetAckManager ()->TryAggregateMsdu (msdu, txParams);
1036  bool acknowledgmentSwapped = false;
1037 
1038  if (acknowledgment)
1039  {
1040  // the acknowledgment method has changed, calculate the new acknowledgment time
1041  CalculateAcknowledgmentTime (acknowledgment.get ());
1042  acknowledgmentTime = acknowledgment->acknowledgmentTime;
1043  // swap unique pointers, so that the txParams that is passed to the next
1044  // call to IsWithinLimitsIfAggregateMsdu is the most updated one
1045  txParams.m_acknowledgment.swap (acknowledgment);
1046  acknowledgmentSwapped = true;
1047  }
1048  NS_ASSERT (acknowledgmentTime != Time::Min ());
1049 
1050  Time ppduDurationLimit = Time::Min ();
1051  if (availableTime != Time::Min ())
1052  {
1053  ppduDurationLimit = availableTime - protectionTime - acknowledgmentTime;
1054  }
1055 
1056  if (!IsWithinLimitsIfAggregateMsdu (msdu, txParams, ppduDurationLimit))
1057  {
1058  // adding MPDU failed, restore protection and acknowledgment methods
1059  // if they were swapped
1060  if (protectionSwapped)
1061  {
1062  txParams.m_protection.swap (protection);
1063  }
1064  if (acknowledgmentSwapped)
1065  {
1066  txParams.m_acknowledgment.swap (acknowledgment);
1067  }
1068  return false;
1069  }
1070 
1071  // the given MPDU can be added, hence update the txParams
1072  txParams.AggregateMsdu (msdu);
1073  UpdateTxDuration (msdu->GetHeader ().GetAddr1 (), txParams);
1074 
1075  return true;
1076 }
1077 
1078 bool
1080  const WifiTxParameters& txParams,
1081  Time ppduDurationLimit) const
1082 {
1083  NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1084  NS_LOG_FUNCTION (this << *msdu << &txParams << ppduDurationLimit);
1085 
1086  std::pair<uint16_t, uint32_t> ret = txParams.GetSizeIfAggregateMsdu (msdu);
1087  Mac48Address receiver = msdu->GetHeader ().GetAddr1 ();
1088  uint8_t tid = msdu->GetHeader ().GetQosTid ();
1089  WifiModulationClass modulation = txParams.m_txVector.GetModulationClass ();
1090 
1091  // Check that the limit on A-MSDU size is met
1092  uint16_t maxAmsduSize = m_msduAggregator->GetMaxAmsduSize (receiver, tid, modulation);
1093 
1094  if (maxAmsduSize == 0)
1095  {
1096  NS_LOG_DEBUG ("A-MSDU aggregation disabled");
1097  return false;
1098  }
1099 
1100  if (ret.first > maxAmsduSize)
1101  {
1102  NS_LOG_DEBUG ("No other MSDU can be aggregated: maximum A-MSDU size ("
1103  << maxAmsduSize << ") reached ");
1104  return false;
1105  }
1106 
1107  const WifiTxParameters::PsduInfo* info = txParams.GetPsduInfo (msdu->GetHeader ().GetAddr1 ());
1108  NS_ASSERT (info != nullptr);
1109 
1110  if (info->ampduSize > 0)
1111  {
1112  // the A-MSDU being built is aggregated to other MPDUs in an A-MPDU.
1113  // Check that the limit on A-MPDU size is met.
1114  if (!IsWithinAmpduSizeLimit (ret.second, receiver, tid, modulation))
1115  {
1116  return false;
1117  }
1118  }
1119 
1120  return IsWithinSizeAndTimeLimits (ret.second, receiver, txParams, ppduDurationLimit);
1121 }
1122 
1123 void
1125 {
1126  NS_LOG_FUNCTION (this << *psdu << txVector);
1127 
1128  m_mac->GetWifiRemoteStationManager ()->ReportDataFailed (*psdu->begin ());
1129 
1130  bool resetCw;
1131  MissedBlockAck (psdu, txVector, resetCw);
1132 
1133  NS_ASSERT (m_edca != 0);
1134 
1135  if (resetCw)
1136  {
1137  m_edca->ResetCw ();
1138  }
1139  else
1140  {
1141  m_edca->UpdateFailedCw ();
1142  }
1143 
1144  m_psdu = 0;
1145  TransmissionFailed ();
1146 }
1147 
1148 void
1150 {
1151  NS_LOG_FUNCTION (this << psdu << txVector << resetCw);
1152 
1153  Mac48Address recipient = psdu->GetAddr1 ();
1154  bool isBar;
1155  uint8_t tid;
1156 
1157  if (psdu->GetNMpdus () == 1 && psdu->GetHeader (0).IsBlockAckReq ())
1158  {
1159  isBar = true;
1160  CtrlBAckRequestHeader baReqHdr;
1161  psdu->GetPayload (0)->PeekHeader (baReqHdr);
1162  tid = baReqHdr.GetTidInfo ();
1163  }
1164  else
1165  {
1166  isBar = false;
1167  m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (recipient, 0, psdu->GetNMpdus (),
1168  0, 0, txVector);
1169  std::set<uint8_t> tids = psdu->GetTids ();
1170  NS_ABORT_MSG_IF (tids.size () > 1, "Multi-TID A-MPDUs not handled here");
1171  NS_ASSERT (!tids.empty ());
1172  tid = *tids.begin ();
1173  }
1174 
1175  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
1176 
1177  if (edca->UseExplicitBarAfterMissedBlockAck () || isBar)
1178  {
1179  // we have to send a BlockAckReq, if needed
1180  if (GetBaManager (tid)->NeedBarRetransmission (tid, recipient))
1181  {
1182  NS_LOG_DEBUG ("Missed Block Ack, transmit a BlockAckReq");
1183  if (isBar)
1184  {
1185  psdu->GetHeader (0).SetRetry ();
1186  edca->ScheduleBar (*psdu->begin ());
1187  }
1188  else
1189  {
1190  // missed block ack after data frame with Implicit BAR Ack policy
1191  edca->ScheduleBar (edca->PrepareBlockAckRequest (recipient, tid));
1192  }
1193  resetCw = false;
1194  }
1195  else
1196  {
1197  NS_LOG_DEBUG ("Missed Block Ack, do not transmit a BlockAckReq");
1198  // if a BA agreement exists, we can get here if there is no outstanding
1199  // MPDU whose lifetime has not expired yet.
1200  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->begin ());
1201  if (GetBaManager (tid)->ExistsAgreementInState (recipient, tid,
1203  {
1204  // schedule a BlockAckRequest with skipIfNoDataQueued set to true, so that the
1205  // BlockAckRequest is only sent if there are data frames queued for this recipient.
1206  edca->ScheduleBar (edca->PrepareBlockAckRequest (recipient, tid), true);
1207  }
1208  resetCw = true;
1209  }
1210  }
1211  else
1212  {
1213  // we have to retransmit the data frames, if needed
1214  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*psdu->begin ()))
1215  {
1216  NS_LOG_DEBUG ("Missed Block Ack, do not retransmit the data frames");
1217  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->begin ());
1218  for (const auto& mpdu : *PeekPointer (psdu))
1219  {
1220  NotifyPacketDiscarded (mpdu);
1221  DequeueMpdu (mpdu);
1222  }
1223  resetCw = true;
1224  }
1225  else
1226  {
1227  NS_LOG_DEBUG ("Missed Block Ack, retransmit data frames");
1228  GetBaManager (tid)->NotifyMissedBlockAck (recipient, tid);
1229  resetCw = false;
1230  }
1231  }
1232 }
1233 
1234 void
1236  WifiTxVector& blockAckTxVector, double rxSnr)
1237 {
1238  NS_LOG_FUNCTION (this << durationId << blockAckTxVector << rxSnr);
1239 
1240  WifiMacHeader hdr;
1242  hdr.SetAddr1 (agreement.GetPeer ());
1243  hdr.SetAddr2 (m_self);
1244  hdr.SetDsNotFrom ();
1245  hdr.SetDsNotTo ();
1246 
1247  CtrlBAckResponseHeader blockAck;
1248  blockAck.SetType (agreement.GetBlockAckType ());
1249  blockAck.SetTidInfo (agreement.GetTid ());
1250  agreement.FillBlockAckBitmap (&blockAck);
1251 
1252  Ptr<Packet> packet = Create<Packet> ();
1253  packet->AddHeader (blockAck);
1254  Ptr<WifiPsdu> psdu = GetWifiPsdu (Create<WifiMacQueueItem> (packet, hdr), blockAckTxVector);
1255 
1256  // 802.11-2016, Section 9.2.5.7: In a BlockAck frame transmitted in response
1257  // to a BlockAckReq frame or transmitted in response to a frame containing an
1258  // implicit block ack request, the Duration/ID field is set to the value obtained
1259  // from the Duration/ ID field of the frame that elicited the response minus the
1260  // time, in microseconds between the end of the PPDU carrying the frame that
1261  // elicited the response and the end of the PPDU carrying the BlockAck frame.
1262  Time baDurationId = durationId - m_phy->GetSifs ()
1263  - m_phy->CalculateTxDuration (psdu, blockAckTxVector, m_phy->GetPhyBand ());
1264  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8 of 802.11-2016)
1265  if (baDurationId.IsStrictlyNegative ())
1266  {
1267  baDurationId = Seconds (0);
1268  }
1269  psdu->GetHeader (0).SetDuration (baDurationId);
1270 
1271  SnrTag tag;
1272  tag.Set (rxSnr);
1273  psdu->GetPayload (0)->AddPacketTag (tag);
1274 
1275  ForwardPsduDown (psdu, blockAckTxVector);
1276 }
1277 
1278 bool
1280 {
1281  return (m_agreements.find ({originator, tid}) != m_agreements.end ());
1282 }
1283 
1286 {
1287  auto it = m_agreements.find ({originator, tid});
1288  NS_ABORT_MSG_IF (it == m_agreements.end (), "No established Block Ack agreement");
1289  return it->second.GetBlockAckType ();
1290 }
1291 
1292 void
1294  const WifiTxVector& txVector, bool inAmpdu)
1295 {
1296  // The received MPDU is either broadcast or addressed to this station
1297  NS_ASSERT (mpdu->GetHeader ().GetAddr1 ().IsGroup ()
1298  || mpdu->GetHeader ().GetAddr1 () == m_self);
1299 
1300  double rxSnr = rxSignalInfo.snr;
1301  const WifiMacHeader& hdr = mpdu->GetHeader ();
1302 
1303  if (hdr.IsCtl ())
1304  {
1306  && m_psdu != 0)
1307  {
1308  NS_ABORT_MSG_IF (inAmpdu, "Received CTS as part of an A-MPDU");
1309  NS_ASSERT (hdr.GetAddr1 () == m_self);
1310 
1311  Mac48Address sender = m_psdu->GetAddr1 ();
1312  NS_LOG_DEBUG ("Received CTS from=" << sender);
1313 
1314  SnrTag tag;
1315  mpdu->GetPacket ()->PeekPacketTag (tag);
1316  m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
1317  m_mac->GetWifiRemoteStationManager ()->ReportRtsOk (m_psdu->GetHeader (0),
1318  rxSnr, txVector.GetMode (), tag.Get ());
1319 
1320  m_txTimer.Cancel ();
1321  m_channelAccessManager->NotifyCtsTimeoutResetNow ();
1323  }
1324  else if (hdr.IsBlockAck () && m_txTimer.IsRunning ()
1326  && hdr.GetAddr1 () == m_self)
1327  {
1328  Mac48Address sender = hdr.GetAddr2 ();
1329  NS_LOG_DEBUG ("Received BlockAck from=" << sender);
1330 
1331  SnrTag tag;
1332  mpdu->GetPacket ()->PeekPacketTag (tag);
1333 
1334  // notify the Block Ack Manager
1335  CtrlBAckResponseHeader blockAck;
1336  mpdu->GetPacket ()->PeekHeader (blockAck);
1337  uint8_t tid = blockAck.GetTidInfo ();
1338  std::pair<uint16_t,uint16_t> ret = GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid});
1339  m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.GetAddr2 (), ret.first, ret.second,
1340  rxSnr, tag.Get (), m_txParams.m_txVector);
1341 
1342  // cancel the timer
1343  m_txTimer.Cancel ();
1344  m_channelAccessManager->NotifyAckTimeoutResetNow ();
1345 
1346  // Reset the CW
1347  m_edca->ResetCw ();
1348 
1349  m_psdu = 0;
1351  }
1352  else if (hdr.IsBlockAckReq ())
1353  {
1354  NS_ASSERT (hdr.GetAddr1 () == m_self);
1355  NS_ABORT_MSG_IF (inAmpdu, "BlockAckReq in A-MPDU is not supported");
1356 
1357  Mac48Address sender = hdr.GetAddr2 ();
1358  NS_LOG_DEBUG ("Received BlockAckReq from=" << sender);
1359 
1360  CtrlBAckRequestHeader blockAckReq;
1361  mpdu->GetPacket ()->PeekHeader (blockAckReq);
1362  NS_ABORT_MSG_IF (blockAckReq.IsMultiTid (), "Multi-TID BlockAckReq not supported");
1363  uint8_t tid = blockAckReq.GetTidInfo ();
1364 
1365  auto agreementIt = m_agreements.find ({sender, tid});
1366 
1367  if (agreementIt == m_agreements.end ())
1368  {
1369  NS_LOG_DEBUG ("There's not a valid agreement for this BlockAckReq");
1370  return;
1371  }
1372 
1373  agreementIt->second.NotifyReceivedBar (blockAckReq.GetStartingSequence ());
1374 
1375  NS_LOG_DEBUG ("Schedule Block Ack");
1377  agreementIt->second, hdr.GetDuration (),
1378  m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (sender, txVector),
1379  rxSnr);
1380  }
1381  else
1382  {
1383  // the received control frame cannot be handled here
1384  QosFrameExchangeManager::ReceiveMpdu (mpdu, rxSignalInfo, txVector, inAmpdu);
1385  }
1386  return;
1387  }
1388 
1389  if (hdr.IsQosData () && hdr.HasData () && hdr.GetAddr1 () == m_self)
1390  {
1391  uint8_t tid = hdr.GetQosTid ();
1392 
1393  auto agreementIt = m_agreements.find ({hdr.GetAddr2 (), tid});
1394  if (agreementIt != m_agreements.end ())
1395  {
1396  // a Block Ack agreement has been established
1397  NS_LOG_DEBUG ("Received from=" << hdr.GetAddr2 ()
1398  << " (" << *mpdu << ")");
1399 
1400  agreementIt->second.NotifyReceivedMpdu (mpdu);
1401 
1402  if (!inAmpdu && hdr.GetQosAckPolicy () == WifiMacHeader::NORMAL_ACK)
1403  {
1404  NS_LOG_DEBUG ("Schedule Normal Ack");
1406  this, hdr, txVector, rxSnr);
1407  }
1408  return;
1409  }
1410  // We let the QosFrameExchangeManager handle QoS data frame not belonging
1411  // to a Block Ack agreement
1412  }
1413 
1414  QosFrameExchangeManager::ReceiveMpdu (mpdu, rxSignalInfo, txVector, inAmpdu);
1415 }
1416 
1417 void
1419  const WifiTxVector& txVector, const std::vector<bool>& perMpduStatus)
1420 {
1421  std::set<uint8_t> tids = psdu->GetTids ();
1422 
1423  // Multi-TID A-MPDUs are not supported yet
1424  if (tids.size () == 1)
1425  {
1426  uint8_t tid = *tids.begin ();
1427  WifiMacHeader::QosAckPolicy ackPolicy = psdu->GetAckPolicyForTid (tid);
1428  NS_ASSERT (psdu->GetNMpdus () > 1);
1429 
1430  if (ackPolicy == WifiMacHeader::NORMAL_ACK)
1431  {
1432  // Normal Ack or Implicit Block Ack Request
1433  NS_LOG_DEBUG ("Schedule Block Ack");
1434  auto agreementIt = m_agreements.find ({psdu->GetAddr2 (), tid});
1435  NS_ASSERT (agreementIt != m_agreements.end ());
1436 
1438  agreementIt->second, psdu->GetDuration (),
1439  m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (psdu->GetAddr2 (), txVector),
1440  rxSignalInfo.snr);
1441  }
1442  }
1443 }
1444 
1445 } //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:487
ns3::GetBlockAckSize
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Definition: wifi-utils.cc:63
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:795
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::BlockAckAgreement::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: block-ack-agreement.cc:100
ns3::WifiTxParameters::PsduInfo::ampduSize
uint32_t ampduSize
the size in bytes of the A-MPDU if multiple MPDUs have been added, and zero otherwise
Definition: wifi-tx-parameters.h:119
ns3::RecipientBlockAckAgreement::SetMacRxMiddle
void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
Definition: recipient-block-ack-agreement.cc:68
ns3::QosFrameExchangeManager::m_setQosQueueSize
bool m_setQosQueueSize
whether to set the Queue Size subfield of the QoS Control field of QoS data frames
Definition: qos-frame-exchange-manager.h:161
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::MgtAddBaResponseHeader::IsImmediateBlockAck
bool IsImmediateBlockAck(void) const
Return whether the Block Ack policy is immediate Block Ack.
Definition: mgt-headers.cc:1762
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::HtFrameExchangeManager::CtsTimeout
void CtsTimeout(Ptr< WifiMacQueueItem > rts, const WifiTxVector &txVector) override
Called when the CTS timeout expires.
Definition: ht-frame-exchange-manager.cc:755
ns3::WifiNoProtection
WifiNoProtection specifies that no protection method is used.
Definition: wifi-protection.h:82
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition: wifi-mac-queue-item.cc:66
ns3::FrameExchangeManager::m_phy
Ptr< WifiPhy > m_phy
the PHY layer on this station
Definition: frame-exchange-manager.h:385
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::Packet::PeekHeader
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
ns3::HtFrameExchangeManager::RetransmitMpduAfterMissedCts
void RetransmitMpduAfterMissedCts(Ptr< WifiMacQueueItem > mpdu) const override
Retransmit an MPDU that was not sent because a CTS was not received.
Definition: ht-frame-exchange-manager.cc:652
ns3::WifiPsdu::GetAddr1
Mac48Address GetAddr1(void) const
Get the Receiver Address (RA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:111
ns3::FrameExchangeManager::SendNormalAck
void SendNormalAck(const WifiMacHeader &hdr, const WifiTxVector &dataTxVector, double dataSnr)
Send Normal Ack.
Definition: frame-exchange-manager.cc:678
ns3::MgtAddBaResponseHeader::GetBufferSize
uint16_t GetBufferSize(void) const
Return the buffer size.
Definition: mgt-headers.cc:1774
ns3::WifiTxParameters::GetPsduInfo
const PsduInfo * GetPsduInfo(Mac48Address receiver) const
Get a pointer to the information about the PSDU addressed to the given receiver, if present,...
Definition: wifi-tx-parameters.cc:80
ns3::WifiMacHeader::IsQosEosp
bool IsQosEosp(void) const
Return if the end of service period (EOSP) is set.
Definition: wifi-mac-header.cc:822
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::MgtAddBaRequestHeader::SetImmediateBlockAck
void SetImmediateBlockAck()
Enable immediate BlockAck.
Definition: mgt-headers.cc:1533
ns3::WifiPsdu::GetPayload
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
Definition: wifi-psdu.cc:278
ns3::WifiPhy::GetSlot
Time GetSlot(void) const
Return the slot duration for this PHY.
Definition: wifi-phy.cc:923
ns3::HtFrameExchangeManager::MissedBlockAck
virtual void MissedBlockAck(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector, bool &resetCw)
Take necessary actions when a BlockAck is missed, such as scheduling a BlockAckReq frame or the retra...
Definition: ht-frame-exchange-manager.cc:1149
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
ns3::HtFrameExchangeManager::GetBlockAckType
BlockAckType GetBlockAckType(Mac48Address originator, uint8_t tid) const
Get the type of BlockAck frames sent to the given originator.
Definition: ht-frame-exchange-manager.cc:1285
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::HtFrameExchangeManager::StartFrameExchange
bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame) override
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
Definition: ht-frame-exchange-manager.cc:334
ns3::HtFrameExchangeManager::SendMpduFromBaManager
virtual bool SendMpduFromBaManager(Ptr< QosTxop > edca, Time availableTime, bool initialFrame)
If the Block Ack Manager associated with the given EDCA has a BlockAckReq frame to transmit (the dura...
Definition: ht-frame-exchange-manager.cc:387
ns3::WifiPhy::CalculateTxDuration
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1611
ns3::WifiBlockAck
WifiBlockAck specifies that acknowledgment via Block Ack is required.
Definition: wifi-acknowledgment.h:162
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition: wifi-mac-header.cc:312
ns3::WIFI_MOD_CLASS_HT
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
Definition: wifi-phy-common.h:130
ns3::WifiProtection::CTS_TO_SELF
@ CTS_TO_SELF
Definition: wifi-protection.h:49
ns3::QosTxop::GetBlockAckThreshold
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ack mechanism.
Definition: qos-txop.cc:654
ns3::QosFrameExchangeManager::TransmissionFailed
void TransmissionFailed(void) override
Take necessary actions upon a transmission failure.
Definition: qos-frame-exchange-manager.cc:565
ns3::MgtAddBaRequestHeader::SetBufferSize
void SetBufferSize(uint16_t size)
Set buffer size.
Definition: mgt-headers.cc:1552
ns3::QosTxop::GetBaAgreementEstablished
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:249
ns3::CtrlBAckRequestHeader
Headers for BlockAckRequest.
Definition: ctrl-headers.h:49
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
ns3::MgtDelBaHeader::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:1872
ns3::WifiPsdu::GetAckPolicyForTid
WifiMacHeader::QosAckPolicy GetAckPolicyForTid(uint8_t tid) const
Get the QoS Ack Policy of the QoS Data frames included in the PSDU that have the given TID.
Definition: wifi-psdu.cc:180
ns3::WifiTxTimer::IsRunning
bool IsRunning(void) const
Return true if the timer is running.
Definition: wifi-tx-timer.cc:121
ns3::QosFrameExchangeManager::IsWithinSizeAndTimeLimits
virtual bool IsWithinSizeAndTimeLimits(uint32_t ppduPayloadSize, Mac48Address receiver, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check whether the transmission time of the frame being built (as described by the given TX parameters...
Definition: qos-frame-exchange-manager.cc:406
ns3::HtFrameExchangeManager::DoDispose
void DoDispose() override
Destructor implementation.
Definition: ht-frame-exchange-manager.cc:66
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:458
ns3::QosFrameExchangeManager::TransmissionSucceeded
void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
Definition: qos-frame-exchange-manager.cc:536
ns3::HtFrameExchangeManager::NeedSetupBlockAck
virtual bool NeedSetupBlockAck(Mac48Address recipient, uint8_t tid)
A Block Ack agreement needs to be established with the given recipient for the given TID if it does n...
Definition: ht-frame-exchange-manager.cc:104
ns3::FrameExchangeManager::SendCtsToSelf
void SendCtsToSelf(const WifiTxParameters &txParams)
Send CTS for a CTS-to-self mechanism.
Definition: frame-exchange-manager.cc:651
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:90
ns3::HtFrameExchangeManager::IsWithinLimitsIfAggregateMsdu
virtual bool IsWithinLimitsIfAggregateMsdu(Ptr< const WifiMacQueueItem > msdu, const WifiTxParameters &txParams, Time ppduDurationLimit) const
Check if the PSDU obtained by aggregating the given MSDU to the PSDU specified by the given TX parame...
Definition: ht-frame-exchange-manager.cc:1079
ns3::WifiMacHeader::NO_ACK
@ NO_ACK
Definition: wifi-mac-header.h:93
ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
Definition: wifi-phy.cc:1605
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::HtFrameExchangeManager::SendAddBaRequest
void SendAddBaRequest(Mac48Address recipient, uint8_t tid, uint16_t startingSeq, uint16_t timeout, bool immediateBAck)
Sends an ADDBA Request to establish a block ack agreement with STA addressed by recipient for TID tid...
Definition: ht-frame-exchange-manager.cc:131
ns3::QosTxop::GetBaManager
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:243
ns3::MgtDelBaHeader::SetByOriginator
void SetByOriginator(void)
Set the initiator bit in the DELBA.
Definition: mgt-headers.cc:1880
ns3::QosFrameExchangeManager::ReceiveMpdu
void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
Definition: qos-frame-exchange-manager.cc:658
ns3::HtFrameExchangeManager::SendBlockAck
void SendBlockAck(const RecipientBlockAckAgreement &agreement, Time durationId, WifiTxVector &blockAckTxVector, double rxSnr)
Create a BlockAck frame with header equal to blockAck and start its transmission.
Definition: ht-frame-exchange-manager.cc:1235
ns3::HtFrameExchangeManager::SendPsduWithProtection
void SendPsduWithProtection(Ptr< WifiPsdu > psdu, WifiTxParameters &txParams)
Send a PSDU (A-MPDU or BlockAckReq frame) requesting a BlockAck frame or a BlockAckReq frame followed...
Definition: ht-frame-exchange-manager.cc:705
ns3::FrameExchangeManager::m_channelAccessManager
Ptr< ChannelAccessManager > m_channelAccessManager
the channel access manager
Definition: frame-exchange-manager.h:384
ns3::WifiTxVector::SetAggregation
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
Definition: wifi-tx-vector.cc:292
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::QosFrameExchangeManager::StartFrameExchange
virtual bool StartFrameExchange(Ptr< QosTxop > edca, Time availableTime, bool initialFrame)
Start a frame exchange (including protection frames and acknowledgment frames as needed) that fits wi...
Definition: qos-frame-exchange-manager.cc:262
ns3::QosTxop::UseExplicitBarAfterMissedBlockAck
bool UseExplicitBarAfterMissedBlockAck(void) const
Return true if an explicit BlockAckRequest is sent after a missed BlockAck.
Definition: qos-txop.cc:295
ns3::MgtAddBaRequestHeader
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:1018
ns3::WifiActionHeader::ActionValue
typedef for union of different ActionValues
Definition: mgt-headers.h:956
ns3::HtFrameExchangeManager::SetWifiMac
void SetWifiMac(const Ptr< RegularWifiMac > mac) override
Set the MAC layer to use.
Definition: ht-frame-exchange-manager.cc:78
ns3::WifiMacHeader::IsCts
bool IsCts(void) const
Return true if the header is a CTS header.
Definition: wifi-mac-header.cc:657
ns3::HtFrameExchangeManager::CreateBlockAckAgreement
void CreateBlockAckAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address originator, uint16_t startingSeq)
Definition: ht-frame-exchange-manager.cc:286
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::HtFrameExchangeManager::ForwardPsduDown
virtual void ForwardPsduDown(Ptr< const WifiPsdu > psdu, WifiTxVector &txVector)
Forward a PSDU down to the PHY layer.
Definition: ht-frame-exchange-manager.cc:922
ns3::QosFrameExchangeManager::StartTransmission
bool StartTransmission(Ptr< Txop > edca) override
Request the FrameExchangeManager to start a frame exchange sequence.
Definition: qos-frame-exchange-manager.cc:151
ns3::HtFrameExchangeManager::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: ht-frame-exchange-manager.cc:43
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::HtFrameExchangeManager::SendDataFrame
virtual bool SendDataFrame(Ptr< const WifiMacQueueItem > peekedItem, Time availableTime, bool initialFrame)
Given a non-broadcast QoS data frame, prepare the PSDU to transmit by attempting A-MSDU and A-MPDU ag...
Definition: ht-frame-exchange-manager.cc:439
ns3::FrameExchangeManager::CtsTimeout
virtual void CtsTimeout(Ptr< WifiMacQueueItem > rts, const WifiTxVector &txVector)
Called when the CTS timeout expires.
Definition: frame-exchange-manager.cc:801
ns3::CtrlBAckRequestHeader::IsMultiTid
bool IsMultiTid(void) const
Check if the current Ack Policy has Multi-TID Block Ack.
Definition: ctrl-headers.cc:263
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::WifiMacHeader::SetQosQueueSize
void SetQosQueueSize(uint8_t size)
Set the Queue Size subfield in the QoS control field.
Definition: wifi-mac-header.cc:402
ns3::WifiMacHeader::SetAddr3
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Definition: wifi-mac-header.cc:120
ns3::OriginatorBlockAckAgreement::PENDING
@ PENDING
Definition: originator-block-ack-agreement.h:103
ns3::FrameExchangeManager::m_self
Mac48Address m_self
the MAC address of this device
Definition: frame-exchange-manager.h:386
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::QosTxop::GetQosQueueSize
uint8_t GetQosQueueSize(uint8_t tid, Mac48Address receiver) const
Get the value for the Queue Size subfield of the QoS Control field of a QoS data frame of the given T...
Definition: qos-txop.cc:133
ns3::WifiTxParameters
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
Definition: wifi-tx-parameters.h:45
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:72
ns3::WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST
@ BLOCK_ACK_ADDBA_REQUEST
Definition: mgt-headers.h:946
ns3::CtrlBAckResponseHeader::SetTidInfo
void SetTidInfo(uint8_t tid, std::size_t index=0)
For Block Ack variants other than Multi-STA Block Ack, set the TID_INFO subfield of the BA Control fi...
Definition: ctrl-headers.cc:477
ns3::QosTxop::AddBaResponseTimeout
void AddBaResponseTimeout(Mac48Address recipient, uint8_t tid)
Callback when ADDBA response is not received after timeout.
Definition: qos-txop.cc:675
ns3::MgtDelBaHeader::SetByRecipient
void SetByRecipient(void)
Un-set the initiator bit in the DELBA.
Definition: mgt-headers.cc:1886
ns3::Txop::GetTxopLimit
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: txop.cc:280
ns3::HtFrameExchangeManager::RetransmitMpduAfterMissedAck
void RetransmitMpduAfterMissedAck(Ptr< WifiMacQueueItem > mpdu) const override
Retransmit an MPDU that was not acknowledged.
Definition: ht-frame-exchange-manager.cc:632
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:415
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::WifiBarBlockAck::barType
BlockAckReqType barType
BlockAckReq type.
Definition: wifi-acknowledgment.h:189
ns3::QosTxop::GetBlockAckInactivityTimeout
uint16_t GetBlockAckInactivityTimeout(void) const
Get the BlockAck inactivity timeout.
Definition: qos-txop.cc:661
ns3::MgtAddBaRequestHeader::SetDelayedBlockAck
void SetDelayedBlockAck()
Enable delayed BlockAck.
Definition: mgt-headers.cc:1527
ns3::WifiTxParameters::m_protection
std::unique_ptr< WifiProtection > m_protection
protection method
Definition: wifi-tx-parameters.h:63
ns3::GetTid
uint8_t GetTid(Ptr< const Packet > packet, const WifiMacHeader hdr)
This function is useful to get traffic id of different packet types.
Definition: qos-utils.cc:187
ns3::BlockAckAgreement::SetImmediateBlockAck
void SetImmediateBlockAck(void)
Set block ack policy to immediate Ack.
Definition: block-ack-agreement.cc:79
ns3::QosTxop::GetBaStartingSequence
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
Definition: qos-txop.cc:261
ns3::MgtAddBaResponseHeader::SetTid
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Definition: mgt-headers.cc:1719
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::QosFrameExchangeManager::DoDispose
void DoDispose() override
Destructor implementation.
Definition: qos-frame-exchange-manager.cc:72
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
ns3::HtFrameExchangeManager::DestroyBlockAckAgreement
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Destroy a Block Ack agreement.
Definition: ht-frame-exchange-manager.cc:320
ns3::BlockAckAgreement::GetTimeout
uint16_t GetTimeout(void) const
Return the timeout.
Definition: block-ack-agreement.cc:119
ns3::HtFrameExchangeManager::GetBaManager
Ptr< BlockAckManager > GetBaManager(uint8_t tid) const
Get the Block Ack Manager handling the given TID.
Definition: ht-frame-exchange-manager.cc:98
ns3::FrameExchangeManager::GetProtectionManager
Ptr< WifiProtectionManager > GetProtectionManager(void) const
Get the Protection Manager used by this node.
Definition: frame-exchange-manager.cc:111
ns3::MgtAddBaRequestHeader::IsAmsduSupported
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Definition: mgt-headers.cc:1600
ns3::MgtAddBaResponseHeader::SetTimeout
void SetTimeout(uint16_t timeout)
Set timeout.
Definition: mgt-headers.cc:1726
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::HtFrameExchangeManager
HtFrameExchangeManager handles the frame exchange sequences for HT stations.
Definition: ht-frame-exchange-manager.h:45
ns3::GetBlockAckRequestSize
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
Definition: wifi-utils.cc:73
ns3::WifiBarBlockAck
WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
Definition: wifi-acknowledgment.h:180
ns3::FrameExchangeManager::SendRts
void SendRts(const WifiTxParameters &txParams)
Send RTS to begin RTS-CTS-Data-Ack transaction.
Definition: frame-exchange-manager.cc:561
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WifiActionHeader
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:885
ns3::WifiActionHeader::GetAction
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:1247
ns3::HtFrameExchangeManager::m_msduAggregator
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
Definition: ht-frame-exchange-manager.h:380
ns3::MgtAddBaResponseHeader::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:1756
ns3::QosFrameExchangeManager
QosFrameExchangeManager handles the frame exchange sequences for QoS stations.
Definition: qos-frame-exchange-manager.h:37
ns3::WifiMacHeader::IsBlockAckReq
bool IsBlockAckReq(void) const
Return true if the header is a BlockAckRequest header.
Definition: wifi-mac-header.cc:741
ns3::WifiTxVector::GetModulationClass
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
Definition: wifi-tx-vector.cc:128
ns3::MgtAddBaResponseHeader::SetStatusCode
void SetStatusCode(StatusCode code)
Set the status code.
Definition: mgt-headers.cc:1738
ns3::QosFrameExchangeManager::m_edca
Ptr< QosTxop > m_edca
the EDCAF that gained channel access
Definition: qos-frame-exchange-manager.h:159
ns3::WifiTxParameters::GetSizeIfAddMpdu
uint32_t GetSizeIfAddMpdu(Ptr< const WifiMacQueueItem > mpdu) const
Get the size in bytes of the frame in case the given MPDU is added.
Definition: wifi-tx-parameters.cc:147
ns3::QosTxop::ResetBa
void ResetBa(Mac48Address recipient, uint8_t tid)
Reset BA agreement after BA negotiation failed.
Definition: qos-txop.cc:692
ns3::HtFrameExchangeManager::TryAggregateMsdu
virtual bool TryAggregateMsdu(Ptr< const WifiMacQueueItem > msdu, WifiTxParameters &txParams, Time availableTime) const
Check if aggregating an MSDU to the current MPDU (as specified by the given TX parameters) does not v...
Definition: ht-frame-exchange-manager.cc:1004
max
#define max(a, b)
Definition: 80211b.c:43
ns3::MgtAddBaRequestHeader::GetStartingSequence
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
Definition: mgt-headers.cc:1606
ns3::FrameExchangeManager::SetWifiMac
virtual void SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the MAC layer to use.
Definition: frame-exchange-manager.cc:130
ns3::Time::IsZero
bool IsZero(void) const
Exactly equivalent to t == 0.
Definition: nstime.h:301
ns3::HtFrameExchangeManager::m_mpduAggregator
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
Definition: ht-frame-exchange-manager.h:381
ns3::WifiProtection::NONE
@ NONE
Definition: wifi-protection.h:47
ns3::WifiMacHeader::QosAckPolicy
QosAckPolicy
Ack policy for QoS frames.
Definition: wifi-mac-header.h:91
ns3::FrameExchangeManager::m_rxMiddle
Ptr< MacRxMiddle > m_rxMiddle
the MAC RX Middle on this station
Definition: frame-exchange-manager.h:383
ns3::WifiTxParameters::PsduInfo::seqNumbers
std::map< uint8_t, std::set< uint16_t > > seqNumbers
set of the sequence numbers of the MPDUs added for each TID
Definition: wifi-tx-parameters.h:121
ns3::BlockAckAgreement::GetPeer
Mac48Address GetPeer(void) const
Return the peer address.
Definition: block-ack-agreement.cc:106
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::MgtDelBaHeader::SetTid
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Definition: mgt-headers.cc:1892
ns3::MgtAddBaResponseHeader::SetDelayedBlockAck
void SetDelayedBlockAck()
Enable delayed BlockAck.
Definition: mgt-headers.cc:1707
ns3::StatusCode::SetSuccess
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
ns3::WifiTxParameters::GetSizeIfAggregateMsdu
std::pair< uint32_t, uint32_t > GetSizeIfAggregateMsdu(Ptr< const WifiMacQueueItem > msdu) const
Get the size in bytes of the frame in case the given MSDU is aggregated.
Definition: wifi-tx-parameters.cc:187
ns3::HtFrameExchangeManager::ReceiveMpdu
void ReceiveMpdu(Ptr< WifiMacQueueItem > mpdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, bool inAmpdu) override
This method handles the reception of an MPDU (possibly included in an A-MPDU)
Definition: ht-frame-exchange-manager.cc:1293
ns3::BlockAckType
The different BlockAck variants.
Definition: block-ack-type.h:34
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
ns3::Txop::GetWifiMacQueue
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:154
ns3::MgtAddBaRequestHeader::SetTid
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Definition: mgt-headers.cc:1539
ns3::OriginatorBlockAckAgreement::ESTABLISHED
@ ESTABLISHED
Definition: originator-block-ack-agreement.h:104
ns3::HtFrameExchangeManager::NotifyPacketDiscarded
void NotifyPacketDiscarded(Ptr< const WifiMacQueueItem > mpdu) override
Pass the given MPDU, discarded because of the max retry limit was reached, to the MPDU dropped callba...
Definition: ht-frame-exchange-manager.cc:602
ns3::WifiMacHeader::HasData
bool HasData(void) const
Return true if the header type is DATA and is not DATA_NULL.
Definition: wifi-mac-header.cc:632
ns3::HtFrameExchangeManager::m_txParams
WifiTxParameters m_txParams
the TX parameters for the current frame
Definition: ht-frame-exchange-manager.h:391
ns3::WifiActionHeader::ActionValue::blockAck
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:960
ns3::WifiPsdu::GetSize
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
ns3::WifiMacHeader::IsBlockAck
bool IsBlockAck(void) const
Return true if the header is a BlockAck header.
Definition: wifi-mac-header.cc:747
ns3::MgtAddBaRequestHeader::IsImmediateBlockAck
bool IsImmediateBlockAck(void) const
Return whether the Block Ack policy is immediate Block Ack.
Definition: mgt-headers.cc:1582
ns3::WifiMacHeader::NORMAL_ACK
@ NORMAL_ACK
Definition: wifi-mac-header.h:92
ns3::HtFrameExchangeManager::IsWithinLimitsIfAddMpdu
bool IsWithinLimitsIfAddMpdu(Ptr< const WifiMacQueueItem > mpdu, const WifiTxParameters &txParams, Time ppduDurationLimit) const override
Check if the PSDU obtained by aggregating the given MPDU to the PSDU specified by the given TX parame...
Definition: ht-frame-exchange-manager.cc:938
ns3::WifiTxParameters::Clear
void Clear(void)
Reset the TX parameters.
Definition: wifi-tx-parameters.cc:67
ns3::Copy
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
Definition: ptr.h:555
ns3::MgtAddBaRequestHeader::SetStartingSequence
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
Definition: mgt-headers.cc:1558
ns3::RecipientBlockAckAgreement
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreeme...
Definition: recipient-block-ack-agreement.h:40
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::MgtAddBaResponseHeader::GetTimeout
uint16_t GetTimeout(void) const
Return the timeout.
Definition: mgt-headers.cc:1768
ns3::WifiPhy::GetPhyBand
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1125
ns3::MgtAddBaResponseHeader::IsAmsduSupported
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Definition: mgt-headers.cc:1780
ns3::WifiPsdu::GetTids
std::set< uint8_t > GetTids(void) const
Get the set of TIDs of the QoS Data frames included in the PSDU.
Definition: wifi-psdu.cc:166
ns3::MgtAddBaRequestHeader::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:1576
ns3::HtFrameExchangeManager::~HtFrameExchangeManager
virtual ~HtFrameExchangeManager()
Definition: ht-frame-exchange-manager.cc:60
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WifiMacHeader::GetSequenceNumber
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Definition: wifi-mac-header.cc:777
ns3::WifiTxTimer::WAIT_BLOCK_ACK
@ WAIT_BLOCK_ACK
Definition: wifi-tx-timer.h:59
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::WifiPsdu::SetDuration
void SetDuration(Time duration)
Set the Duration/ID field on all the MPDUs.
Definition: wifi-psdu.cc:156
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::MgtAddBaRequestHeader::SetTimeout
void SetTimeout(uint16_t timeout)
Set timeout.
Definition: mgt-headers.cc:1546
ns3::SnrTag::Set
void Set(double snr)
Set the SNR to the given value.
Definition: snr-tag.cc:83
ns3::HtFrameExchangeManager::CalculateAcknowledgmentTime
void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const override
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Definition: ht-frame-exchange-manager.cc:484
ns3::MgtAddBaRequestHeader::GetTimeout
uint16_t GetTimeout(void) const
Return the timeout.
Definition: mgt-headers.cc:1588
ns3::WifiMacHeader::GetQosAckPolicy
QosAckPolicy GetQosAckPolicy(void) const
Return the QoS Ack policy in the QoS control field.
Definition: wifi-mac-header.cc:829
ns3::FrameExchangeManager::GetAckManager
Ptr< WifiAckManager > GetAckManager(void) const
Get the Acknowledgment Manager used by this node.
Definition: frame-exchange-manager.cc:124
ns3::StatusCode
Status code for association response.
Definition: status-code.h:32
ns3::QosTxop::GetAddBaResponseTimeout
Time GetAddBaResponseTimeout(void) const
Get the timeout for ADDBA response.
Definition: qos-txop.cc:714
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:447
ns3::MgtAddBaResponseHeader
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1150
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::QosTxop::PrepareBlockAckRequest
Ptr< const WifiMacQueueItem > PrepareBlockAckRequest(Mac48Address recipient, uint8_t tid) const
Definition: qos-txop.cc:267
ns3::HtFrameExchangeManager::GetSupportedBaBufferSize
virtual uint16_t GetSupportedBaBufferSize(void) const
Get the maximum supported buffer size for a Block Ack agreement.
Definition: ht-frame-exchange-manager.cc:243
ns3::WifiBarBlockAck::blockAckReqTxVector
WifiTxVector blockAckReqTxVector
BlockAckReq TXVECTOR.
Definition: wifi-acknowledgment.h:187
NS_ABORT_IF
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
ns3::HtFrameExchangeManager::IsWithinAmpduSizeLimit
virtual bool IsWithinAmpduSizeLimit(uint32_t ampduSize, Mac48Address receiver, uint8_t tid, WifiModulationClass modulation) const
Check whether an A-MPDU of the given size meets the constraint on the maximum size for A-MPDUs sent t...
Definition: ht-frame-exchange-manager.cc:981
ns3::MgtAddBaRequestHeader::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:1570
ns3::HtFrameExchangeManager::GetMpduAggregator
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
Definition: ht-frame-exchange-manager.cc:92
ns3::WIFI_MAC_MGT_ACTION
@ WIFI_MAC_MGT_ACTION
Definition: wifi-mac-header.h:58
ns3::CtrlBAckResponseHeader::SetType
void SetType(BlockAckType type)
Set the block ack type.
Definition: ctrl-headers.cc:456
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::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition: wifi-mac-header.cc:114
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition: wifi-mac-header.cc:862
ns3::RecipientBlockAckAgreement::FillBlockAckBitmap
void FillBlockAckBitmap(CtrlBAckResponseHeader *blockAckHeader, std::size_t index=0) const
Set the Starting Sequence Number subfield of the Block Ack Starting Sequence Control subfield of the ...
Definition: recipient-block-ack-agreement.cc:224
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log-macros-enabled.h:209
ht-frame-exchange-manager.h
ns3::STA
@ STA
Definition: wifi-mac.h:42
ns3::MgtDelBaHeader
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1271
ns3::HtFrameExchangeManager::TransmissionSucceeded
void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
Definition: ht-frame-exchange-manager.cc:579
ns3::Time::Min
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
Definition: nstime.h:274
ns3::CtrlBAckResponseHeader::GetTidInfo
uint8_t GetTidInfo(std::size_t index=0) const
For Block Ack variants other than Multi-STA Block Ack, get the TID_INFO subfield of the BA Control fi...
Definition: ctrl-headers.cc:510
ns3::WifiPsdu::IsAggregate
bool IsAggregate(void) const
Return true if the PSDU is an S-MPDU or A-MPDU.
Definition: wifi-psdu.cc:81
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:514
ns3::WifiPsdu::GetAddr2
Mac48Address GetAddr2(void) const
Get the Transmitter Address (TA), which is common to all the MPDUs.
Definition: wifi-psdu.cc:126
ns3::HtFrameExchangeManager::m_agreements
std::map< AgreementKey, RecipientBlockAckAgreement > m_agreements
agreements
Definition: ht-frame-exchange-manager.h:379
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
ns3::WifiBlockAck::blockAckTxVector
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
Definition: wifi-acknowledgment.h:169
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::WifiActionHeader::GetCategory
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:1226
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::WifiActionHeader::SetAction
void SetAction(CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:1192
ns3::BlockAckAgreement::SetDelayedBlockAck
void SetDelayedBlockAck(void)
Set block ack policy to delayed Ack.
Definition: block-ack-agreement.cc:86
ns3::FrameExchangeManager::NotifyReceivedNormalAck
virtual void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu)
Notify other components that an MPDU was acknowledged.
Definition: frame-exchange-manager.cc:1162
ns3::BlockAckAgreement::m_inactivityEvent
EventId m_inactivityEvent
inactivity event
Definition: block-ack-agreement.h:186
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:342
ns3::HtFrameExchangeManager::NotifyTxToEdca
virtual void NotifyTxToEdca(Ptr< const WifiPsdu > psdu) const
Notify the transmission of the given PSDU to the EDCAF associated with the AC the PSDU belongs to.
Definition: ht-frame-exchange-manager.cc:873
ns3::FrameExchangeManager::m_mac
Ptr< RegularWifiMac > m_mac
the MAC layer on this station
Definition: frame-exchange-manager.h:381
ns3::HtFrameExchangeManager::ForwardMpduDown
void ForwardMpduDown(Ptr< WifiMacQueueItem > mpdu, WifiTxVector &txVector) override
Forward an MPDU down to the PHY layer.
Definition: ht-frame-exchange-manager.cc:515
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::HtFrameExchangeManager::m_psdu
Ptr< WifiPsdu > m_psdu
the A-MPDU being transmitted
Definition: ht-frame-exchange-manager.h:390
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::WifiMacHeader::GetDuration
Time GetDuration(void) const
Return the duration from the Duration/ID field (Time object).
Definition: wifi-mac-header.cc:765
ns3::QosTxop::ScheduleBar
void ScheduleBar(Ptr< const WifiMacQueueItem > bar, bool skipIfNoDataQueued=false)
Definition: qos-txop.cc:289
ns3::WifiTxParameters::PsduInfo
information about the frame being prepared for a specific receiver
Definition: wifi-tx-parameters.h:115
ns3::QosTxop::GetNextMpdu
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:437
ns3::WifiMacHeader::SetQosEosp
void SetQosEosp()
Set the end of service period (EOSP) bit in the QoS control field.
Definition: wifi-mac-header.cc:357
ns3::WifiTxTimer::GetReason
Reason GetReason(void) const
Get the reason why the timer was started.
Definition: wifi-tx-timer.cc:87
ns3::WifiMacHeader::IsCtl
bool IsCtl(void) const
Return true if the Type is Control.
Definition: wifi-mac-header.cc:571
ns3::WifiTxParameters::AggregateMsdu
void AggregateMsdu(Ptr< const WifiMacQueueItem > msdu)
Record that an MSDU is being aggregated to the last MPDU added to the frame that hase the same receiv...
Definition: wifi-tx-parameters.cc:174
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::BlockAckAgreement::GetBlockAckType
BlockAckType GetBlockAckType(void) const
Get the type of the Block Acks sent by the recipient of this agreement.
Definition: block-ack-agreement.cc:169
ns3::WifiAcknowledgment::BAR_BLOCK_ACK
@ BAR_BLOCK_ACK
Definition: wifi-acknowledgment.h:55
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:827
ns3::BlockAckAgreement::GetDistance
static std::size_t GetDistance(uint16_t seqNumber, uint16_t startingSeqNumber)
Get the distance between the given starting sequence number and the given sequence number.
Definition: block-ack-agreement.cc:195
ns3::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMacQueueItem > item=nullptr)
Peek the next frame to transmit to the given receiver and of the given TID from the EDCA queue.
Definition: qos-txop.cc:357
ns3::TracedValueCallback::Time
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:813
ns3::WifiMacHeader::SetDsNotTo
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:102
ns3::HtFrameExchangeManager::GetMsduAggregator
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
Definition: ht-frame-exchange-manager.cc:86
ns3::WifiActionHeader::BLOCK_ACK_DELBA
@ BLOCK_ACK_DELBA
Definition: mgt-headers.h:948
ns3::HtFrameExchangeManager::HtFrameExchangeManager
HtFrameExchangeManager()
Definition: ht-frame-exchange-manager.cc:53
ns3::HtFrameExchangeManager::DequeuePsdu
void DequeuePsdu(Ptr< const WifiPsdu > psdu)
Dequeue the MPDUs of the given PSDU from the queue in which they are stored.
Definition: ht-frame-exchange-manager.cc:911
ns3::WifiProtection::RTS_CTS
@ RTS_CTS
Definition: wifi-protection.h:48
ns3::WIFI_MAC_CTL_BACKRESP
@ WIFI_MAC_CTL_BACKRESP
Definition: wifi-mac-header.h:44
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::CtrlBAckRequestHeader::GetStartingSequence
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
Definition: ctrl-headers.cc:239
ns3::HtFrameExchangeManager::GetWifiPsdu
virtual Ptr< WifiPsdu > GetWifiPsdu(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector) const
Get a PSDU containing the given MPDU.
Definition: ht-frame-exchange-manager.cc:521
ns3::WifiAcknowledgment::method
const Method method
acknowledgment method
Definition: wifi-acknowledgment.h:103
ns3::HtFrameExchangeManager::SendPsdu
void SendPsdu(void)
Send the current PSDU, which can be acknowledged by a BlockAck frame or followed by a BlockAckReq fra...
Definition: ht-frame-exchange-manager.cc:796
ns3::WifiBarBlockAck::baType
BlockAckType baType
BlockAck type.
Definition: wifi-acknowledgment.h:190
ns3::OriginatorBlockAckAgreement::RESET
@ RESET
Definition: originator-block-ack-agreement.h:106
ns3::WifiBlockAck::baType
BlockAckType baType
BlockAck type.
Definition: wifi-acknowledgment.h:170
ns3::WifiAcknowledgment::BLOCK_ACK
@ BLOCK_ACK
Definition: wifi-acknowledgment.h:54
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition: wifi-mac-header.cc:430
ns3::QosTxop::CompleteMpduTx
void CompleteMpduTx(Ptr< WifiMacQueueItem > mpdu)
Stores an MPDU (part of an A-MPDU) in block ack agreement (i.e.
Definition: qos-txop.cc:628
ns3::HtFrameExchangeManager::EndReceiveAmpdu
void EndReceiveAmpdu(Ptr< const WifiPsdu > psdu, const RxSignalInfo &rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &perMpduStatus) override
This method is called when the reception of an A-MPDU including multiple MPDUs is completed.
Definition: ht-frame-exchange-manager.cc:1418
ns3::WifiPhy::GetSifs
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:911
ns3::WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE
@ BLOCK_ACK_ADDBA_RESPONSE
Definition: mgt-headers.h:947
ns3::HtFrameExchangeManager::SendAddBaResponse
void SendAddBaResponse(const MgtAddBaRequestHeader *reqHdr, Mac48Address originator)
This method can be called to accept a received ADDBA Request.
Definition: ht-frame-exchange-manager.cc:193
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:246
ns3::WifiBarBlockAck::blockAckTxVector
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
Definition: wifi-acknowledgment.h:188
ns3::WifiTxTimer::Cancel
void Cancel(void)
Cancel the timer.
Definition: wifi-tx-timer.cc:127
ns3::HtFrameExchangeManager::NotifyReceivedNormalAck
void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu) override
Notify other components that an MPDU was acknowledged.
Definition: ht-frame-exchange-manager.cc:527
ns3::HtFrameExchangeManager::GetPsduDurationId
virtual Time GetPsduDurationId(Time txDuration, const WifiTxParameters &txParams) const
Compute how to set the Duration/ID field of PSDUs that do not include fragments.
Definition: ht-frame-exchange-manager.cc:685
ns3::MgtAddBaResponseHeader::SetBufferSize
void SetBufferSize(uint16_t size)
Set buffer size.
Definition: mgt-headers.cc:1732
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:1790
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::CtrlBAckRequestHeader::GetTidInfo
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
Definition: ctrl-headers.cc:232
ns3::QosTxop::GetFailedAddBaTimeout
Time GetFailedAddBaTimeout(void) const
Get the timeout for failed BA agreement.
Definition: qos-txop.cc:727
ns3::WifiModulationClass
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Definition: wifi-phy-common.h:122
ns3::WifiMacHeader::IsAction
bool IsAction(void) const
Return true if the header is an Action header.
Definition: wifi-mac-header.cc:729
ns3::WifiActionHeader::BLOCK_ACK
@ BLOCK_ACK
Definition: mgt-headers.h:898
ns3::CtrlBAckResponseHeader
Headers for BlockAck response.
Definition: ctrl-headers.h:202
ns3::MgtDelBaHeader::IsByOriginator
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is set.
Definition: mgt-headers.cc:1866
ns3::HtFrameExchangeManager::BlockAckTimeout
virtual void BlockAckTimeout(Ptr< WifiPsdu > psdu, const WifiTxVector &txVector)
Called when the BlockAck timeout expires.
Definition: ht-frame-exchange-manager.cc:1124
ns3::HtFrameExchangeManager::SendDelbaFrame
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
Sends DELBA frame to cancel a block ack agreement with STA addressed by addr for TID tid.
Definition: ht-frame-exchange-manager.cc:249
ns3::HtFrameExchangeManager::GetBaAgreementEstablished
bool GetBaAgreementEstablished(Mac48Address originator, uint8_t tid) const
Return true if a Block Ack agreement has been established with the given originator for the given TID...
Definition: ht-frame-exchange-manager.cc:1279
ns3::MgtAddBaResponseHeader::SetImmediateBlockAck
void SetImmediateBlockAck()
Enable immediate BlockAck.
Definition: mgt-headers.cc:1713
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
ns3::QosTxop::GetRemainingTxop
virtual Time GetRemainingTxop(void) const
Return the remaining duration in the current TXOP.
Definition: qos-txop.cc:559
ns3::MgtAddBaResponseHeader::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:1744