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 (Create<WifiPsdu> (mpdu, false), 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 ());
451  Ptr<WifiMacQueueItem> mpdu = edca->GetNextMpdu (peekedItem, txParams, availableTime, initialFrame, queueIt);
452 
453  if (mpdu == nullptr)
454  {
455  NS_LOG_DEBUG ("Not enough time to transmit a frame");
456  return false;
457  }
458 
459  // try A-MPDU aggregation
460  std::vector<Ptr<WifiMacQueueItem>> mpduList = m_mpduAggregator->GetNextAmpdu (mpdu, txParams,
461  availableTime, queueIt);
462  NS_ASSERT (txParams.m_acknowledgment);
463 
464  if (mpduList.size () > 1)
465  {
466  // A-MPDU aggregation succeeded
467  SendPsduWithProtection (Create<WifiPsdu> (std::move (mpduList)), txParams);
468  }
469  else if (txParams.m_acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK)
470  {
471  // a QoS data frame using the Block Ack policy can be followed by a BlockAckReq
472  // frame and a BlockAck frame. Such a sequence is handled by the HT FEM
473  SendPsduWithProtection (Create<WifiPsdu> (mpdu, false), txParams);
474  }
475  else
476  {
477  // transmission can be handled by the base FEM
478  SendMpduWithProtection (mpdu, txParams);
479  }
480 
481  return true;
482 }
483 
484 void
486 {
487  NS_LOG_FUNCTION (this << acknowledgment);
488  NS_ASSERT (acknowledgment != nullptr);
489 
490  if (acknowledgment->method == WifiAcknowledgment::BLOCK_ACK)
491  {
492  WifiBlockAck* blockAcknowledgment = static_cast<WifiBlockAck*> (acknowledgment);
493  Time baTxDuration = m_phy->CalculateTxDuration (GetBlockAckSize (blockAcknowledgment->baType),
494  blockAcknowledgment->blockAckTxVector,
495  m_phy->GetPhyBand ());
496  blockAcknowledgment->acknowledgmentTime = m_phy->GetSifs () + baTxDuration;
497  }
498  else if (acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK)
499  {
500  WifiBarBlockAck* barBlockAcknowledgment = static_cast<WifiBarBlockAck*> (acknowledgment);
501  Time barTxDuration = m_phy->CalculateTxDuration (GetBlockAckRequestSize (barBlockAcknowledgment->barType),
502  barBlockAcknowledgment->blockAckReqTxVector,
503  m_phy->GetPhyBand ());
504  Time baTxDuration = m_phy->CalculateTxDuration (GetBlockAckSize (barBlockAcknowledgment->baType),
505  barBlockAcknowledgment->blockAckTxVector,
506  m_phy->GetPhyBand ());
507  barBlockAcknowledgment->acknowledgmentTime = 2 * m_phy->GetSifs () + barTxDuration + baTxDuration;
508  }
509  else
510  {
512  }
513 }
514 
515 void
517 {
518  ForwardPsduDown (GetWifiPsdu (mpdu, txVector), txVector);
519 }
520 
523 {
524  return Create<WifiPsdu> (mpdu, false);
525 }
526 
527 void
529 {
530  NS_LOG_FUNCTION (this << *mpdu);
531 
532  if (mpdu->GetHeader ().IsQosData ())
533  {
534  uint8_t tid = mpdu->GetHeader ().GetQosTid ();
535  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
536 
537  if (edca->GetBaAgreementEstablished (mpdu->GetHeader ().GetAddr1 (), tid))
538  {
539  // notify the BA manager that the MPDU was acknowledged
540  edca->GetBaManager ()->NotifyGotAck (mpdu);
541  }
542  }
543  else if (mpdu->GetHeader ().IsAction ())
544  {
545  WifiActionHeader actionHdr;
546  Ptr<Packet> p = mpdu->GetPacket ()->Copy ();
547  p->RemoveHeader (actionHdr);
548  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK)
549  {
551  {
552  MgtDelBaHeader delBa;
553  p->PeekHeader (delBa);
554  if (delBa.IsByOriginator ())
555  {
556  GetBaManager (delBa.GetTid ())->DestroyAgreement (mpdu->GetHeader ().GetAddr1 (),
557  delBa.GetTid ());
558  }
559  else
560  {
561  DestroyBlockAckAgreement (mpdu->GetHeader ().GetAddr1 (), delBa.GetTid ());
562  }
563  }
565  {
566  // Setup ADDBA response timeout
567  MgtAddBaRequestHeader addBa;
568  p->PeekHeader (addBa);
569  Ptr<QosTxop> edca = m_mac->GetQosTxop (addBa.GetTid ());
572  mpdu->GetHeader ().GetAddr1 (), addBa.GetTid ());
573  }
574  }
575  }
577 }
578 
579 void
581 {
582  NS_LOG_DEBUG (this);
583 
584  if (m_edca != 0 && m_edca->GetTxopLimit ().IsZero () && m_edca->GetBaManager ()->GetBar (false) != 0)
585  {
586  // A TXOP limit of 0 indicates that the TXOP holder may transmit or cause to
587  // be transmitted (as responses) the following within the current TXOP:
588  // f) Any number of BlockAckReq frames
589  // (Sec. 10.22.2.8 of 802.11-2016)
590  NS_LOG_DEBUG ("Schedule a transmission from Block Ack Manager in a SIFS");
592 
593  // TXOP limit is null, hence the txopDuration parameter is unused
594  Simulator::Schedule (m_phy->GetSifs (), fp, this, m_edca, Seconds (0));
595  }
596  else
597  {
599  }
600 }
601 
602 void
604 {
605  NS_LOG_FUNCTION (this << *mpdu);
606 
607  if (mpdu->GetHeader ().IsQosData ())
608  {
609  GetBaManager (mpdu->GetHeader ().GetQosTid ())->NotifyDiscardedMpdu (mpdu);
610  }
611  else if (mpdu->GetHeader ().IsAction ())
612  {
613  WifiActionHeader actionHdr;
614  mpdu->GetPacket ()->PeekHeader (actionHdr);
615  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK)
616  {
617  uint8_t tid = GetTid (mpdu->GetPacket (), mpdu->GetHeader ());
618  if (GetBaManager (tid)->ExistsAgreementInState (mpdu->GetHeader ().GetAddr1 (), tid,
620  {
621  NS_LOG_DEBUG ("No ACK after ADDBA request");
622  GetBaManager (tid)->NotifyAgreementNoReply (mpdu->GetHeader ().GetAddr1 (), tid);
623  Ptr<QosTxop> qosTxop = m_mac->GetQosTxop (tid);
625  mpdu->GetHeader ().GetAddr1 (), tid);
626  }
627  }
628  }
630 }
631 
632 void
634 {
635  NS_LOG_FUNCTION (this << *mpdu);
636 
637  if (mpdu->GetHeader ().IsQosData ())
638  {
639  uint8_t tid = mpdu->GetHeader ().GetQosTid ();
640  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
641 
642  if (edca->GetBaAgreementEstablished (mpdu->GetHeader ().GetAddr1 (), tid))
643  {
644  // notify the BA manager that the MPDU was not acknowledged
645  edca->GetBaManager ()->NotifyMissedAck (mpdu);
646  return;
647  }
648  }
650 }
651 
652 void
654 {
655  NS_LOG_FUNCTION (this << *mpdu);
656 
657  // the MPDU should be still in the queue, unless it expired.
658  const WifiMacHeader& hdr = mpdu->GetHeader ();
659  if (hdr.IsQosData ())
660  {
661  uint8_t tid = hdr.GetQosTid ();
662  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
663 
664  if (edca->GetBaAgreementEstablished (hdr.GetAddr1 (), tid)
665  && !hdr.IsRetry ())
666  {
667  // The MPDU has never been transmitted, so we can make its sequence
668  // number available again if it is lower than the sequence number
669  // maintained by the MAC TX middle
670  uint16_t currentNextSeq = m_txMiddle->PeekNextSequenceNumberFor (&hdr);
671  uint16_t startingSeq = edca->GetBaStartingSequence (hdr.GetAddr1 (), tid);
672 
673  if (BlockAckAgreement::GetDistance (hdr.GetSequenceNumber (), startingSeq)
674  < BlockAckAgreement::GetDistance (currentNextSeq, startingSeq))
675  {
676  m_txMiddle->SetSequenceNumberFor (&hdr);
677  }
678 
679  return;
680  }
681  }
683 }
684 
685 Time
687 {
688  NS_LOG_FUNCTION (this << txDuration << &txParams);
689 
690  NS_ASSERT (m_edca != 0);
691 
692  if (m_edca->GetTxopLimit ().IsZero ())
693  {
694  NS_ASSERT (txParams.m_acknowledgment && txParams.m_acknowledgment->acknowledgmentTime != Time::Min ());
695  return txParams.m_acknowledgment->acknowledgmentTime;
696  }
697 
698  // under multiple protection settings, if the TXOP limit is not null, Duration/ID
699  // is set to cover the remaining TXOP time (Sec. 9.2.5.2 of 802.11-2016).
700  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
701  // of 802.11-2016)
702  return std::max (m_edca->GetRemainingTxop () - txDuration, Seconds (0));
703 }
704 
705 void
707 {
708  NS_LOG_FUNCTION (this << psdu << &txParams);
709 
710  m_psdu = psdu;
711  m_txParams = std::move (txParams);
712 
713 #ifdef NS3_BUILD_PROFILE_DEBUG
714  // If protection is required, the MPDUs must be stored in some queue because
715  // they are not put back in a queue if the RTS/CTS exchange fails
717  {
718  for (const auto& mpdu : *PeekPointer (m_psdu))
719  {
720  NS_ASSERT (mpdu->GetHeader ().IsCtl () || mpdu->IsQueued ());
721  }
722  }
723 #endif
724 
725  // Make sure that the acknowledgment time has been computed, so that SendRts()
726  // and SendCtsToSelf() can reuse this value.
728 
729  if (m_txParams.m_acknowledgment->acknowledgmentTime == Time::Min ())
730  {
732  }
733 
734  // Set QoS Ack policy
736 
738  {
740  }
742  {
744  }
745  else if (m_txParams.m_protection->method == WifiProtection::NONE)
746  {
747  SendPsdu ();
748  }
749  else
750  {
751  NS_ABORT_MSG ("Unknown protection type");
752  }
753 }
754 
755 void
757 {
758  NS_LOG_FUNCTION (this << *rts << txVector);
759 
760  if (m_psdu == 0)
761  {
762  // A CTS Timeout occurred when protecting a single MPDU is handled by the
763  // parent classes
764  QosFrameExchangeManager::CtsTimeout (rts, txVector);
765  return;
766  }
767 
768  NS_ASSERT (m_psdu->GetNMpdus () > 1);
769  m_mac->GetWifiRemoteStationManager ()->ReportRtsFailed (m_psdu->GetHeader (0));
770 
771  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*m_psdu->begin ()))
772  {
773  NS_LOG_DEBUG ("Missed CTS, discard MPDUs");
774  m_mac->GetWifiRemoteStationManager ()->ReportFinalRtsFailed (m_psdu->GetHeader (0));
775  // Dequeue the MPDUs if they are stored in a queue
777  for (const auto& mpdu : *PeekPointer (m_psdu))
778  {
779  NotifyPacketDiscarded (mpdu);
780  }
781  m_edca->ResetCw ();
782  }
783  else
784  {
785  NS_LOG_DEBUG ("Missed CTS, retransmit MPDUs");
786  for (const auto& mpdu : *PeekPointer (m_psdu))
787  {
789  }
791  }
792  m_psdu = 0;
794 }
795 
796 void
798 {
799  NS_LOG_FUNCTION (this);
800 
802 
804 
806  {
808 
809  std::set<uint8_t> tids = m_psdu->GetTids ();
810  NS_ASSERT_MSG (tids.size () <= 1, "Multi-TID A-MPDUs are not supported");
811 
812  if (tids.size () == 0 || m_psdu->GetAckPolicyForTid (*tids.begin ()) == WifiMacHeader::NO_ACK)
813  {
814  // No acknowledgment, hence dequeue the PSDU if it is stored in a queue
816  }
817  }
819  {
821 
822  // the timeout duration is "aSIFSTime + aSlotTime + aRxPHYStartDelay, starting
823  // at the PHY-TXEND.confirm primitive" (section 10.3.2.9 or 10.22.2.2 of 802.11-2016).
824  // aRxPHYStartDelay equals the time to transmit the PHY header.
825  WifiBlockAck* blockAcknowledgment = static_cast<WifiBlockAck*> (m_txParams.m_acknowledgment.get ());
826 
827  Time timeout = txDuration
828  + m_phy->GetSifs ()
829  + m_phy->GetSlot ()
833  this, m_psdu, m_txParams.m_txVector);
834  m_channelAccessManager->NotifyAckTimeoutStartNow (timeout);
835  }
837  {
839 
840  // schedule the transmission of a BAR in a SIFS
841  std::set<uint8_t> tids = m_psdu->GetTids ();
842  NS_ABORT_MSG_IF (tids.size () > 1, "Acknowledgment method incompatible with a Multi-TID A-MPDU");
843  uint8_t tid = *tids.begin ();
844 
845  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
846  edca->ScheduleBar (edca->PrepareBlockAckRequest (m_psdu->GetAddr1 (), tid));
847 
849  }
850  else
851  {
852  NS_ABORT_MSG ("Unable to handle the selected acknowledgment method ("
853  << m_txParams.m_acknowledgment.get () << ")");
854  }
855 
856  // transmit the PSDU
857  if (m_psdu->GetNMpdus () > 1)
858  {
860  }
861  else
862  {
864  }
865 
867  {
868  // we are done in case the A-MPDU does not require acknowledgment
869  m_psdu = 0;
870  }
871 }
872 
873 void
875 {
876  NS_LOG_FUNCTION (this << psdu);
877 
878  // use an array to avoid computing the queue size for every MPDU in the PSDU
879  std::array<std::optional<uint8_t>, 8> queueSizeForTid;
880 
881  for (const auto& mpdu : *PeekPointer (psdu))
882  {
883  WifiMacHeader& hdr = mpdu->GetHeader ();
884 
885  if (hdr.IsQosData ())
886  {
887  uint8_t tid = hdr.GetQosTid ();
888  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
889 
890  if (m_mac->GetTypeOfStation () == STA
891  && (m_setQosQueueSize || hdr.IsQosEosp ()))
892  {
893  // set the Queue Size subfield of the QoS Control field
894  if (!queueSizeForTid[tid].has_value ())
895  {
896  queueSizeForTid[tid] = edca->GetQosQueueSize (tid, hdr.GetAddr1 ());
897  }
898 
899  hdr.SetQosEosp ();
900  hdr.SetQosQueueSize (queueSizeForTid[tid].value ());
901  }
902 
903  if (hdr.HasData ())
904  {
905  edca->CompleteMpduTx (mpdu);
906  }
907  }
908  }
909 }
910 
911 void
913 {
914  NS_LOG_DEBUG (this << psdu);
915 
916  for (const auto& mpdu : *PeekPointer (psdu))
917  {
918  DequeueMpdu (mpdu);
919  }
920 }
921 
922 void
924 {
925  NS_LOG_FUNCTION (this << psdu << txVector);
926 
927  NS_LOG_DEBUG ("Transmitting a PSDU: " << *psdu << " TXVECTOR: " << txVector);
928  NotifyTxToEdca (psdu);
929 
930  if (psdu->IsAggregate ())
931  {
932  txVector.SetAggregation (true);
933  }
934 
935  m_phy->Send (psdu, txVector);
936 }
937 
938 bool
940  const WifiTxParameters& txParams,
941  Time ppduDurationLimit) const
942 {
943  NS_ASSERT (mpdu != 0);
944  NS_LOG_FUNCTION (this << *mpdu << &txParams << ppduDurationLimit);
945 
946  Mac48Address receiver = mpdu->GetHeader ().GetAddr1 ();
947  uint32_t ampduSize = txParams.GetSizeIfAddMpdu (mpdu);
948 
949  if (txParams.GetSize (receiver) > 0)
950  {
951  // we are attempting to perform A-MPDU aggregation, hence we have to check
952  // that we meet the limit on the max A-MPDU size
953  uint8_t tid;
954  const WifiTxParameters::PsduInfo* info;
955 
956  if (mpdu->GetHeader ().IsQosData ())
957  {
958  tid = mpdu->GetHeader ().GetQosTid ();
959  }
960  else if ((info = txParams.GetPsduInfo (receiver)) && !info->seqNumbers.empty ())
961  {
962  tid = info->seqNumbers.begin ()->first;
963  }
964  else
965  {
966  NS_ABORT_MSG ("Cannot aggregate a non-QoS data frame to an A-MPDU that does"
967  " not contain any QoS data frame");
968  }
969 
970  WifiModulationClass modulation = txParams.m_txVector.GetModulationClass ();
971 
972  if (!IsWithinAmpduSizeLimit (ampduSize, receiver, tid, modulation))
973  {
974  return false;
975  }
976  }
977 
978  return IsWithinSizeAndTimeLimits (ampduSize, receiver, txParams, ppduDurationLimit);
979 }
980 
981 bool
982 HtFrameExchangeManager::IsWithinAmpduSizeLimit (uint32_t ampduSize, Mac48Address receiver, uint8_t tid,
983  WifiModulationClass modulation) const
984 {
985  NS_LOG_FUNCTION (this << ampduSize << receiver << +tid << modulation);
986 
987  uint32_t maxAmpduSize = m_mpduAggregator->GetMaxAmpduSize (receiver, tid, modulation);
988 
989  if (maxAmpduSize == 0)
990  {
991  NS_LOG_DEBUG ("A-MPDU aggregation disabled");
992  return false;
993  }
994 
995  if (ampduSize > maxAmpduSize)
996  {
997  NS_LOG_DEBUG ("the frame does not meet the constraint on max A-MPDU size ("
998  << maxAmpduSize << ")");
999  return false;
1000  }
1001  return true;
1002 }
1003 
1004 bool
1006  Time availableTime) const
1007 {
1008  NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1009  NS_LOG_FUNCTION (this << *msdu << &txParams << availableTime);
1010 
1011  // check if aggregating the given MSDU requires a different protection method
1012  NS_ASSERT (txParams.m_protection);
1013  Time protectionTime = txParams.m_protection->protectionTime;
1014 
1015  std::unique_ptr<WifiProtection> protection;
1016  protection = GetProtectionManager ()->TryAggregateMsdu (msdu, txParams);
1017  bool protectionSwapped = false;
1018 
1019  if (protection)
1020  {
1021  // the protection method has changed, calculate the new protection time
1022  CalculateProtectionTime (protection.get ());
1023  protectionTime = protection->protectionTime;
1024  // swap unique pointers, so that the txParams that is passed to the next
1025  // call to IsWithinLimitsIfAggregateMsdu is the most updated one
1026  txParams.m_protection.swap (protection);
1027  protectionSwapped = true;
1028  }
1029  NS_ASSERT (protectionTime != Time::Min ());
1030 
1031  // check if aggregating the given MSDU requires a different acknowledgment method
1032  NS_ASSERT (txParams.m_acknowledgment);
1033  Time acknowledgmentTime = txParams.m_acknowledgment->acknowledgmentTime;
1034 
1035  std::unique_ptr<WifiAcknowledgment> acknowledgment;
1036  acknowledgment = GetAckManager ()->TryAggregateMsdu (msdu, txParams);
1037  bool acknowledgmentSwapped = false;
1038 
1039  if (acknowledgment)
1040  {
1041  // the acknowledgment method has changed, calculate the new acknowledgment time
1042  CalculateAcknowledgmentTime (acknowledgment.get ());
1043  acknowledgmentTime = acknowledgment->acknowledgmentTime;
1044  // swap unique pointers, so that the txParams that is passed to the next
1045  // call to IsWithinLimitsIfAggregateMsdu is the most updated one
1046  txParams.m_acknowledgment.swap (acknowledgment);
1047  acknowledgmentSwapped = true;
1048  }
1049  NS_ASSERT (acknowledgmentTime != Time::Min ());
1050 
1051  Time ppduDurationLimit = Time::Min ();
1052  if (availableTime != Time::Min ())
1053  {
1054  ppduDurationLimit = availableTime - protectionTime - acknowledgmentTime;
1055  }
1056 
1057  if (!IsWithinLimitsIfAggregateMsdu (msdu, txParams, ppduDurationLimit))
1058  {
1059  // adding MPDU failed, restore protection and acknowledgment methods
1060  // if they were swapped
1061  if (protectionSwapped)
1062  {
1063  txParams.m_protection.swap (protection);
1064  }
1065  if (acknowledgmentSwapped)
1066  {
1067  txParams.m_acknowledgment.swap (acknowledgment);
1068  }
1069  return false;
1070  }
1071 
1072  // the given MPDU can be added, hence update the txParams
1073  txParams.AggregateMsdu (msdu);
1074  UpdateTxDuration (msdu->GetHeader ().GetAddr1 (), txParams);
1075 
1076  return true;
1077 }
1078 
1079 bool
1081  const WifiTxParameters& txParams,
1082  Time ppduDurationLimit) const
1083 {
1084  NS_ASSERT (msdu != 0 && msdu->GetHeader ().IsQosData ());
1085  NS_LOG_FUNCTION (this << *msdu << &txParams << ppduDurationLimit);
1086 
1087  std::pair<uint16_t, uint32_t> ret = txParams.GetSizeIfAggregateMsdu (msdu);
1088  Mac48Address receiver = msdu->GetHeader ().GetAddr1 ();
1089  uint8_t tid = msdu->GetHeader ().GetQosTid ();
1090  WifiModulationClass modulation = txParams.m_txVector.GetModulationClass ();
1091 
1092  // Check that the limit on A-MSDU size is met
1093  uint16_t maxAmsduSize = m_msduAggregator->GetMaxAmsduSize (receiver, tid, modulation);
1094 
1095  if (maxAmsduSize == 0)
1096  {
1097  NS_LOG_DEBUG ("A-MSDU aggregation disabled");
1098  return false;
1099  }
1100 
1101  if (ret.first > maxAmsduSize)
1102  {
1103  NS_LOG_DEBUG ("No other MSDU can be aggregated: maximum A-MSDU size ("
1104  << maxAmsduSize << ") reached ");
1105  return false;
1106  }
1107 
1108  const WifiTxParameters::PsduInfo* info = txParams.GetPsduInfo (msdu->GetHeader ().GetAddr1 ());
1109  NS_ASSERT (info != nullptr);
1110 
1111  if (info->ampduSize > 0)
1112  {
1113  // the A-MSDU being built is aggregated to other MPDUs in an A-MPDU.
1114  // Check that the limit on A-MPDU size is met.
1115  if (!IsWithinAmpduSizeLimit (ret.second, receiver, tid, modulation))
1116  {
1117  return false;
1118  }
1119  }
1120 
1121  return IsWithinSizeAndTimeLimits (ret.second, receiver, txParams, ppduDurationLimit);
1122 }
1123 
1124 void
1126 {
1127  NS_LOG_FUNCTION (this << *psdu << txVector);
1128 
1129  m_mac->GetWifiRemoteStationManager ()->ReportDataFailed (*psdu->begin ());
1130 
1131  bool resetCw;
1132  MissedBlockAck (psdu, txVector, resetCw);
1133 
1134  NS_ASSERT (m_edca != 0);
1135 
1136  if (resetCw)
1137  {
1138  m_edca->ResetCw ();
1139  }
1140  else
1141  {
1142  m_edca->UpdateFailedCw ();
1143  }
1144 
1145  m_psdu = 0;
1146  TransmissionFailed ();
1147 }
1148 
1149 void
1151 {
1152  NS_LOG_FUNCTION (this << psdu << txVector << resetCw);
1153 
1154  Mac48Address recipient = psdu->GetAddr1 ();
1155  bool isBar;
1156  uint8_t tid;
1157 
1158  if (psdu->GetNMpdus () == 1 && psdu->GetHeader (0).IsBlockAckReq ())
1159  {
1160  isBar = true;
1161  CtrlBAckRequestHeader baReqHdr;
1162  psdu->GetPayload (0)->PeekHeader (baReqHdr);
1163  tid = baReqHdr.GetTidInfo ();
1164  }
1165  else
1166  {
1167  isBar = false;
1168  m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (recipient, 0, psdu->GetNMpdus (),
1169  0, 0, txVector);
1170  std::set<uint8_t> tids = psdu->GetTids ();
1171  NS_ABORT_MSG_IF (tids.size () > 1, "Multi-TID A-MPDUs not handled here");
1172  NS_ASSERT (!tids.empty ());
1173  tid = *tids.begin ();
1174  }
1175 
1176  Ptr<QosTxop> edca = m_mac->GetQosTxop (tid);
1177 
1178  if (edca->UseExplicitBarAfterMissedBlockAck () || isBar)
1179  {
1180  // we have to send a BlockAckReq, if needed
1181  if (GetBaManager (tid)->NeedBarRetransmission (tid, recipient))
1182  {
1183  NS_LOG_DEBUG ("Missed Block Ack, transmit a BlockAckReq");
1184  if (isBar)
1185  {
1186  psdu->GetHeader (0).SetRetry ();
1187  edca->ScheduleBar (*psdu->begin ());
1188  }
1189  else
1190  {
1191  // missed block ack after data frame with Implicit BAR Ack policy
1192  edca->ScheduleBar (edca->PrepareBlockAckRequest (recipient, tid));
1193  }
1194  resetCw = false;
1195  }
1196  else
1197  {
1198  NS_LOG_DEBUG ("Missed Block Ack, do not transmit a BlockAckReq");
1199  // if a BA agreement exists, we can get here if there is no outstanding
1200  // MPDU whose lifetime has not expired yet.
1201  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->begin ());
1202  if (GetBaManager (tid)->ExistsAgreementInState (recipient, tid,
1204  {
1205  // schedule a BlockAckRequest with skipIfNoDataQueued set to true, so that the
1206  // BlockAckRequest is only sent if there are data frames queued for this recipient.
1207  edca->ScheduleBar (edca->PrepareBlockAckRequest (recipient, tid), true);
1208  }
1209  resetCw = true;
1210  }
1211  }
1212  else
1213  {
1214  // we have to retransmit the data frames, if needed
1215  if (!m_mac->GetWifiRemoteStationManager ()->NeedRetransmission (*psdu->begin ()))
1216  {
1217  NS_LOG_DEBUG ("Missed Block Ack, do not retransmit the data frames");
1218  m_mac->GetWifiRemoteStationManager ()->ReportFinalDataFailed (*psdu->begin ());
1219  for (const auto& mpdu : *PeekPointer (psdu))
1220  {
1221  NotifyPacketDiscarded (mpdu);
1222  DequeueMpdu (mpdu);
1223  }
1224  resetCw = true;
1225  }
1226  else
1227  {
1228  NS_LOG_DEBUG ("Missed Block Ack, retransmit data frames");
1229  GetBaManager (tid)->NotifyMissedBlockAck (recipient, tid);
1230  resetCw = false;
1231  }
1232  }
1233 }
1234 
1235 void
1237  WifiTxVector& blockAckTxVector, double rxSnr)
1238 {
1239  NS_LOG_FUNCTION (this << durationId << blockAckTxVector << rxSnr);
1240 
1241  WifiMacHeader hdr;
1243  hdr.SetAddr1 (agreement.GetPeer ());
1244  hdr.SetAddr2 (m_self);
1245  hdr.SetDsNotFrom ();
1246  hdr.SetDsNotTo ();
1247 
1248  CtrlBAckResponseHeader blockAck;
1249  blockAck.SetType (agreement.GetBlockAckType ());
1250  blockAck.SetTidInfo (agreement.GetTid ());
1251  agreement.FillBlockAckBitmap (&blockAck);
1252 
1253  Ptr<Packet> packet = Create<Packet> ();
1254  packet->AddHeader (blockAck);
1255  Ptr<WifiPsdu> psdu = GetWifiPsdu (Create<WifiMacQueueItem> (packet, hdr), blockAckTxVector);
1256 
1257  // 802.11-2016, Section 9.2.5.7: In a BlockAck frame transmitted in response
1258  // to a BlockAckReq frame or transmitted in response to a frame containing an
1259  // implicit block ack request, the Duration/ID field is set to the value obtained
1260  // from the Duration/ ID field of the frame that elicited the response minus the
1261  // time, in microseconds between the end of the PPDU carrying the frame that
1262  // elicited the response and the end of the PPDU carrying the BlockAck frame.
1263  Time baDurationId = durationId - m_phy->GetSifs ()
1264  - m_phy->CalculateTxDuration (psdu, blockAckTxVector, m_phy->GetPhyBand ());
1265  // The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8 of 802.11-2016)
1266  if (baDurationId.IsStrictlyNegative ())
1267  {
1268  baDurationId = Seconds (0);
1269  }
1270  psdu->GetHeader (0).SetDuration (baDurationId);
1271 
1272  SnrTag tag;
1273  tag.Set (rxSnr);
1274  psdu->GetPayload (0)->AddPacketTag (tag);
1275 
1276  ForwardPsduDown (psdu, blockAckTxVector);
1277 }
1278 
1279 bool
1281 {
1282  return (m_agreements.find ({originator, tid}) != m_agreements.end ());
1283 }
1284 
1287 {
1288  auto it = m_agreements.find ({originator, tid});
1289  NS_ABORT_MSG_IF (it == m_agreements.end (), "No established Block Ack agreement");
1290  return it->second.GetBlockAckType ();
1291 }
1292 
1293 void
1295  const WifiTxVector& txVector, bool inAmpdu)
1296 {
1297  // The received MPDU is either broadcast or addressed to this station
1298  NS_ASSERT (mpdu->GetHeader ().GetAddr1 ().IsGroup ()
1299  || mpdu->GetHeader ().GetAddr1 () == m_self);
1300 
1301  double rxSnr = rxSignalInfo.snr;
1302  const WifiMacHeader& hdr = mpdu->GetHeader ();
1303 
1304  if (hdr.IsCtl ())
1305  {
1307  && m_psdu != 0)
1308  {
1309  NS_ABORT_MSG_IF (inAmpdu, "Received CTS as part of an A-MPDU");
1310  NS_ASSERT (hdr.GetAddr1 () == m_self);
1311 
1312  Mac48Address sender = m_psdu->GetAddr1 ();
1313  NS_LOG_DEBUG ("Received CTS from=" << sender);
1314 
1315  SnrTag tag;
1316  mpdu->GetPacket ()->PeekPacketTag (tag);
1317  m_mac->GetWifiRemoteStationManager ()->ReportRxOk (sender, rxSignalInfo, txVector);
1318  m_mac->GetWifiRemoteStationManager ()->ReportRtsOk (m_psdu->GetHeader (0),
1319  rxSnr, txVector.GetMode (), tag.Get ());
1320 
1321  m_txTimer.Cancel ();
1322  m_channelAccessManager->NotifyCtsTimeoutResetNow ();
1324  }
1325  else if (hdr.IsBlockAck () && m_txTimer.IsRunning ()
1327  && hdr.GetAddr1 () == m_self)
1328  {
1329  Mac48Address sender = hdr.GetAddr2 ();
1330  NS_LOG_DEBUG ("Received BlockAck from=" << sender);
1331 
1332  SnrTag tag;
1333  mpdu->GetPacket ()->PeekPacketTag (tag);
1334 
1335  // notify the Block Ack Manager
1336  CtrlBAckResponseHeader blockAck;
1337  mpdu->GetPacket ()->PeekHeader (blockAck);
1338  uint8_t tid = blockAck.GetTidInfo ();
1339  std::pair<uint16_t,uint16_t> ret = GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid});
1340  m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.GetAddr2 (), ret.first, ret.second,
1341  rxSnr, tag.Get (), m_txParams.m_txVector);
1342 
1343  // cancel the timer
1344  m_txTimer.Cancel ();
1345  m_channelAccessManager->NotifyAckTimeoutResetNow ();
1346 
1347  // Reset the CW
1348  m_edca->ResetCw ();
1349 
1350  m_psdu = 0;
1352  }
1353  else if (hdr.IsBlockAckReq ())
1354  {
1355  NS_ASSERT (hdr.GetAddr1 () == m_self);
1356  NS_ABORT_MSG_IF (inAmpdu, "BlockAckReq in A-MPDU is not supported");
1357 
1358  Mac48Address sender = hdr.GetAddr2 ();
1359  NS_LOG_DEBUG ("Received BlockAckReq from=" << sender);
1360 
1361  CtrlBAckRequestHeader blockAckReq;
1362  mpdu->GetPacket ()->PeekHeader (blockAckReq);
1363  NS_ABORT_MSG_IF (blockAckReq.IsMultiTid (), "Multi-TID BlockAckReq not supported");
1364  uint8_t tid = blockAckReq.GetTidInfo ();
1365 
1366  auto agreementIt = m_agreements.find ({sender, tid});
1367 
1368  if (agreementIt == m_agreements.end ())
1369  {
1370  NS_LOG_DEBUG ("There's not a valid agreement for this BlockAckReq");
1371  return;
1372  }
1373 
1374  agreementIt->second.NotifyReceivedBar (blockAckReq.GetStartingSequence ());
1375 
1376  NS_LOG_DEBUG ("Schedule Block Ack");
1378  agreementIt->second, hdr.GetDuration (),
1379  m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (sender, txVector),
1380  rxSnr);
1381  }
1382  else
1383  {
1384  // the received control frame cannot be handled here
1385  QosFrameExchangeManager::ReceiveMpdu (mpdu, rxSignalInfo, txVector, inAmpdu);
1386  }
1387  return;
1388  }
1389 
1390  if (hdr.IsQosData () && hdr.HasData () && hdr.GetAddr1 () == m_self)
1391  {
1392  uint8_t tid = hdr.GetQosTid ();
1393 
1394  auto agreementIt = m_agreements.find ({hdr.GetAddr2 (), tid});
1395  if (agreementIt != m_agreements.end ())
1396  {
1397  // a Block Ack agreement has been established
1398  NS_LOG_DEBUG ("Received from=" << hdr.GetAddr2 ()
1399  << " (" << *mpdu << ")");
1400 
1401  agreementIt->second.NotifyReceivedMpdu (mpdu);
1402 
1403  if (!inAmpdu && hdr.GetQosAckPolicy () == WifiMacHeader::NORMAL_ACK)
1404  {
1405  NS_LOG_DEBUG ("Schedule Normal Ack");
1407  this, hdr, txVector, rxSnr);
1408  }
1409  return;
1410  }
1411  // We let the QosFrameExchangeManager handle QoS data frame not belonging
1412  // to a Block Ack agreement
1413  }
1414 
1415  QosFrameExchangeManager::ReceiveMpdu (mpdu, rxSignalInfo, txVector, inAmpdu);
1416 }
1417 
1418 void
1420  const WifiTxVector& txVector, const std::vector<bool>& perMpduStatus)
1421 {
1422  std::set<uint8_t> tids = psdu->GetTids ();
1423 
1424  // Multi-TID A-MPDUs are not supported yet
1425  if (tids.size () == 1)
1426  {
1427  uint8_t tid = *tids.begin ();
1428  WifiMacHeader::QosAckPolicy ackPolicy = psdu->GetAckPolicyForTid (tid);
1429  NS_ASSERT (psdu->GetNMpdus () > 1);
1430 
1431  if (ackPolicy == WifiMacHeader::NORMAL_ACK)
1432  {
1433  // Normal Ack or Implicit Block Ack Request
1434  NS_LOG_DEBUG ("Schedule Block Ack");
1435  auto agreementIt = m_agreements.find ({psdu->GetAddr2 (), tid});
1436  NS_ASSERT (agreementIt != m_agreements.end ());
1437 
1439  agreementIt->second, psdu->GetDuration (),
1440  m_mac->GetWifiRemoteStationManager ()->GetBlockAckTxVector (psdu->GetAddr2 (), txVector),
1441  rxSignalInfo.snr);
1442  }
1443  }
1444 }
1445 
1446 } //namespace ns3
ns3::FrameExchangeManager::CalculateAcknowledgmentTime
virtual void CalculateAcknowledgmentTime(WifiAcknowledgment *acknowledgment) const
Calculate the time required to acknowledge a frame according to the given acknowledgment method.
Definition: frame-exchange-manager.cc:490
ns3::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:798
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:756
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:59
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:653
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:681
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:922
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:1150
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:1286
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:1610
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:665
ns3::QosFrameExchangeManager::TransmissionFailed
void TransmissionFailed(void) override
Take necessary actions upon a transmission failure.
Definition: qos-frame-exchange-manager.cc:566
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:94
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:407
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:461
ns3::QosFrameExchangeManager::TransmissionSucceeded
void TransmissionSucceeded(void) override
Take necessary actions upon a transmission success.
Definition: qos-frame-exchange-manager.cc:537
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:654
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
Definition: wifi-mac-header.cc:90
ns3::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:1080
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:1604
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:659
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:1236
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:706
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:923
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::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
Definition: qos-txop.cc:357
ns3::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:804
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:557
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:65
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:686
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:633
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:672
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:564
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::WifiMacQueueItem::ConstIterator
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
Definition: wifi-mac-queue-item.h:144
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:703
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:1005
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:1294
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:603
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:939
ns3::WifiTxParameters::Clear
void Clear(void)
Reset the TX parameters.
Definition: wifi-tx-parameters.cc:67
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:1124
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:485
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:725
ns3::WifiTxParameters::m_acknowledgment
std::unique_ptr< WifiAcknowledgment > m_acknowledgment
acknowledgment method
Definition: wifi-tx-parameters.h:64
ns3::SnrTag
Introspection did not find any typical Config paths.
Definition: snr-tag.h:35
ns3::FrameExchangeManager::DequeueMpdu
virtual void DequeueMpdu(Ptr< const WifiMacQueueItem > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
Definition: frame-exchange-manager.cc:450
ns3::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:982
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:580
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:517
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::QosTxop::GetNextMpdu
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::ConstIterator &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:443
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:1160
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:345
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:874
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:516
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::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:60
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:830
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::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:912
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:522
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:797
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:639
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:1419
ns3::WifiPhy::GetSifs
Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Definition: wifi-phy.cc:910
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:241
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:100
ns3::HtFrameExchangeManager::NotifyReceivedNormalAck
void NotifyReceivedNormalAck(Ptr< WifiMacQueueItem > mpdu) override
Notify other components that an MPDU was acknowledged.
Definition: ht-frame-exchange-manager.cc:528
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:686
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:1789
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:738
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:1125
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:1280
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:570
ns3::MgtAddBaResponseHeader::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:1744