A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
edca-txop-n.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #include "ns3/log.h"
23 #include "ns3/assert.h"
24 #include "ns3/pointer.h"
25 
26 #include "edca-txop-n.h"
27 #include "mac-low.h"
28 #include "dcf-manager.h"
29 #include "mac-tx-middle.h"
30 #include "wifi-mac-trailer.h"
31 #include "wifi-mac.h"
32 #include "random-stream.h"
33 #include "wifi-mac-queue.h"
34 #include "msdu-aggregator.h"
35 #include "mgt-headers.h"
37 
38 NS_LOG_COMPONENT_DEFINE ("EdcaTxopN");
39 
40 #undef NS_LOG_APPEND_CONTEXT
41 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
42 
43 namespace ns3 {
44 
45 class EdcaTxopN::Dcf : public DcfState
46 {
47 public:
48  Dcf (EdcaTxopN * txop)
49  : m_txop (txop)
50  {
51  }
52 private:
53  virtual void DoNotifyAccessGranted (void)
54  {
56  }
57  virtual void DoNotifyInternalCollision (void)
58  {
60  }
61  virtual void DoNotifyCollision (void)
62  {
64  }
65  virtual void DoNotifyChannelSwitching (void)
66  {
68  }
70 };
71 
73 {
74 public:
77  m_txop (txop) {
78  }
79 
80  virtual ~TransmissionListener () {}
81 
82  virtual void GotCts (double snr, WifiMode txMode)
83  {
84  m_txop->GotCts (snr, txMode);
85  }
86  virtual void MissedCts (void)
87  {
88  m_txop->MissedCts ();
89  }
90  virtual void GotAck (double snr, WifiMode txMode)
91  {
92  m_txop->GotAck (snr, txMode);
93  }
94  virtual void MissedAck (void)
95  {
96  m_txop->MissedAck ();
97  }
98  virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source)
99  {
100  m_txop->GotBlockAck (blockAck, source);
101  }
102  virtual void MissedBlockAck (void)
103  {
105  }
106  virtual void StartNext (void)
107  {
108  m_txop->StartNext ();
109  }
110  virtual void Cancel (void)
111  {
112  m_txop->Cancel ();
113  }
114  virtual void EndTxNoAck (void)
115  {
116  m_txop->EndTxNoAck ();
117  }
118 
119 private:
121 };
122 
124 {
125 public:
128  m_txop (txop) {
129  }
131 
132  virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid)
133  {
134  m_txop->SendDelbaFrame (address, tid, false);
135  }
136 
137 private:
139 };
140 
142 
143 TypeId
145 {
146  static TypeId tid = TypeId ("ns3::EdcaTxopN")
149  .AddAttribute ("BlockAckThreshold", "If number of packets in this queue reaches this value,\
150  block ack mechanism is used. If this value is 0, block ack is never used.",
151  UintegerValue (0),
152  MakeUintegerAccessor (&EdcaTxopN::SetBlockAckThreshold,
154  MakeUintegerChecker<uint8_t> (0, 64))
155  .AddAttribute ("BlockAckInactivityTimeout", "Represents max time (blocks of 1024 micro seconds) allowed for block ack\
156  inactivity. If this value isn't equal to 0 a timer start after that a\
157  block ack setup is completed and will be reset every time that a block\
158  ack frame is received. If this value is 0, block ack inactivity timeout won't be used.",
159  UintegerValue (0),
160  MakeUintegerAccessor (&EdcaTxopN::SetBlockAckInactivityTimeout),
161  MakeUintegerChecker<uint16_t> ())
162  .AddAttribute ("Queue", "The WifiMacQueue object",
163  PointerValue (),
164  MakePointerAccessor (&EdcaTxopN::GetQueue),
165  MakePointerChecker<WifiMacQueue> ())
166  ;
167  return tid;
168 }
169 
171  : m_manager (0),
172  m_currentPacket (0),
173  m_aggregator (0),
174  m_blockAckType (COMPRESSED_BLOCK_ACK)
175 {
176  NS_LOG_FUNCTION (this);
179  m_dcf = new EdcaTxopN::Dcf (this);
180  m_queue = CreateObject<WifiMacQueue> ();
181  m_rng = new RealRandomStream ();
183  m_baManager = new BlockAckManager ();
188  m_baManager->SetMaxPacketDelay (m_queue->GetMaxDelay ());
189 }
190 
192 {
193  NS_LOG_FUNCTION (this);
194 }
195 
196 void
198 {
199  NS_LOG_FUNCTION (this);
200  m_queue = 0;
201  m_low = 0;
202  m_stationManager = 0;
203  delete m_transmissionListener;
204  delete m_dcf;
205  delete m_rng;
207  delete m_baManager;
208  delete m_blockAckListener;
210  m_dcf = 0;
211  m_rng = 0;
213  m_baManager = 0;
214  m_blockAckListener = 0;
215  m_txMiddle = 0;
216  m_aggregator = 0;
217 }
218 
219 void
221 {
222  NS_LOG_FUNCTION (this << manager);
223  m_manager = manager;
224  m_manager->Add (m_dcf);
225 }
226 
227 void
229 {
230  NS_LOG_FUNCTION (this << &callback);
231  m_txOkCallback = callback;
232 }
233 
234 void
236 {
237  NS_LOG_FUNCTION (this << &callback);
238  m_txFailedCallback = callback;
239 }
240 
241 void
243 {
244  NS_LOG_FUNCTION (this << remoteManager);
245  m_stationManager = remoteManager;
246 }
247 void
249 {
250  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
251  m_typeOfStation = type;
252 }
253 
254 enum TypeOfStation
256 {
257  NS_LOG_FUNCTION (this);
258  return m_typeOfStation;
259 }
260 
263 {
264  NS_LOG_FUNCTION (this);
265  return m_queue;
266 }
267 
268 void
269 EdcaTxopN::SetMinCw (uint32_t minCw)
270 {
271  NS_LOG_FUNCTION (this << minCw);
272  m_dcf->SetCwMin (minCw);
273 }
274 
275 void
276 EdcaTxopN::SetMaxCw (uint32_t maxCw)
277 {
278  NS_LOG_FUNCTION (this << maxCw);
279  m_dcf->SetCwMax (maxCw);
280 }
281 
282 void
283 EdcaTxopN::SetAifsn (uint32_t aifsn)
284 {
285  NS_LOG_FUNCTION (this << aifsn);
286  m_dcf->SetAifsn (aifsn);
287 }
288 
289 uint32_t
291 {
292  NS_LOG_FUNCTION (this);
293  return m_dcf->GetCwMin ();
294 }
295 
296 uint32_t
298 {
299  NS_LOG_FUNCTION (this);
300  return m_dcf->GetCwMax ();
301 }
302 
303 uint32_t
305 {
306  NS_LOG_FUNCTION (this);
307  return m_dcf->GetAifsn ();
308 }
309 
310 void
312 {
313  NS_LOG_FUNCTION (this << txMiddle);
314  m_txMiddle = txMiddle;
315 }
316 
319 {
320  NS_LOG_FUNCTION (this);
321  return m_low;
322 }
323 
324 void
326 {
327  NS_LOG_FUNCTION (this << low);
328  m_low = low;
329 }
330 
331 bool
333 {
334  NS_LOG_FUNCTION (this);
335  return !m_queue->IsEmpty () || m_currentPacket != 0 || m_baManager->HasPackets ();
336 }
337 
338 void
340 {
341  NS_LOG_FUNCTION (this);
342  if (m_currentPacket == 0)
343  {
344  if (m_queue->IsEmpty () && !m_baManager->HasPackets ())
345  {
346  NS_LOG_DEBUG ("queue is empty");
347  return;
348  }
350  {
352  return;
353  }
354  /* check if packets need retransmission are stored in BlockAckManager */
356  if (m_currentPacket == 0)
357  {
358  if (m_queue->PeekFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations) == 0)
359  {
360  NS_LOG_DEBUG ("no available packets in the queue");
361  return;
362  }
364  && m_blockAckThreshold > 0
366  && SetupBlockAckIfNeeded ())
367  {
368  return;
369  }
371  NS_ASSERT (m_currentPacket != 0);
372 
373  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
374  m_currentHdr.SetSequenceNumber (sequence);
378  m_fragmentNumber = 0;
379  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
380  ", to=" << m_currentHdr.GetAddr1 () <<
381  ", seq=" << m_currentHdr.GetSequenceControl ());
383  {
384  VerifyBlockAck ();
385  }
386  }
387  }
389  params.DisableOverrideDurationId ();
390  if (m_currentHdr.GetAddr1 ().IsGroup ())
391  {
392  params.DisableRts ();
393  params.DisableAck ();
394  params.DisableNextData ();
395  m_low->StartTransmission (m_currentPacket,
396  &m_currentHdr,
397  params,
399 
400  NS_LOG_DEBUG ("tx broadcast");
401  }
403  {
405  }
406  else
407  {
409  {
410  params.DisableAck ();
411  }
412  else
413  {
414  params.EnableAck ();
415  }
417  && !m_currentHdr.IsQosAmsdu ())
418  ||
419  (m_currentHdr.IsData ()
421  && (m_blockAckThreshold == 0
423  {
424  //With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
425  params.DisableRts ();
426  WifiMacHeader hdr;
427  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
428  if (IsLastFragment ())
429  {
430  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
431  params.DisableNextData ();
432  }
433  else
434  {
435  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
437  }
438  m_low->StartTransmission (fragment, &hdr, params,
440  }
441  else
442  {
443  WifiMacHeader peekedHdr;
444  if (m_currentHdr.IsQosData ()
445  && m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
448  && m_aggregator != 0 && !m_currentHdr.IsRetry ())
449  {
450  /* here is performed aggregation */
451  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
452  m_aggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
453  MapSrcAddressForAggregation (peekedHdr),
454  MapDestAddressForAggregation (peekedHdr));
455  bool aggregated = false;
456  bool isAmsdu = false;
457  Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
460  while (peekedPacket != 0)
461  {
462  aggregated = m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket,
463  MapSrcAddressForAggregation (peekedHdr),
464  MapDestAddressForAggregation (peekedHdr));
465  if (aggregated)
466  {
467  isAmsdu = true;
468  m_queue->Remove (peekedPacket);
469  }
470  else
471  {
472  break;
473  }
474  peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
476  }
477  if (isAmsdu)
478  {
480  m_currentHdr.SetAddr3 (m_low->GetBssid ());
481  m_currentPacket = currentAggregatedPacket;
482  currentAggregatedPacket = 0;
483  NS_LOG_DEBUG ("tx unicast A-MSDU");
484  }
485  }
486  if (NeedRts ())
487  {
488  params.EnableRts ();
489  NS_LOG_DEBUG ("tx unicast rts");
490  }
491  else
492  {
493  params.DisableRts ();
494  NS_LOG_DEBUG ("tx unicast");
495  }
496  params.DisableNextData ();
497  m_low->StartTransmission (m_currentPacket, &m_currentHdr,
498  params, m_transmissionListener);
499  CompleteTx ();
500  }
501  }
502 }
503 
505 {
506  NS_LOG_FUNCTION (this);
507  NotifyCollision ();
508 }
509 
510 void
512 {
513  NS_LOG_FUNCTION (this);
516 }
517 
518 void
519 EdcaTxopN::GotCts (double snr, WifiMode txMode)
520 {
521  NS_LOG_FUNCTION (this << snr << txMode);
522  NS_LOG_DEBUG ("got cts");
523 }
524 
525 void
527 {
528  NS_LOG_FUNCTION (this);
529  NS_LOG_DEBUG ("missed cts");
530  if (!NeedRtsRetransmission ())
531  {
532  NS_LOG_DEBUG ("Cts Fail");
533  m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
534  if (!m_txFailedCallback.IsNull ())
535  {
537  }
538  // to reset the dcf.
539  m_currentPacket = 0;
540  m_dcf->ResetCw ();
541  }
542  else
543  {
544  m_dcf->UpdateFailedCw ();
545  }
548 }
549 
550 void
552 {
553  NS_LOG_FUNCTION (this);
554  m_queue->Flush ();
555  m_currentPacket = 0;
556 }
557 
558 void
560 {
561  NS_LOG_FUNCTION (this << packet << &hdr);
562  WifiMacTrailer fcs;
563  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
564  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
565  packet, fullPacketSize);
566  m_queue->Enqueue (packet, hdr);
568 }
569 
570 void
571 EdcaTxopN::GotAck (double snr, WifiMode txMode)
572 {
573  NS_LOG_FUNCTION (this << snr << txMode);
574  if (!NeedFragmentation ()
575  || IsLastFragment ()
576  || m_currentHdr.IsQosAmsdu ())
577  {
578  NS_LOG_DEBUG ("got ack. tx done.");
579  if (!m_txOkCallback.IsNull ())
580  {
582  }
583 
584  if (m_currentHdr.IsAction ())
585  {
586  WifiActionHeader actionHdr;
588  p->RemoveHeader (actionHdr);
589  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK
591  {
592  MgtDelBaHeader delBa;
593  p->PeekHeader (delBa);
594  if (delBa.IsByOriginator ())
595  {
597  }
598  else
599  {
600  m_low->DestroyBlockAckAgreement (m_currentHdr.GetAddr1 (), delBa.GetTid ());
601  }
602  }
603  }
604  m_currentPacket = 0;
605 
606  m_dcf->ResetCw ();
609  }
610  else
611  {
612  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
613  }
614 }
615 
616 void
618 {
619  NS_LOG_FUNCTION (this);
620  NS_LOG_DEBUG ("missed ack");
621  if (!NeedDataRetransmission ())
622  {
623  NS_LOG_DEBUG ("Ack Fail");
624  m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
625  if (!m_txFailedCallback.IsNull ())
626  {
628  }
629  // to reset the dcf.
630  m_currentPacket = 0;
631  m_dcf->ResetCw ();
632  }
633  else
634  {
635  NS_LOG_DEBUG ("Retransmit");
637  m_dcf->UpdateFailedCw ();
638  }
641 }
642 
643 void
645 {
646  NS_LOG_FUNCTION (this);
647  NS_LOG_DEBUG ("missed block ack");
648  //should i report this to station addressed by ADDR1?
649  NS_LOG_DEBUG ("Retransmit block ack request");
651  m_dcf->UpdateFailedCw ();
652 
655 }
656 
659 {
660  return m_aggregator;
661 }
662 
663 void
665 {
666  NS_LOG_FUNCTION (this);
667  if ((m_currentPacket != 0
668  || !m_queue->IsEmpty () || m_baManager->HasPackets ())
669  && !m_dcf->IsAccessRequested ())
670  {
672  }
673 }
674 
675 void
677 {
678  NS_LOG_FUNCTION (this);
679  if (m_currentPacket == 0
680  && (!m_queue->IsEmpty () || m_baManager->HasPackets ())
681  && !m_dcf->IsAccessRequested ())
682  {
684  }
685 }
686 
687 bool
689 {
690  NS_LOG_FUNCTION (this);
691  return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
693 }
694 
695 bool
697 {
698  NS_LOG_FUNCTION (this);
699  return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
701 }
702 
703 bool
705 {
706  NS_LOG_FUNCTION (this);
707  return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
709 }
710 
711 void
713 {
714  NS_LOG_FUNCTION (this);
716 }
717 
718 void
720 {
721  NS_LOG_FUNCTION (this);
722  NS_LOG_DEBUG ("start next packet fragment");
723  /* this callback is used only for fragments. */
724  NextFragment ();
725  WifiMacHeader hdr;
726  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
728  params.EnableAck ();
729  params.DisableRts ();
730  params.DisableOverrideDurationId ();
731  if (IsLastFragment ())
732  {
733  params.DisableNextData ();
734  }
735  else
736  {
738  }
739  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
740 }
741 
742 void
744 {
745  NS_LOG_FUNCTION (this);
746  NS_LOG_DEBUG ("transmission cancelled");
747 }
748 
749 void
751 {
752  NS_LOG_FUNCTION (this);
753  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
754  m_currentPacket = 0;
755  m_dcf->ResetCw ();
758 }
759 
760 bool
762 {
763  NS_LOG_FUNCTION (this);
764  return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
766 }
767 
768 uint32_t
770 {
771  NS_LOG_FUNCTION (this);
772  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
774 }
775 
776 uint32_t
778 {
779  NS_LOG_FUNCTION (this);
780  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
782 }
783 
784 uint32_t
786 {
787  NS_LOG_FUNCTION (this);
788  return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
790 }
791 
792 
793 bool
795 {
796  NS_LOG_FUNCTION (this);
797  return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
799 }
800 
803 {
804  NS_LOG_FUNCTION (this << hdr);
805  *hdr = m_currentHdr;
807  uint32_t startOffset = GetFragmentOffset ();
808  Ptr<Packet> fragment;
809  if (IsLastFragment ())
810  {
811  hdr->SetNoMoreFragments ();
812  }
813  else
814  {
815  hdr->SetMoreFragments ();
816  }
817  fragment = m_currentPacket->CreateFragment (startOffset,
818  GetFragmentSize ());
819  return fragment;
820 }
821 
822 void
824 {
825  NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
826  m_ac = ac;
827 }
828 
831 {
832  NS_LOG_FUNCTION (this << &hdr);
833  Mac48Address retval;
835  {
836  retval = hdr.GetAddr2 ();
837  }
838  else
839  {
840  retval = hdr.GetAddr3 ();
841  }
842  return retval;
843 }
844 
847 {
848  NS_LOG_FUNCTION (this << &hdr);
849  Mac48Address retval;
851  {
852  retval = hdr.GetAddr1 ();
853  }
854  else
855  {
856  retval = hdr.GetAddr3 ();
857  }
858  return retval;
859 }
860 
861 void
863 {
864  NS_LOG_FUNCTION (this << aggr);
865  m_aggregator = aggr;
866 }
867 
868 void
870 {
871  NS_LOG_FUNCTION (this << packet << &hdr);
872  WifiMacTrailer fcs;
873  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
874  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
875  packet, fullPacketSize);
876  m_queue->PushFront (packet, hdr);
878 }
879 
880 void
882 {
883  NS_LOG_FUNCTION (this << respHdr << recipient);
884  NS_LOG_DEBUG ("received ADDBA response from " << recipient);
885  uint8_t tid = respHdr->GetTid ();
887  {
888  if (respHdr->GetStatusCode ().IsSuccess ())
889  {
890  NS_LOG_DEBUG ("block ack agreement established with " << recipient);
891  m_baManager->UpdateAgreement (respHdr, recipient);
892  }
893  else
894  {
895  NS_LOG_DEBUG ("discard ADDBA response" << recipient);
896  m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
897  }
898  }
900 }
901 
902 void
904 {
905  NS_LOG_FUNCTION (this << delBaHdr << recipient);
906  NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
907  m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
908 }
909 
910 void
912 {
913  NS_LOG_FUNCTION (this << blockAck << recipient);
914  NS_LOG_DEBUG ("got block ack from=" << recipient);
915  m_baManager->NotifyGotBlockAck (blockAck, recipient);
916  m_currentPacket = 0;
917  m_dcf->ResetCw ();
920 }
921 
922 void
924 {
925  NS_LOG_FUNCTION (this);
926  uint8_t tid = m_currentHdr.GetQosTid ();
927  Mac48Address recipient = m_currentHdr.GetAddr1 ();
928  uint16_t sequence = m_currentHdr.GetSequenceNumber ();
930  {
931  m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
932  }
934  {
936  }
937 }
938 
939 void
941 {
942  NS_LOG_FUNCTION (this);
944  {
945  if (!m_currentHdr.IsRetry ())
946  {
948  }
951  m_currentHdr.GetAddr1 ()));
952  }
953 }
954 
955 bool
957 {
958  NS_LOG_FUNCTION (this);
959  uint8_t tid = m_currentHdr.GetQosTid ();
960  Mac48Address recipient = m_currentHdr.GetAddr1 ();
961 
962  uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient);
963 
964  if (packets >= m_blockAckThreshold)
965  {
966  /* Block ack setup */
967  uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
968  SendAddBaRequest (recipient, tid, startingSequence, m_blockAckInactivityTimeout, true);
969  return true;
970  }
971  return false;
972 }
973 
974 void
976 {
977  NS_LOG_FUNCTION (this << &bar);
978  WifiMacHeader hdr;
980  hdr.SetAddr1 (bar.recipient);
981  hdr.SetAddr2 (m_low->GetAddress ());
982  hdr.SetAddr3 (m_low->GetBssid ());
983  hdr.SetDsNotTo ();
984  hdr.SetDsNotFrom ();
985  hdr.SetNoRetry ();
986  hdr.SetNoMoreFragments ();
987 
988  m_currentPacket = bar.bar;
989  m_currentHdr = hdr;
990 
992  params.DisableRts ();
993  params.DisableNextData ();
994  params.DisableOverrideDurationId ();
995  if (bar.immediate)
996  {
998  {
999  params.EnableBasicBlockAck ();
1000  }
1002  {
1003  params.EnableCompressedBlockAck ();
1004  }
1005  else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
1006  {
1007  NS_FATAL_ERROR ("Multi-tid block ack is not supported");
1008  }
1009  }
1010  else
1011  {
1012  //Delayed block ack
1013  params.EnableAck ();
1014  }
1015  m_low->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener);
1016 }
1017 
1018 void
1020 {
1021  NS_LOG_FUNCTION (this);
1023  m_low->RegisterBlockAckListenerForAc (m_ac, m_blockAckListener);
1025 }
1026 
1027 void
1029 {
1030  NS_LOG_FUNCTION (this << static_cast<uint32_t> (threshold));
1031  m_blockAckThreshold = threshold;
1032  m_baManager->SetBlockAckThreshold (threshold);
1033 }
1034 
1035 void
1037 {
1038  NS_LOG_FUNCTION (this << timeout);
1040 }
1041 
1042 uint8_t
1044 {
1045  NS_LOG_FUNCTION (this);
1046  return m_blockAckThreshold;
1047 }
1048 
1049 void
1050 EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
1051  uint16_t timeout, bool immediateBAck)
1052 {
1053  NS_LOG_FUNCTION (this << dest << static_cast<uint32_t> (tid) << startSeq << timeout << immediateBAck);
1054  NS_LOG_DEBUG ("sent ADDBA request to " << dest);
1055  WifiMacHeader hdr;
1056  hdr.SetAction ();
1057  hdr.SetAddr1 (dest);
1058  hdr.SetAddr2 (m_low->GetAddress ());
1059  hdr.SetAddr3 (m_low->GetAddress ());
1060  hdr.SetDsNotTo ();
1061  hdr.SetDsNotFrom ();
1062 
1063  WifiActionHeader actionHdr;
1066  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1067 
1068  Ptr<Packet> packet = Create<Packet> ();
1069  /*Setting ADDBARequest header*/
1070  MgtAddBaRequestHeader reqHdr;
1071  reqHdr.SetAmsduSupport (true);
1072  if (immediateBAck)
1073  {
1074  reqHdr.SetImmediateBlockAck ();
1075  }
1076  else
1077  {
1078  reqHdr.SetDelayedBlockAck ();
1079  }
1080  reqHdr.SetTid (tid);
1081  /* For now we don't use buffer size field in the ADDBA request frame. The recipient
1082  * will choose how many packets it can receive under block ack.
1083  */
1084  reqHdr.SetBufferSize (0);
1085  reqHdr.SetTimeout (timeout);
1086  reqHdr.SetStartingSequence (startSeq);
1087 
1088  m_baManager->CreateAgreement (&reqHdr, dest);
1089 
1090  packet->AddHeader (reqHdr);
1091  packet->AddHeader (actionHdr);
1092 
1093  m_currentPacket = packet;
1094  m_currentHdr = hdr;
1095 
1096  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
1097  m_currentHdr.SetSequenceNumber (sequence);
1101 
1103  params.EnableAck ();
1104  params.DisableRts ();
1105  params.DisableNextData ();
1106  params.DisableOverrideDurationId ();
1107 
1108  m_low->StartTransmission (m_currentPacket, &m_currentHdr, params,
1110 }
1111 
1112 void
1113 EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
1114 {
1115  NS_LOG_FUNCTION (this << addr << static_cast<uint32_t> (tid) << byOriginator);
1116  WifiMacHeader hdr;
1117  hdr.SetAction ();
1118  hdr.SetAddr1 (addr);
1119  hdr.SetAddr2 (m_low->GetAddress ());
1120  hdr.SetAddr3 (m_low->GetAddress ());
1121  hdr.SetDsNotTo ();
1122  hdr.SetDsNotFrom ();
1123 
1124  MgtDelBaHeader delbaHdr;
1125  delbaHdr.SetTid (tid);
1126  if (byOriginator)
1127  {
1128  delbaHdr.SetByOriginator ();
1129  }
1130  else
1131  {
1132  delbaHdr.SetByRecipient ();
1133  }
1134 
1135  WifiActionHeader actionHdr;
1138  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1139 
1140  Ptr<Packet> packet = Create<Packet> ();
1141  packet->AddHeader (delbaHdr);
1142  packet->AddHeader (actionHdr);
1143 
1144  PushFront (packet, hdr);
1145 }
1146 
1147 int64_t
1149 {
1150  NS_LOG_FUNCTION (this << stream);
1151  m_rng->AssignStreams (stream);
1152  return 1;
1153 }
1154 
1155 void
1157 {
1158  NS_LOG_FUNCTION (this);
1159  m_dcf->ResetCw ();
1162 }
1163 } // namespace ns3
Keep track of destination address - TID pairs that are waiting for a block ACK response.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:268
void SetAction()
Set Type/Subtype values for an action header.
void SetRetry(void)
Set the Retry bit in the Frame Control field.
void SetUnblockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum congestion window size.
Definition: edca-txop-n.cc:276
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
TransmissionListener * m_transmissionListener
Definition: edca-txop-n.h:437
Ptr< const Packet > m_currentPacket
Definition: edca-txop-n.h:446
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void DoInitialize()
This method is called only once by Object::Initialize.
void SetQosAckPolicy(enum QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
TypeId AddConstructor(void)
Definition: type-id.h:418
TxFailed m_txFailedCallback
Definition: edca-txop-n.h:434
void SetBlockAckInactivityTimeout(uint16_t timeout)
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-manager.cc:79
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: edca-txop-n.cc:769
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
void NotifyGotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
uint16_t m_blockAckInactivityTimeout
Definition: edca-txop-n.h:459
void CreateAgreement(const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
void VerifyBlockAck(void)
Verifies if dequeued packet has to be transmitted with ack policy Block Ack.
Definition: edca-txop-n.cc:923
void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
Event handler when a Block ACK is received.
Definition: edca-txop-n.cc:911
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:336
void NotifyCollision(void)
Notify the EDCAF that collision has occurred.
Definition: edca-txop-n.cc:511
void SetTypeOfStation(enum TypeOfStation type)
Set type of station with the given type.
Definition: edca-txop-n.cc:248
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
Definition: mac-low.cc:108
void StorePacket(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp)
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: edca-txop-n.cc:704
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:423
virtual void EndTxNoAck(void)
Invoked upon the end of the transmission of a frame that does not require an ACK (e.g., broadcast and multicast frames).
Definition: edca-txop-n.cc:114
bool IsAction() const
Return true if the header is an Action header.
void SetTxFailedCallback(TxFailed callback)
Definition: edca-txop-n.cc:235
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:454
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: edca-txop-n.cc:571
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1018
virtual void MissedBlockAck(void)
ns3::MacLow did not receive an expected BLOCK_ACK within BlockAckTimeout.
Definition: edca-txop-n.cc:102
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
enum WifiMacType GetType(void) const
Return the type (enum WifiMacType)
uint8_t m_blockAckThreshold
Definition: edca-txop-n.h:456
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this EdcaTxopN is associated to.
Definition: edca-txop-n.cc:242
bool HasBar(struct Bar &bar)
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
bool IsBroadcast(void) const
void SetBlockAckType(enum BlockAckType bAckType)
WifiMacHeader m_currentHdr
Definition: edca-txop-n.h:448
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:478
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:57
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: edca-txop-n.cc:110
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:509
bool HasPackets(void) const
Returns true if there are packets that need of retransmission or at least a BAR is scheduled...
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Definition: dcf-manager.cc:90
ns3::Time timeout
void SetTid(uint8_t)
Set Traffic ID (TID).
virtual void BlockAckInactivityTimeout(Mac48Address address, uint8_t tid)
Typically is called in order to notify EdcaTxopN that a block ack inactivity timeout occurs for the b...
Definition: edca-txop-n.cc:132
Block Ack Request.
friend class TransmissionListener
Definition: edca-txop-n.h:429
listen to events coming from ns3::MacLow.
Definition: mac-low.h:56
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
virtual void MissedAck(void)
ns3::MacLow did not receive an expected ACK within AckTimeout.
Definition: edca-txop-n.cc:94
void Add(DcfState *dcf)
Definition: dcf-manager.cc:343
void NextFragment(void)
Continue to the next fragment.
Definition: edca-txop-n.cc:712
bool IsQosAmsdu(void) const
Check if the A-MSDU present bit is set in the QoS control field.
void SetTxOkCallback(TxOk callback)
Definition: edca-txop-n.cc:228
BlockAckManager * m_baManager
Definition: edca-txop-n.h:452
control how a packet is transmitted.
Definition: mac-low.h:218
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: edca-txop-n.cc:696
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:739
struct Bar m_currentBar
Definition: edca-txop-n.h:460
virtual void DoNotifyChannelSwitching(void)
Called by DcfManager to notify a DcfState subclass that a channel switching occured.
Definition: edca-txop-n.cc:65
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: edca-txop-n.cc:304
Handles sequence numbering of IEEE 802.11 data frames.
Definition: mac-tx-middle.h:39
virtual void DoNotifyCollision(void)
Called by DcfManager to notify a DcfState subclass that a normal collision occured, that is, that the medium was busy when access was requested.
Definition: edca-txop-n.cc:61
DcfManager * m_manager
Definition: edca-txop-n.h:431
void MissedAck(void)
Event handler when an ACK is received.
Definition: edca-txop-n.cc:617
enum TypeOfStation GetTypeOfStation(void) const
Return type of station.
Definition: edca-txop-n.cc:255
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:325
Ptr< MacLow > Low(void)
Return the MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:318
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
Definition: packet.cc:228
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Ptr< WifiRemoteStationManager > m_stationManager
Definition: edca-txop-n.h:440
This queue contains packets for a particular access class.
Definition: edca-txop-n.h:84
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
Definition: edca-txop-n.cc:903
virtual uint32_t GetSerializedSize(void) const
void SetQueue(Ptr< WifiMacQueue > queue)
void NotifyAccessGranted(void)
Notify the EDCAF that access has been granted.
Definition: edca-txop-n.cc:339
RandomStream * m_rng
Definition: edca-txop-n.h:439
void NotifyInternalCollision(void)
Notify the EDCAF that internal collision has occurred.
Definition: edca-txop-n.cc:504
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void UpdateAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
virtual void SetMinCw(uint32_t minCw)
Set the minimum congestion window size.
Definition: edca-txop-n.cc:269
void SendAddBaRequest(Mac48Address recipient, uint8_t tid, uint16_t startSeq, uint16_t timeout, bool immediateBAck)
Sends an ADDBARequest to establish a block ack agreement with sta addressed by recipient for tid tid...
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
virtual void GotAck(double snr, WifiMode txMode)
Definition: edca-txop-n.cc:90
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
Hold an unsigned integer type.
Definition: uinteger.h:46
void SetBlockAckThreshold(uint8_t threshold)
Set threshold for block ACK mechanism.
void NotifyAgreementUnsuccessful(Mac48Address recipient, uint8_t tid)
MacTxMiddle * m_txMiddle
Definition: edca-txop-n.h:436
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: edca-txop-n.cc:526
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:229
enum BlockAckActionValue blockAck
Definition: mgt-headers.h:417
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
bool IsQosBlockAck(void) const
Return if the QoS ACK policy is Block ACK.
Headers for Block ack response.
Definition: ctrl-headers.h:183
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1242
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
Definition: edca-txop-n.cc:551
void SetTxMiddle(MacTxMiddle *txMiddle)
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:133
void SetBlockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
Get the next fragment from the packet with appropriate Wifi header for the fragment.
Definition: edca-txop-n.cc:802
virtual ~EdcaTxopN()
Definition: edca-txop-n.cc:191
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: edca-txop-n.cc:106
uint8_t m_fragmentNumber
Definition: edca-txop-n.h:441
Time m_currentPacketTimestamp
Definition: edca-txop-n.h:458
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
Definition: dcf-manager.cc:84
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-manager.cc:62
virtual void GotCts(double snr, WifiMode txMode)
Definition: edca-txop-n.cc:82
Mac48Address recipient
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:277
void SetByOriginator(void)
Set the initiator bit in the DELBA.
EdcaTxopN * m_txop
Definition: edca-txop-n.cc:69
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
Definition: edca-txop-n.cc:290
void SetByRecipient(void)
Un-set the initiator bit in the DELBA.
void MissedBlockAck(void)
Event handler when a Block ACK timeout has occurred.
Definition: edca-txop-n.cc:644
void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
Definition: edca-txop-n.cc:750
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:109
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
bool NeedFragmentation(void) const
Check if the current packet should be fragmented.
Definition: edca-txop-n.cc:761
void EnableCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame.
Definition: mac-low.cc:113
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: edca-txop-n.cc:86
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Ptr< MsduAggregator > GetMsduAggregator(void) const
Definition: edca-txop-n.cc:658
hold objects of type Ptr
Definition: pointer.h:33
listen for block ack events.
Definition: mac-low.h:190
void SetAccessCategory(enum AcIndex ac)
Set the access category of this EDCAF.
Definition: edca-txop-n.cc:823
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:128
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Mac48Address MapDestAddressForAggregation(const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:846
bool ExistsAgreementInState(Mac48Address recipient, uint8_t tid, enum OriginatorBlockAckAgreement::State state) const
bool SetupBlockAckIfNeeded()
If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame is sent to...
Definition: edca-txop-n.cc:956
StatusCode GetStatusCode(void) const
Return the status code.
Definition: mgt-headers.cc:923
void StartNext(void)
Start transmission for the next fragment.
Definition: edca-txop-n.cc:719
an EUI-48 address
Definition: mac48-address.h:41
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is setted.
Ptr< const Packet > GetNextPacket(WifiMacHeader &hdr)
void Cancel(void)
Cancel the transmission.
Definition: edca-txop-n.cc:743
void SetManager(DcfManager *manager)
Set DcfManager this EdcaTxopN is associated to.
Definition: edca-txop-n.cc:220
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:143
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:559
void SetMsduAggregator(Ptr< MsduAggregator > aggr)
Definition: edca-txop-n.cc:862
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool > callback)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:929
void SetMaxPacketDelay(Time maxDelay)
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:869
bool SwitchToBlockAckIfNeeded(Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
enum BlockAckType m_blockAckType
Definition: edca-txop-n.h:457
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:68
virtual void DoNotifyAccessGranted(void)
Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start...
Definition: edca-txop-n.cc:53
static TypeId GetTypeId(void)
Definition: edca-txop-n.cc:144
BlockAckEventListener * m_blockAckListener
Definition: edca-txop-n.h:438
static TypeId GetTypeId(void)
Definition: dcf.cc:31
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
Definition: edca-txop-n.cc:777
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
bool IsData(void) const
Return true if the Type is DATA.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
Definition: mac-low.cc:138
void CompleteConfig(void)
Complete block ACK configuration.
uint32_t GetCw(void) const
Definition: dcf-manager.cc:118
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-manager.cc:74
void Unblock(Mac48Address dest, uint8_t tid)
Un-block the given destination address and TID (e.g.
void RestartAccessIfNeeded(void)
Restart access request if needed.
Definition: edca-txop-n.cc:664
void SetBlockAckThreshold(uint8_t nPackets)
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:582
QosBlockedDestinations * m_qosBlockedDestinations
Definition: edca-txop-n.h:451
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:698
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
Ptr< MacLow > m_low
Definition: edca-txop-n.h:435
typedef for union of different ActionValues
Definition: mgt-headers.h:410
Ptr< const Packet > bar
uint8_t GetBlockAckThreshold(void) const
Return the current threshold for block ACK mechanism.
friend class Dcf
Definition: edca-txop-n.h:427
void CompleteTx(void)
For now is typically invoked to complete transmission of a packets sent with ack policy Block Ack: th...
Definition: edca-txop-n.cc:940
bool IsSuccess(void) const
Return whether the status code is success.
Definition: status-code.cc:42
void SetTxMiddle(MacTxMiddle *txMiddle)
Definition: edca-txop-n.cc:311
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: edca-txop-n.cc:519
void EnableNextData(uint32_t size)
Definition: mac-low.cc:83
void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: edca-txop-n.cc:197
void DisableOverrideDurationId(void)
Do not force the duration/id field of the packet: its value is automatically calculated by the MacLow...
Definition: mac-low.cc:98
bool IsLastFragment(void) const
Check if the curren fragment is the last fragment.
Definition: edca-txop-n.cc:794
void Block(Mac48Address dest, uint8_t tid)
Block the given destination address and TID from sending (e.g.
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:88
virtual uint32_t GetMaxCw(void) const
Return the maximum congestion window size.
Definition: edca-txop-n.cc:297
Ptr< WifiMacQueue > m_queue
Definition: edca-txop-n.h:432
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: edca-txop-n.cc:676
void SetType(enum WifiMacType type)
Set Type/Subtype values with the correct values depending on the given type.
virtual uint32_t GetNext(uint32_t min, uint32_t max)=0
Get integer between min and max (including min and max).
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
bool NeedRts(void)
Check if the current packet should be sent with a RTS protection.
Definition: edca-txop-n.cc:688
tuple address
Definition: first.py:37
void SendBlockAckRequest(const struct Bar &bar)
After that all packets, for which a block ack agreement was established, have been transmitted...
Definition: edca-txop-n.cc:975
TypeOfStation
Enumeration for type of station.
Definition: edca-txop-n.h:59
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: dcf-manager.cc:95
Ptr< MsduAggregator > m_aggregator
Definition: edca-txop-n.h:449
Manages all block ack agreements for an originator station.
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:535
bool ExistsAgreement(Mac48Address recipient, uint8_t tid) const
virtual void DoNotifyInternalCollision(void)
Called by DcfManager to notify a DcfState subclass that an 'internal' collision occured, that is, that the backoff timer of a higher priority DcfState expired at the same time and that access was granted to this higher priority DcfState.
Definition: edca-txop-n.cc:57
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
void DisableAck(void)
Do not wait for Ack after data transmission.
Definition: mac-low.cc:133
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this EdcaTxopN.
Definition: edca-txop-n.cc:262
uint16_t GetNextSeqNumberByTidAndAddress(uint8_t tid, Mac48Address addr) const
Return the next sequence number for the Traffic ID and destination.
a unique identifier for an interface.
Definition: type-id.h:49
bool NeedsAccess(void) const
Check if the EDCAF requires access.
Definition: edca-txop-n.cc:332
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
void SetQosAmsdu(void)
Set that A-MSDU is present.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:35
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: edca-txop-n.cc:785
void NotifyMpduTransmission(Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber)
bool IsRetry(void) const
Return if the Retry bit is set.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:253
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:342
Implements the IEEE 802.11 MAC header.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
Definition: edca-txop-n.cc:881
void TearDownBlockAck(Mac48Address recipient, uint8_t tid)
Implements the IEEE 802.11 MAC trailer.
virtual void SetAifsn(uint32_t aifsn)
Definition: edca-txop-n.cc:283
TypeOfStation m_typeOfStation
Definition: edca-txop-n.h:450
Mac48Address MapSrcAddressForAggregation(const WifiMacHeader &hdr)
This functions are used only to correctly set addresses in a-msdu subframe.
Definition: edca-txop-n.cc:830
virtual uint32_t GetSerializedSize(void) const
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source)
Definition: edca-txop-n.cc:98
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Dcf(EdcaTxopN *txop)
Definition: edca-txop-n.cc:48