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  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #include "ns3/log.h"
24 #include "ns3/assert.h"
25 #include "ns3/pointer.h"
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 "mpdu-aggregator.h"
36 #include "mgt-headers.h"
38 
39 #undef NS_LOG_APPEND_CONTEXT
40 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
41 
42 namespace ns3 {
43 
44 NS_LOG_COMPONENT_DEFINE ("EdcaTxopN");
45 
46 class EdcaTxopN::Dcf : public DcfState
47 {
48 public:
49  Dcf (EdcaTxopN * txop)
50  : m_txop (txop)
51  {
52  }
53 
54  virtual bool IsEdca (void) const
55  {
56  return true;
57  }
58 
59 private:
60  virtual void DoNotifyAccessGranted (void)
61  {
63  }
64  virtual void DoNotifyInternalCollision (void)
65  {
67  }
68  virtual void DoNotifyCollision (void)
69  {
71  }
72  virtual void DoNotifyChannelSwitching (void)
73  {
75  }
76  virtual void DoNotifySleep (void)
77  {
78  m_txop->NotifySleep ();
79  }
80  virtual void DoNotifyWakeUp (void)
81  {
82  m_txop->NotifyWakeUp ();
83  }
84 
86 };
87 
88 
90 {
91 public:
94  m_txop (txop)
95  {
96  }
97 
99  {
100  }
101 
102  virtual void GotCts (double snr, WifiMode txMode)
103  {
104  m_txop->GotCts (snr, txMode);
105  }
106  virtual void MissedCts (void)
107  {
108  m_txop->MissedCts ();
109  }
110  virtual void GotAck (double snr, WifiMode txMode)
111  {
112  m_txop->GotAck (snr, txMode);
113  }
114  virtual void MissedAck (void)
115  {
116  m_txop->MissedAck ();
117  }
118  virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, double rxSnr, WifiMode txMode, double dataSnr)
119  {
120  m_txop->GotBlockAck (blockAck, source, rxSnr, txMode, dataSnr);
121  }
122  virtual void MissedBlockAck (uint32_t nMpdus)
123  {
124  m_txop->MissedBlockAck (nMpdus);
125  }
126  virtual void StartNext (void)
127  {
128  m_txop->StartNext ();
129  }
130  virtual void Cancel (void)
131  {
132  m_txop->Cancel ();
133  }
134  virtual void EndTxNoAck (void)
135  {
136  m_txop->EndTxNoAck ();
137  }
139  {
140  return m_txop->GetEdcaQueue ();
141  }
142 
143 private:
145 };
146 
147 
149 {
150 public:
153  m_txop (txop)
154  {
155  }
157  {
158  }
159 
160  virtual void BlockAckInactivityTimeout (Mac48Address address, uint8_t tid)
161  {
162  m_txop->SendDelbaFrame (address, tid, false);
163  }
165  {
166  return m_txop->GetEdcaQueue ();
167  }
168  virtual void CompleteTransfer (Mac48Address recipient, uint8_t tid)
169  {
170  m_txop->CompleteAmpduTransfer (recipient, tid);
171  }
172  virtual void SetAmpdu (Mac48Address dest, bool enableAmpdu)
173  {
174  return m_txop->SetAmpduExist (dest, enableAmpdu);
175  }
176  virtual void CompleteMpduTx (Ptr<const Packet> packet, WifiMacHeader hdr, Time tstamp)
177  {
178  m_txop->CompleteMpduTx (packet, hdr, tstamp);
179  }
180  virtual uint16_t GetNextSequenceNumberfor (WifiMacHeader *hdr)
181  {
182  return m_txop->GetNextSequenceNumberfor (hdr);
183  }
184  virtual uint16_t PeekNextSequenceNumberfor (WifiMacHeader *hdr)
185  {
186  return m_txop->PeekNextSequenceNumberfor (hdr);
187  }
188  virtual Ptr<const Packet> PeekNextPacketInBaQueue (WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp)
189  {
190  return m_txop->PeekNextRetransmitPacket (header, recipient, tid, timestamp);
191  }
192  virtual void RemoveFromBaQueue (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
193  {
194  m_txop->RemoveRetransmitPacket (tid, recipient, seqnumber);
195  }
196  virtual bool GetBlockAckAgreementExists (Mac48Address address, uint8_t tid)
197  {
198  return m_txop->GetBaAgreementExists (address,tid);
199  }
200  virtual uint32_t GetNOutstandingPackets (Mac48Address address, uint8_t tid)
201  {
202  return m_txop->GetNOutstandingPacketsInBa (address, tid);
203  }
204  virtual uint32_t GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
205  {
206  return m_txop->GetNRetryNeededPackets (recipient, tid);
207  }
209  {
210  return m_txop->GetMsduAggregator ();
211  }
213  {
214  return m_txop->GetMpduAggregator ();
215  }
217  {
218  return m_txop->MapSrcAddressForAggregation (hdr);
219  }
221  {
222  return m_txop->MapDestAddressForAggregation (hdr);
223  }
224 
225 private:
227 };
228 
230 
231 TypeId
233 {
234  static TypeId tid = TypeId ("ns3::EdcaTxopN")
235  .SetParent<ns3::Dcf> ()
236  .SetGroupName ("Wifi")
237  .AddConstructor<EdcaTxopN> ()
238  .AddAttribute ("Queue",
239  "The WifiMacQueue object",
240  PointerValue (),
242  MakePointerChecker<WifiMacQueue> ())
243  .AddTraceSource ("BackoffTrace",
244  "Trace source for backoff values",
246  "ns3::TracedValue::Uint32Callback")
247  .AddTraceSource ("CwTrace",
248  "Trace source for contention window values",
250  "ns3::TracedValue::Uint32Callback")
251  ;
252  return tid;
253 }
254 
256  : m_manager (0),
257  m_currentPacket (0),
258  m_msduAggregator (0),
259  m_mpduAggregator (0),
260  m_typeOfStation (STA),
261  m_blockAckType (COMPRESSED_BLOCK_ACK)
262 {
263  NS_LOG_FUNCTION (this);
266  m_dcf = new EdcaTxopN::Dcf (this);
267  m_queue = CreateObject<WifiMacQueue> ();
268  m_rng = new RealRandomStream ();
270  m_baManager = new BlockAckManager ();
275  m_baManager->SetMaxPacketDelay (m_queue->GetMaxDelay ());
278 }
279 
281 {
282  NS_LOG_FUNCTION (this);
283 }
284 
285 void
287 {
288  NS_LOG_FUNCTION (this);
289  m_queue = 0;
290  m_low = 0;
291  m_stationManager = 0;
292  delete m_transmissionListener;
293  delete m_dcf;
294  delete m_rng;
296  delete m_baManager;
297  delete m_blockAckListener;
299  m_dcf = 0;
300  m_rng = 0;
302  m_baManager = 0;
303  m_blockAckListener = 0;
304  m_txMiddle = 0;
305  m_msduAggregator = 0;
306  m_mpduAggregator = 0;
307 }
308 
309 bool
311 {
312  return m_baManager->ExistsAgreement (address, tid);
313 }
314 
315 uint32_t
317 {
318  return m_baManager->GetNBufferedPackets (address, tid);
319 }
320 
321 uint32_t
322 EdcaTxopN::GetNRetryNeededPackets (Mac48Address recipient, uint8_t tid) const
323 {
324  return m_baManager->GetNRetryNeededPackets (recipient, tid);
325 }
326 
327 void
329 {
330  m_baManager->CompleteAmpduExchange (recipient, tid);
331 }
332 
333 void
335 {
336  NS_LOG_FUNCTION (this << manager);
337  m_manager = manager;
338  m_manager->Add (m_dcf);
339 }
340 
341 void
343 {
344  NS_LOG_FUNCTION (this << &callback);
345  m_txOkCallback = callback;
346 }
347 
348 void
350 {
351  NS_LOG_FUNCTION (this << &callback);
352  m_txFailedCallback = callback;
353 }
354 
355 void
357 {
358  NS_LOG_FUNCTION (this << remoteManager);
359  m_stationManager = remoteManager;
361 }
362 
363 void
365 {
366  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
367  m_typeOfStation = type;
368 }
369 
370 enum TypeOfStation
372 {
373  NS_LOG_FUNCTION (this);
374  return m_typeOfStation;
375 }
376 
379 {
380  NS_LOG_FUNCTION (this);
381  return m_queue;
382 }
383 
384 void
385 EdcaTxopN::SetMinCw (uint32_t minCw)
386 {
387  NS_LOG_FUNCTION (this << minCw);
388  m_dcf->SetCwMin (minCw);
389 }
390 
391 void
392 EdcaTxopN::SetMaxCw (uint32_t maxCw)
393 {
394  NS_LOG_FUNCTION (this << maxCw);
395  m_dcf->SetCwMax (maxCw);
396 }
397 
398 void
399 EdcaTxopN::SetAifsn (uint32_t aifsn)
400 {
401  NS_LOG_FUNCTION (this << aifsn);
402  m_dcf->SetAifsn (aifsn);
403 }
404 
405 uint32_t
407 {
408  NS_LOG_FUNCTION (this);
409  return m_dcf->GetCwMin ();
410 }
411 
412 uint32_t
414 {
415  NS_LOG_FUNCTION (this);
416  return m_dcf->GetCwMax ();
417 }
418 
419 uint32_t
421 {
422  NS_LOG_FUNCTION (this);
423  return m_dcf->GetAifsn ();
424 }
425 
426 void
428 {
429  NS_LOG_FUNCTION (this << txMiddle);
430  m_txMiddle = txMiddle;
431 }
432 
435 {
436  NS_LOG_FUNCTION (this);
437  return m_low;
438 }
439 
440 void
442 {
443  NS_LOG_FUNCTION (this << low);
444  m_low = low;
445 }
446 
447 bool
449 {
450  NS_LOG_FUNCTION (this);
451  return !m_queue->IsEmpty () || m_currentPacket != 0 || m_baManager->HasPackets ();
452 }
453 
455 {
456  return m_txMiddle->GetNextSequenceNumberfor (hdr);
457 }
458 
460 {
462 }
463 
465 EdcaTxopN::PeekNextRetransmitPacket (WifiMacHeader &header,Mac48Address recipient, uint8_t tid, Time *timestamp)
466 {
467  return m_baManager->PeekNextPacket (header,recipient,tid, timestamp);
468 }
469 
470 void
471 EdcaTxopN::RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
472 {
473  m_baManager->RemovePacket (tid, recipient, seqnumber);
474 }
475 
476 void
478 {
479  NS_LOG_FUNCTION (this);
480  if (m_currentPacket == 0)
481  {
482  if (m_queue->IsEmpty () && !m_baManager->HasPackets ())
483  {
484  NS_LOG_DEBUG ("queue is empty");
485  return;
486  }
488  {
490  return;
491  }
492  /* check if packets need retransmission are stored in BlockAckManager */
494  if (m_currentPacket == 0)
495  {
496  if (m_queue->PeekFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations) == 0)
497  {
498  NS_LOG_DEBUG ("no available packets in the queue");
499  return;
500  }
503  && SetupBlockAckIfNeeded ())
504  {
505  return;
506  }
508  NS_ASSERT (m_currentPacket != 0);
509 
510  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
511  m_currentHdr.SetSequenceNumber (sequence);
516  m_fragmentNumber = 0;
517  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
518  ", to=" << m_currentHdr.GetAddr1 () <<
519  ", seq=" << m_currentHdr.GetSequenceControl ());
521  {
522  VerifyBlockAck ();
523  }
524  }
525  }
527  params.DisableOverrideDurationId ();
528  if (m_currentHdr.GetAddr1 ().IsGroup ())
529  {
530  params.DisableRts ();
531  params.DisableAck ();
532  params.DisableNextData ();
534  &m_currentHdr,
535  params,
537 
538  NS_LOG_DEBUG ("tx broadcast");
539  }
541  {
543  }
544  else
545  {
547  {
548  params.DisableAck ();
549  }
550  else
551  {
552  params.EnableAck ();
553  }
557  && NeedFragmentation ())
558  {
559  //With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
560  params.DisableRts ();
561  WifiMacHeader hdr;
562  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
563  if (IsLastFragment ())
564  {
565  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
566  params.DisableNextData ();
567  }
568  else
569  {
570  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
572  }
573  m_low->StartTransmission (fragment, &hdr, params,
575  }
576  else
577  {
578  WifiMacHeader peekedHdr;
579  Time tstamp;
580  if (m_currentHdr.IsQosData ()
581  && m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
584  && m_msduAggregator != 0 && !m_currentHdr.IsRetry ())
585  {
586  /* here is performed aggregation */
587  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
588  m_msduAggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
589  MapSrcAddressForAggregation (peekedHdr),
590  MapDestAddressForAggregation (peekedHdr));
591  bool aggregated = false;
592  bool isAmsdu = false;
593  Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
595  m_currentHdr.GetAddr1 (), &tstamp);
596  while (peekedPacket != 0)
597  {
598  aggregated = m_msduAggregator->Aggregate (peekedPacket, currentAggregatedPacket,
599  MapSrcAddressForAggregation (peekedHdr),
600  MapDestAddressForAggregation (peekedHdr));
601  if (aggregated)
602  {
603  isAmsdu = true;
604  m_queue->Remove (peekedPacket);
605  }
606  else
607  {
608  break;
609  }
610  peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
612  }
613  if (isAmsdu)
614  {
617  m_currentPacket = currentAggregatedPacket;
618  currentAggregatedPacket = 0;
619  NS_LOG_DEBUG ("tx unicast A-MSDU");
620  }
621  }
622  params.DisableNextData ();
624  params, m_transmissionListener);
626  {
627  CompleteTx ();
628  }
629  }
630  }
631 }
632 
634 {
635  NS_LOG_FUNCTION (this);
636  NotifyCollision ();
637 }
638 
639 void
641 {
642  NS_LOG_FUNCTION (this);
643  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
646 }
647 
648 void
649 EdcaTxopN::GotCts (double snr, WifiMode txMode)
650 {
651  NS_LOG_FUNCTION (this << snr << txMode);
652  NS_LOG_DEBUG ("got cts");
653 }
654 
655 uint8_t
657 {
658  NS_LOG_FUNCTION (this);
659  if (m_currentHdr.IsQosData ())
660  {
661  return m_currentHdr.GetQosTid ();
662  }
663  else if (m_currentHdr.IsBlockAckReq ())
664  {
665  CtrlBAckRequestHeader baReqHdr;
666  m_currentPacket->PeekHeader (baReqHdr);
667  return baReqHdr.GetTidInfo ();
668  }
669  else if (m_currentHdr.IsBlockAck ())
670  {
671  CtrlBAckResponseHeader baRespHdr;
672  m_currentPacket->PeekHeader (baRespHdr);
673  return baRespHdr.GetTidInfo ();
674  }
675  else if (m_currentHdr.IsMgt () && m_currentHdr.IsAction ())
676  {
677  Ptr<Packet> packet = m_currentPacket->Copy ();
678  WifiActionHeader actionHdr;
679  packet->RemoveHeader (actionHdr);
680 
681  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK)
682  {
683  switch (actionHdr.GetAction ().blockAck)
684  {
686  {
687  MgtAddBaResponseHeader reqHdr;
688  packet->RemoveHeader (reqHdr);
689  return reqHdr.GetTid ();
690  }
692  {
693  MgtAddBaResponseHeader respHdr;
694  packet->RemoveHeader (respHdr);
695  return respHdr.GetTid ();
696  }
698  {
699  MgtDelBaHeader delHdr;
700  packet->RemoveHeader (delHdr);
701  return delHdr.GetTid ();
702  }
703  default:
704  {
705  NS_FATAL_ERROR ("Don't know how to extract Traffic ID from this BA action frame");
706  }
707  }
708  }
709  else
710  {
711  NS_FATAL_ERROR ("Don't know how to extract Traffic ID from this action frame");
712  }
713  }
714  else
715  {
716  NS_FATAL_ERROR ("Current packet has no Traffic ID");
717  }
718 }
719 
720 void
722 {
723  NS_LOG_FUNCTION (this);
724  NS_LOG_DEBUG ("missed cts");
725  if (!NeedRtsRetransmission ())
726  {
727  NS_LOG_DEBUG ("Cts Fail");
728  bool resetCurrentPacket = true;
730  if (!m_txFailedCallback.IsNull ())
731  {
733  }
735  {
737  uint8_t tid = GetCurrentTid ();
738 
740  {
741  NS_LOG_DEBUG ("Transmit Block Ack Request");
742  CtrlBAckRequestHeader reqHdr;
743  reqHdr.SetType (COMPRESSED_BLOCK_ACK);
745  reqHdr.SetTidInfo (tid);
746  reqHdr.SetHtImmediateAck (true);
747  Ptr<Packet> bar = Create<Packet> ();
748  bar->AddHeader (reqHdr);
749  Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
750  m_currentBar = request;
751  WifiMacHeader hdr;
753  hdr.SetAddr1 (request.recipient);
754  hdr.SetAddr2 (m_low->GetAddress ());
755  hdr.SetAddr3 (m_low->GetBssid ());
756  hdr.SetDsNotTo ();
757  hdr.SetDsNotFrom ();
758  hdr.SetNoRetry ();
759  hdr.SetNoMoreFragments ();
760  m_currentPacket = request.bar;
761  m_currentHdr = hdr;
762  resetCurrentPacket = false;
763  }
764  }
765  //to reset the dcf.
766  if (resetCurrentPacket == true)
767  {
768  m_currentPacket = 0;
769  }
770  m_dcf->ResetCw ();
771  m_cwTrace = m_dcf->GetCw ();
772  }
773  else
774  {
775  m_dcf->UpdateFailedCw ();
776  m_cwTrace = m_dcf->GetCw ();
777  }
778  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
781 }
782 
783 void
785 {
786  NS_LOG_FUNCTION (this);
787  m_queue->Flush ();
788  m_currentPacket = 0;
789 }
790 
791 void
793 {
794  NS_LOG_FUNCTION (this);
795  if (m_currentPacket != 0)
796  {
797  m_queue->PushFront (m_currentPacket, m_currentHdr);
798  m_currentPacket = 0;
799  }
800 }
801 
802 void
804 {
805  NS_LOG_FUNCTION (this);
807 }
808 
809 void
811 {
812  NS_LOG_FUNCTION (this << packet << &hdr);
813  WifiMacTrailer fcs;
814  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet);
815  m_queue->Enqueue (packet, hdr);
817 }
818 
819 void
820 EdcaTxopN::GotAck (double snr, WifiMode txMode)
821 {
822  NS_LOG_FUNCTION (this << snr << txMode);
823  if (!NeedFragmentation ()
824  || IsLastFragment ()
825  || m_currentHdr.IsQosAmsdu ())
826  {
827  NS_LOG_DEBUG ("got ack. tx done.");
828  if (!m_txOkCallback.IsNull ())
829  {
831  }
832 
833  if (m_currentHdr.IsAction ())
834  {
835  WifiActionHeader actionHdr;
837  p->RemoveHeader (actionHdr);
838  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK
840  {
841  MgtDelBaHeader delBa;
842  p->PeekHeader (delBa);
843  if (delBa.IsByOriginator ())
844  {
846  }
847  else
848  {
850  }
851  }
852  }
853  m_currentPacket = 0;
854 
855  m_dcf->ResetCw ();
856  m_cwTrace = m_dcf->GetCw ();
857  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
860  }
861  else
862  {
863  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
864  }
865 }
866 
867 void
869 {
870  NS_LOG_FUNCTION (this);
871  NS_LOG_DEBUG ("missed ack");
872  if (!NeedDataRetransmission ())
873  {
874  NS_LOG_DEBUG ("Ack Fail");
876  bool resetCurrentPacket = true;
877  if (!m_txFailedCallback.IsNull ())
878  {
880  }
882  {
883  uint8_t tid = GetCurrentTid ();
884 
886  {
887  //send Block ACK Request in order to shift WinStart at the receiver
888  NS_LOG_DEBUG ("Transmit Block Ack Request");
889  CtrlBAckRequestHeader reqHdr;
890  reqHdr.SetType (COMPRESSED_BLOCK_ACK);
892  reqHdr.SetTidInfo (tid);
893  reqHdr.SetHtImmediateAck (true);
894  Ptr<Packet> bar = Create<Packet> ();
895  bar->AddHeader (reqHdr);
896  Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
897  m_currentBar = request;
898  WifiMacHeader hdr;
900  hdr.SetAddr1 (request.recipient);
901  hdr.SetAddr2 (m_low->GetAddress ());
902  hdr.SetAddr3 (m_low->GetBssid ());
903  hdr.SetDsNotTo ();
904  hdr.SetDsNotFrom ();
905  hdr.SetNoRetry ();
906  hdr.SetNoMoreFragments ();
907  m_currentPacket = request.bar;
908  m_currentHdr = hdr;
909  resetCurrentPacket = false;
910  }
911  }
912  //to reset the dcf.
913  if (resetCurrentPacket == true)
914  {
915  m_currentPacket = 0;
916  }
917  m_dcf->ResetCw ();
918  m_cwTrace = m_dcf->GetCw ();
919  }
920  else
921  {
922  NS_LOG_DEBUG ("Retransmit");
924  m_dcf->UpdateFailedCw ();
925  m_cwTrace = m_dcf->GetCw ();
926  }
927  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
930 }
931 
932 void
933 EdcaTxopN::MissedBlockAck (uint32_t nMpdus)
934 {
935  NS_LOG_FUNCTION (this);
936  NS_LOG_DEBUG ("missed block ack");
937  uint8_t tid = GetCurrentTid ();
939  {
940  m_stationManager->ReportAmpduTxStatus (m_currentHdr.GetAddr1 (), tid, 0, nMpdus, 0, 0);
941  }
942  if (NeedBarRetransmission ())
943  {
945  {
946  //should i report this to station addressed by ADDR1?
947  NS_LOG_DEBUG ("Retransmit block ack request");
949  }
950  else
951  {
952  //standard says when loosing a BlockAck originator may send a BAR page 139
953  NS_LOG_DEBUG ("Transmit Block Ack Request");
954  CtrlBAckRequestHeader reqHdr;
955  reqHdr.SetType (COMPRESSED_BLOCK_ACK);
956  if (m_currentHdr.IsQosData ())
957  {
959  }
960  else if (m_currentHdr.IsBlockAckReq ())
961  {
962  CtrlBAckRequestHeader baReqHdr;
963  m_currentPacket->PeekHeader (baReqHdr);
964  reqHdr.SetStartingSequence (baReqHdr.GetStartingSequence ());
965  }
966  else if (m_currentHdr.IsBlockAck ())
967  {
968  CtrlBAckResponseHeader baRespHdr;
969  m_currentPacket->PeekHeader (baRespHdr);
971  }
972  reqHdr.SetTidInfo (tid);
973  reqHdr.SetHtImmediateAck (true);
974  Ptr<Packet> bar = Create<Packet> ();
975  bar->AddHeader (reqHdr);
976  Bar request (bar, m_currentHdr.GetAddr1 (), tid, reqHdr.MustSendHtImmediateAck ());
977  m_currentBar = request;
978  WifiMacHeader hdr;
980  hdr.SetAddr1 (request.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 = request.bar;
989  m_currentHdr = hdr;
990  }
991  m_dcf->UpdateFailedCw ();
992  m_cwTrace = m_dcf->GetCw ();
993  }
994  else
995  {
996  NS_LOG_DEBUG ("Block Ack Request Fail");
997  //to reset the dcf.
998  m_currentPacket = 0;
999  m_dcf->ResetCw ();
1000  m_cwTrace = m_dcf->GetCw ();
1001  }
1002  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
1005 }
1006 
1009 {
1010  return m_msduAggregator;
1011 }
1012 
1015 {
1016  return m_mpduAggregator;
1017 }
1018 
1019 void
1021 {
1022  NS_LOG_FUNCTION (this);
1023  if ((m_currentPacket != 0
1024  || !m_queue->IsEmpty () || m_baManager->HasPackets ())
1025  && !m_dcf->IsAccessRequested ())
1026  {
1028  }
1029 }
1030 
1031 void
1033 {
1034  NS_LOG_FUNCTION (this);
1035  if (m_currentPacket == 0
1036  && (!m_queue->IsEmpty () || m_baManager->HasPackets ())
1037  && !m_dcf->IsAccessRequested ())
1038  {
1040  }
1041 }
1042 
1043 bool
1045 {
1046  NS_LOG_FUNCTION (this);
1048  m_currentPacket);
1049 }
1050 
1051 bool
1053 {
1054  NS_LOG_FUNCTION (this);
1056  m_currentPacket);
1057 }
1058 
1059 bool
1061 {
1062  uint8_t tid = 0;
1063  uint16_t seqNumber = 0;
1064  if (m_currentHdr.IsQosData ())
1065  {
1066  tid = m_currentHdr.GetQosTid ();
1067  seqNumber = m_currentHdr.GetSequenceNumber ();
1068  }
1069  else if (m_currentHdr.IsBlockAckReq ())
1070  {
1071  CtrlBAckRequestHeader baReqHdr;
1072  m_currentPacket->PeekHeader (baReqHdr);
1073  tid = baReqHdr.GetTidInfo ();
1074  seqNumber = baReqHdr.GetStartingSequence ();
1075  }
1076  else if (m_currentHdr.IsBlockAck ())
1077  {
1078  CtrlBAckResponseHeader baRespHdr;
1079  m_currentPacket->PeekHeader (baRespHdr);
1080  tid = baRespHdr.GetTidInfo ();
1081  seqNumber = m_currentHdr.GetSequenceNumber ();
1082  }
1083  return m_baManager->NeedBarRetransmission (tid, seqNumber, m_currentHdr.GetAddr1 ());
1084 }
1085 
1086 void
1088 {
1089  NS_LOG_FUNCTION (this);
1090  m_fragmentNumber++;
1091 }
1092 
1093 void
1095 {
1096  NS_LOG_FUNCTION (this);
1097  NS_LOG_DEBUG ("start next packet fragment");
1098  /* this callback is used only for fragments. */
1099  NextFragment ();
1100  WifiMacHeader hdr;
1101  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
1103  params.EnableAck ();
1104  params.DisableRts ();
1105  params.DisableOverrideDurationId ();
1106  if (IsLastFragment ())
1107  {
1108  params.DisableNextData ();
1109  }
1110  else
1111  {
1112  params.EnableNextData (GetNextFragmentSize ());
1113  }
1114  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
1115 }
1116 
1117 void
1119 {
1120  NS_LOG_FUNCTION (this);
1121  NS_LOG_DEBUG ("transmission cancelled");
1122 }
1123 
1124 void
1126 {
1127  NS_LOG_FUNCTION (this);
1128  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
1129  m_currentPacket = 0;
1130  m_dcf->ResetCw ();
1131  m_cwTrace = m_dcf->GetCw ();
1132  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
1135 }
1136 
1137 bool
1139 {
1140  NS_LOG_FUNCTION (this);
1142  m_currentPacket);
1143 }
1144 
1145 uint32_t
1147 {
1148  NS_LOG_FUNCTION (this);
1151 }
1152 
1153 uint32_t
1155 {
1156  NS_LOG_FUNCTION (this);
1159 }
1160 
1161 uint32_t
1163 {
1164  NS_LOG_FUNCTION (this);
1167 }
1168 
1169 
1170 bool
1172 {
1173  NS_LOG_FUNCTION (this);
1176 }
1177 
1180 {
1181  NS_LOG_FUNCTION (this << hdr);
1182  *hdr = m_currentHdr;
1184  uint32_t startOffset = GetFragmentOffset ();
1185  Ptr<Packet> fragment;
1186  if (IsLastFragment ())
1187  {
1188  hdr->SetNoMoreFragments ();
1189  }
1190  else
1191  {
1192  hdr->SetMoreFragments ();
1193  }
1194  fragment = m_currentPacket->CreateFragment (startOffset,
1195  GetFragmentSize ());
1196  return fragment;
1197 }
1198 
1199 void
1201 {
1202  NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
1203  m_ac = ac;
1204 }
1205 
1208 {
1209  NS_LOG_FUNCTION (this << &hdr);
1210  Mac48Address retval;
1212  {
1213  retval = hdr.GetAddr2 ();
1214  }
1215  else
1216  {
1217  retval = hdr.GetAddr3 ();
1218  }
1219  return retval;
1220 }
1221 
1224 {
1225  NS_LOG_FUNCTION (this << &hdr);
1226  Mac48Address retval;
1228  {
1229  retval = hdr.GetAddr1 ();
1230  }
1231  else
1232  {
1233  retval = hdr.GetAddr3 ();
1234  }
1235  return retval;
1236 }
1237 
1238 void
1240 {
1241  NS_LOG_FUNCTION (this << aggr);
1242  m_msduAggregator = aggr;
1243 }
1244 
1245 void
1247 {
1248  NS_LOG_FUNCTION (this << aggr);
1249  m_mpduAggregator = aggr;
1250 }
1251 
1252 void
1254 {
1255  NS_LOG_FUNCTION (this << packet << &hdr);
1256  WifiMacTrailer fcs;
1257  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet);
1258  m_queue->PushFront (packet, hdr);
1260 }
1261 
1262 void
1264 {
1265  NS_LOG_FUNCTION (this << respHdr << recipient);
1266  NS_LOG_DEBUG ("received ADDBA response from " << recipient);
1267  uint8_t tid = respHdr->GetTid ();
1269  {
1270  if (respHdr->GetStatusCode ().IsSuccess ())
1271  {
1272  NS_LOG_DEBUG ("block ack agreement established with " << recipient);
1273  m_baManager->UpdateAgreement (respHdr, recipient);
1274  }
1275  else
1276  {
1277  NS_LOG_DEBUG ("discard ADDBA response" << recipient);
1278  m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
1279  }
1280  }
1282 }
1283 
1284 void
1286 {
1287  NS_LOG_FUNCTION (this << delBaHdr << recipient);
1288  NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
1289  m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
1290 }
1291 
1292 void
1293 EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
1294 {
1295  NS_LOG_FUNCTION (this << blockAck << recipient << rxSnr << txMode.GetUniqueName () << dataSnr);
1296  NS_LOG_DEBUG ("got block ack from=" << recipient);
1297  m_baManager->NotifyGotBlockAck (blockAck, recipient, rxSnr, txMode, dataSnr);
1298  if (!m_txOkCallback.IsNull ())
1299  {
1301  }
1302  m_currentPacket = 0;
1303  m_dcf->ResetCw ();
1304  m_cwTrace = m_dcf->GetCw ();
1305  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
1308 }
1309 
1310 void
1312 {
1313  NS_LOG_FUNCTION (this);
1314  uint8_t tid = m_currentHdr.GetQosTid ();
1315  Mac48Address recipient = m_currentHdr.GetAddr1 ();
1316  uint16_t sequence = m_currentHdr.GetSequenceNumber ();
1318  {
1319  m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
1320  }
1322  {
1324  }
1325 }
1326 
1328 {
1329  NS_LOG_FUNCTION (this << dest);
1330  if (m_aMpduEnabled.find (dest) != m_aMpduEnabled.end ())
1331  {
1332  return m_aMpduEnabled.find (dest)->second;
1333  }
1334  return false;
1335 }
1336 
1337 void EdcaTxopN::SetAmpduExist (Mac48Address dest, bool enableAmpdu)
1338 {
1339  NS_LOG_FUNCTION (this << dest << enableAmpdu);
1340  if (m_aMpduEnabled.find (dest) != m_aMpduEnabled.end () && m_aMpduEnabled.find (dest)->second != enableAmpdu)
1341  {
1342  m_aMpduEnabled.erase (m_aMpduEnabled.find (dest));
1343  }
1344  if (m_aMpduEnabled.find (dest) == m_aMpduEnabled.end ())
1345  {
1346  m_aMpduEnabled.insert (std::make_pair (dest, enableAmpdu));
1347  }
1348 }
1349 
1350 void
1352 {
1353  NS_LOG_FUNCTION (this);
1355  {
1356  if (!m_currentHdr.IsRetry ())
1357  {
1359  }
1363  }
1364 }
1365 
1366 void
1368 {
1369  NS_ASSERT (hdr.IsQosData ());
1370  m_baManager->StorePacket (packet, hdr, tstamp);
1374 }
1375 
1376 bool
1378 {
1379  NS_LOG_FUNCTION (this);
1380  uint8_t tid = m_currentHdr.GetQosTid ();
1381  Mac48Address recipient = m_currentHdr.GetAddr1 ();
1382 
1383  uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient);
1384 
1385  if ((m_blockAckThreshold > 0 && packets >= m_blockAckThreshold) || (packets > 1 && m_mpduAggregator != 0) || m_stationManager->HasVhtSupported ())
1386  {
1387  /* Block ack setup */
1388  uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
1389  SendAddBaRequest (recipient, tid, startingSequence, m_blockAckInactivityTimeout, true);
1390  return true;
1391  }
1392  return false;
1393 }
1394 
1395 void
1397 {
1398  NS_LOG_FUNCTION (this << &bar);
1399  WifiMacHeader hdr;
1401  hdr.SetAddr1 (bar.recipient);
1402  hdr.SetAddr2 (m_low->GetAddress ());
1403  hdr.SetAddr3 (m_low->GetBssid ());
1404  hdr.SetDsNotTo ();
1405  hdr.SetDsNotFrom ();
1406  hdr.SetNoRetry ();
1407  hdr.SetNoMoreFragments ();
1408 
1409  m_currentPacket = bar.bar;
1410  m_currentHdr = hdr;
1411 
1413  params.DisableRts ();
1414  params.DisableNextData ();
1415  params.DisableOverrideDurationId ();
1416  if (bar.immediate)
1417  {
1419  {
1420  params.EnableBasicBlockAck ();
1421  }
1423  {
1424  params.EnableCompressedBlockAck ();
1425  }
1426  else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
1427  {
1428  NS_FATAL_ERROR ("Multi-tid block ack is not supported");
1429  }
1430  }
1431  else
1432  {
1433  //Delayed block ack
1434  params.EnableAck ();
1435  }
1437 }
1438 
1439 void
1441 {
1442  NS_LOG_FUNCTION (this);
1446 }
1447 
1448 void
1450 {
1451  NS_LOG_FUNCTION (this << static_cast<uint32_t> (threshold));
1452  m_blockAckThreshold = threshold;
1453  m_baManager->SetBlockAckThreshold (threshold);
1454 }
1455 
1456 void
1458 {
1459  NS_LOG_FUNCTION (this << timeout);
1461 }
1462 
1463 uint8_t
1465 {
1466  NS_LOG_FUNCTION (this);
1467  return m_blockAckThreshold;
1468 }
1469 
1470 void
1471 EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
1472  uint16_t timeout, bool immediateBAck)
1473 {
1474  NS_LOG_FUNCTION (this << dest << static_cast<uint32_t> (tid) << startSeq << timeout << immediateBAck);
1475  NS_LOG_DEBUG ("sent ADDBA request to " << dest);
1476  WifiMacHeader hdr;
1477  hdr.SetAction ();
1478  hdr.SetAddr1 (dest);
1479  hdr.SetAddr2 (m_low->GetAddress ());
1480  hdr.SetAddr3 (m_low->GetAddress ());
1481  hdr.SetDsNotTo ();
1482  hdr.SetDsNotFrom ();
1483 
1484  WifiActionHeader actionHdr;
1487  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1488 
1489  Ptr<Packet> packet = Create<Packet> ();
1490  /*Setting ADDBARequest header*/
1491  MgtAddBaRequestHeader reqHdr;
1492  reqHdr.SetAmsduSupport (true);
1493  if (immediateBAck)
1494  {
1495  reqHdr.SetImmediateBlockAck ();
1496  }
1497  else
1498  {
1499  reqHdr.SetDelayedBlockAck ();
1500  }
1501  reqHdr.SetTid (tid);
1502  /* For now we don't use buffer size field in the ADDBA request frame. The recipient
1503  * will choose how many packets it can receive under block ack.
1504  */
1505  reqHdr.SetBufferSize (0);
1506  reqHdr.SetTimeout (timeout);
1507  reqHdr.SetStartingSequence (startSeq);
1508 
1509  m_baManager->CreateAgreement (&reqHdr, dest);
1510 
1511  packet->AddHeader (reqHdr);
1512  packet->AddHeader (actionHdr);
1513 
1514  m_currentPacket = packet;
1515  m_currentHdr = hdr;
1516 
1517  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
1518  m_currentHdr.SetSequenceNumber (sequence);
1523 
1525  params.EnableAck ();
1526  params.DisableRts ();
1527  params.DisableNextData ();
1528  params.DisableOverrideDurationId ();
1529 
1532 }
1533 
1534 void
1535 EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
1536 {
1537  NS_LOG_FUNCTION (this << addr << static_cast<uint32_t> (tid) << byOriginator);
1538  WifiMacHeader hdr;
1539  hdr.SetAction ();
1540  hdr.SetAddr1 (addr);
1541  hdr.SetAddr2 (m_low->GetAddress ());
1542  hdr.SetAddr3 (m_low->GetAddress ());
1543  hdr.SetDsNotTo ();
1544  hdr.SetDsNotFrom ();
1545 
1546  MgtDelBaHeader delbaHdr;
1547  delbaHdr.SetTid (tid);
1548  if (byOriginator)
1549  {
1550  delbaHdr.SetByOriginator ();
1551  }
1552  else
1553  {
1554  delbaHdr.SetByRecipient ();
1555  }
1556 
1557  WifiActionHeader actionHdr;
1560  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1561 
1562  Ptr<Packet> packet = Create<Packet> ();
1563  packet->AddHeader (delbaHdr);
1564  packet->AddHeader (actionHdr);
1565 
1566  PushFront (packet, hdr);
1567 }
1568 
1569 int64_t
1571 {
1572  NS_LOG_FUNCTION (this << stream);
1573  m_rng->AssignStreams (stream);
1574  return 1;
1575 }
1576 
1577 void
1579 {
1580  NS_LOG_FUNCTION (this);
1581  m_dcf->ResetCw ();
1582  m_cwTrace = m_dcf->GetCw ();
1583  m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ());
1586 }
1587 
1588 void
1590 {
1591  NS_LOG_FUNCTION (this << hdr);
1592  if (!m_txOkCallback.IsNull ())
1593  {
1595  }
1596 }
1597 
1598 void
1600 {
1601  NS_LOG_FUNCTION (this << hdr);
1602  if (!m_txFailedCallback.IsNull ())
1603  {
1605  }
1606 }
1607 
1608 } //namespace ns3
virtual uint16_t PeekNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the Traffic ID and destination, but do not pick it (i...
Definition: edca-txop-n.cc:184
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 contention window size.
Definition: edca-txop-n.cc:392
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:347
void SetType(enum BlockAckType type)
Set the block ACK type.
TransmissionListener * m_transmissionListener
Definition: edca-txop-n.h:545
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void NotifyGotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
Ptr< const Packet > m_currentPacket
Definition: edca-txop-n.h:554
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void DoInitialize()
Initialize() implementation.
void SetQosAckPolicy(enum QosAckPolicy policy)
Set the QoS ACK policy in the QoS control field.
Introspection did not find any typical Config paths.
Definition: dcf.h:32
TxFailed m_txFailedCallback
Definition: edca-txop-n.h:542
virtual Mac48Address GetDestAddressForAggregation(const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:220
void NotifyWakeUp(void)
When wake up operation occurs, restart channel access.
Definition: edca-txop-n.cc:803
void SetBlockAckInactivityTimeout(uint16_t timeout)
bool NeedDataRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-manager.cc:90
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
uint16_t m_blockAckInactivityTimeout
Definition: edca-txop-n.h:568
void CreateAgreement(const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
virtual uint32_t GetNOutstandingPackets(Mac48Address address, uint8_t tid)
Definition: edca-txop-n.cc:200
virtual bool Aggregate(Ptr< const Packet > packet, Ptr< Packet > aggregatedPacket, Mac48Address src, Mac48Address dest)=0
void VerifyBlockAck(void)
Verifies if dequeued packet has to be transmitted with ack policy Block Ack.
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:507
void NotifyCollision(void)
Notify the EDCAF that collision has occurred.
Definition: edca-txop-n.cc:640
void SetTypeOfStation(enum TypeOfStation type)
Set type of station with the given type.
Definition: edca-txop-n.cc:364
void EnableBasicBlockAck(void)
Wait BASICBLOCKACKTimeout for a Basic Block Ack Response frame.
Definition: mac-low.cc:168
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.
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:487
void CompleteMpduTx(Ptr< const Packet > packet, WifiMacHeader hdr, Time tstamp)
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:134
bool IsAction() const
Return true if the header is an Action header.
Mac48Address GetBssid(void) const
Return the Basic Service Set Identification.
Definition: mac-low.cc:680
void SetTxFailedCallback(TxFailed callback)
Definition: edca-txop-n.cc:349
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:626
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: edca-txop-n.cc:820
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
void RegisterBlockAckListenerForAc(enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener)
Definition: mac-low.cc:2799
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
#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
bool NeedBarRetransmission(void)
Check if Block ACK Request should be re-transmitted.
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:201
enum WifiMacType GetType(void) const
Return the type (enum WifiMacType)
uint8_t m_blockAckThreshold
Definition: edca-txop-n.h:565
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this EdcaTxopN is associated to.
Definition: edca-txop-n.cc:356
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:792
bool IsBroadcast(void) const
virtual bool IsEdca(void) const
Definition: edca-txop-n.cc:54
void SetBlockAckType(enum BlockAckType bAckType)
WifiMacHeader m_currentHdr
Definition: edca-txop-n.h:556
void NotifySleep(void)
When sleep operation occurs, re-insert pending packet into front of the queue.
Definition: edca-txop-n.cc:792
void ReportAmpduTxStatus(Mac48Address address, uint8_t tid, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:720
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
void SetHtImmediateAck(bool immediateAck)
Enable or disable HT immediate ACK.
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:56
bool IsBlockAck(void) const
Return true if the header is a Block ACK header.
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: edca-txop-n.cc:130
void UpdateFragmentationThreshold(void)
Typically called to update the fragmentation threshold at the start of a new transmission.
bool IsLastFragment(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
virtual Ptr< MsduAggregator > GetMsduAggregator(void) const
Definition: edca-txop-n.cc:208
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:754
virtual Ptr< const Packet > PeekNextPacketInBaQueue(WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp)
Definition: edca-txop-n.cc:188
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:102
void PrepareForQueue(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
Ptr< MsduAggregator > m_msduAggregator
Definition: edca-txop-n.h:557
ns3::Time timeout
void SetTid(uint8_t)
Set Traffic ID (TID).
Block Ack Request.
friend class TransmissionListener
Definition: edca-txop-n.h:537
listen to events coming from ns3::MacLow.
Definition: mac-low.h:63
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
virtual void MissedAck(void)
ns3::MacLow did not receive an expected ACK within AckTimeout.
Definition: edca-txop-n.cc:114
void Add(DcfState *dcf)
Definition: dcf-manager.cc:405
void NextFragment(void)
Continue to the next fragment.
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:342
BlockAckManager * m_baManager
Definition: edca-txop-n.h:561
control how a packet is transmitted.
Definition: mac-low.h:305
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
struct Bar m_currentBar
Definition: edca-txop-n.h:569
virtual void DoNotifyChannelSwitching(void)
Called by DcfManager to notify a DcfState subclass that a channel switching occured.
Definition: edca-txop-n.cc:72
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: edca-txop-n.cc:420
virtual bool GetBlockAckAgreementExists(Mac48Address address, uint8_t tid)
Definition: edca-txop-n.cc:196
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Handles sequence numbering of IEEE 802.11 data frames.
Definition: mac-tx-middle.h:39
void MissedBlockAck(uint32_t nMpdus)
Event handler when a Block ACK timeout has occurred.
Definition: edca-txop-n.cc:933
Ptr< MpduAggregator > m_mpduAggregator
Definition: edca-txop-n.h:558
Ptr< const Packet > PeekNextPacket(WifiMacHeader &hdr, Mac48Address recipient, uint8_t tid, Time *timestamp)
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:68
void SetTxFailedCallback(TxFailed callback)
DcfManager * m_manager
Definition: edca-txop-n.h:539
void MissedAck(void)
Event handler when an ACK is missed.
Definition: edca-txop-n.cc:868
enum TypeOfStation GetTypeOfStation(void) const
Return type of station.
Definition: edca-txop-n.cc:371
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:441
Ptr< MacLow > Low(void)
Return the MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:434
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:548
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
void DestroyBlockAckAgreement(Mac48Address originator, uint8_t tid)
Definition: mac-low.cc:2512
This queue contains packets for a particular access class.
Definition: edca-txop-n.h:86
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
void SetQueue(Ptr< WifiMacQueue > queue)
void NotifyAccessGranted(void)
Notify the EDCAF that access has been granted.
Definition: edca-txop-n.cc:477
RandomStream * m_rng
Definition: edca-txop-n.h:547
void RemoveRetransmitPacket(uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
Remove a packet after you peek in the retransmit queue and get it.
Definition: edca-txop-n.cc:471
void ReportFinalDataFailed(Mac48Address address, const WifiMacHeader *header)
Should be invoked after calling ReportDataFailed if NeedDataRetransmission returns false...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:220
void NotifyInternalCollision(void)
Notify the EDCAF that internal collision has occurred.
Definition: edca-txop-n.cc:633
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
std::map< Mac48Address, bool > m_aMpduEnabled
Definition: edca-txop-n.h:103
virtual uint32_t GetNRetryNeededPackets(Mac48Address recipient, uint8_t tid) const
Definition: edca-txop-n.cc:204
TracedValue< uint32_t > m_cwTrace
Definition: edca-txop-n.h:571
void UpdateAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
void SetDsNotTo(void)
Un-set the To DS bit in the Frame Control field.
TracedValue< uint32_t > m_backoffTrace
Definition: edca-txop-n.h:570
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
virtual void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: edca-txop-n.cc:385
uint32_t GetNRetryNeededPackets(Mac48Address recipient, uint8_t tid) const
void SendAddBaRequest(Mac48Address recipient, uint8_t tid, uint16_t startSeq, uint16_t timeout, bool immediateBAck)
Sends an ADDBA Request to establish a block ack agreement with sta addressed by recipient for tid tid...
Ptr< const Packet > PeekNextRetransmitPacket(WifiMacHeader &header, Mac48Address recipient, uint8_t tid, Time *timestamp)
Definition: edca-txop-n.cc:465
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
virtual void GotAck(double snr, WifiMode txMode)
Definition: edca-txop-n.cc:110
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
bool GetBaAgreementExists(Mac48Address address, uint8_t tid)
Definition: edca-txop-n.cc:310
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:544
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: edca-txop-n.cc:721
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:262
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source, double rxSnr, WifiMode txMode, double dataSnr)
Definition: edca-txop-n.cc:118
enum BlockAckActionValue blockAck
Definition: mgt-headers.h:579
bool GetAmpduExist(Mac48Address dest)
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this BlockAckManager.
uint16_t PeekNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the Traffic ID and destination, but do not pick it (i...
Definition: edca-txop-n.cc:459
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
virtual void SetAmpdu(Mac48Address dest, bool enableAmpdu)
Definition: edca-txop-n.cc:172
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:347
bool IsQosBlockAck(void) const
Return if the QoS ACK policy is Block ACK.
Headers for Block ack response.
Definition: ctrl-headers.h:186
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
Definition: edca-txop-n.cc:784
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
Definition: mac-low.cc:626
uint8_t GetCurrentTid()
Get Traffic ID of the current packet.
Definition: edca-txop-n.cc:656
void SetTxMiddle(MacTxMiddle *txMiddle)
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:150
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.
bool IsMgt(void) const
Return true if the Type is Management.
virtual ~EdcaTxopN()
Definition: edca-txop-n.cc:280
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: edca-txop-n.cc:126
uint32_t GetNRetryNeededPackets(Mac48Address recipient, uint8_t tid) const
Definition: edca-txop-n.cc:322
virtual void DoNotifyWakeUp(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to wake up...
Definition: edca-txop-n.cc:80
uint8_t m_fragmentNumber
Definition: edca-txop-n.h:549
void SetTxOkCallback(TxOk callback)
Time m_currentPacketTimestamp
Definition: edca-txop-n.h:567
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
Definition: dcf-manager.cc:96
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:102
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, MacLowTransmissionListener *listener)
Definition: mac-low.cc:723
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:278
void SetByOriginator(void)
Set the initiator bit in the DELBA.
void SetTidInfo(uint8_t tid)
Set Traffic ID (TID).
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
EdcaTxopN * m_txop
Definition: edca-txop-n.cc:85
virtual uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: edca-txop-n.cc:406
void SetByRecipient(void)
Un-set the initiator bit in the DELBA.
void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:123
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.
Ptr< MpduAggregator > GetMpduAggregator(void) const
void EnableCompressedBlockAck(void)
Wait COMPRESSEDBLOCKACKTimeout for a Compressed Block Ack Response frame.
Definition: mac-low.cc:173
virtual void CompleteTransfer(Mac48Address recipient, uint8_t tid)
Definition: edca-txop-n.cc:168
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: edca-txop-n.cc:106
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Ptr< MsduAggregator > GetMsduAggregator(void) const
Hold objects of type Ptr<T>.
Definition: pointer.h:36
void SetAccessCategory(enum AcIndex ac)
Set the access category of this EDCAF.
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:188
uint16_t PeekNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the Traffic ID and destination, but do not pick it (i...
bool RemovePacket(uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
Remove a packet after you peek in the queue and get it.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
uint32_t GetFragmentSize(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Mac48Address MapDestAddressForAggregation(const WifiMacHeader &hdr)
bool ExistsAgreementInState(Mac48Address recipient, uint8_t tid, enum OriginatorBlockAckAgreement::State state) const
void SetMpduAggregator(Ptr< MpduAggregator > aggr)
bool SetupBlockAckIfNeeded()
If number of packets in the queue reaches m_blockAckThreshold value, an ADDBA Request frame is sent t...
StatusCode GetStatusCode(void) const
Return the status code.
void StartNext(void)
Start transmission for the next fragment.
an EUI-48 address
Definition: mac48-address.h:43
bool HasVhtSupported(void) const
Return whether the device has VHT capability support enabled.
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is setted.
virtual void DoNotifySleep(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to sleep.
Definition: edca-txop-n.cc:76
void SetAmpduExist(Mac48Address dest, bool enableAmpdu)
virtual Mac48Address GetSrcAddressForAggregation(const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:216
Ptr< const Packet > GetNextPacket(WifiMacHeader &hdr)
void Cancel(void)
Cancel the transmission.
void BaTxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver.
void SetManager(DcfManager *manager)
Set DcfManager this EdcaTxopN is associated to.
Definition: edca-txop-n.cc:334
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:203
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:810
uint16_t GetNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: edca-txop-n.cc:454
void SetMsduAggregator(Ptr< MsduAggregator > aggr)
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool > callback)
void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
Event handler when a Block ACK is received.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
uint8_t GetTidInfo(void) const
Return the Traffic ID (TID).
virtual uint16_t GetNextSequenceNumberfor(WifiMacHeader *hdr)
Return the next sequence number for the given header.
Definition: edca-txop-n.cc:180
void SetMaxPacketDelay(Time maxDelay)
void NotifyMpduTransmission(Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber, WifiMacHeader::QosAckPolicy policy)
virtual Ptr< WifiMacQueue > GetQueue(void)
Returns the EDCA queue to check if there are packets that can be aggregated with a Block Ack...
Definition: edca-txop-n.cc:164
bool NeedBarRetransmission(uint8_t tid, uint16_t seqNumber, Mac48Address recipient)
This function returns true if the lifetime of the packets a BAR refers to didn't expire yet else it r...
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
bool SwitchToBlockAckIfNeeded(Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
enum BlockAckType m_blockAckType
Definition: edca-txop-n.h:566
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:73
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:60
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:160
static TypeId GetTypeId(void)
Definition: edca-txop-n.cc:232
virtual void MissedBlockAck(uint32_t nMpdus)
Definition: edca-txop-n.cc:122
void BaTxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver.
uint32_t GetNBufferedPackets(Mac48Address recipient, uint8_t tid) const
bool MustSendHtImmediateAck(void) const
Check if the current ACK policy is immediate.
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
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 CompleteConfig(void)
Complete block ACK configuration.
virtual void RemoveFromBaQueue(uint8_t tid, Mac48Address recipient, uint16_t seqnumber)
Remove a packet after you peek in the retransmit queue and get it.
Definition: edca-txop-n.cc:192
uint32_t GetCw(void) const
Definition: dcf-manager.cc:132
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-manager.cc:84
void Unblock(Mac48Address dest, uint8_t tid)
Un-block the given destination address and TID (e.g.
bool IsBlockAckReq(void) const
Return true if the header is a Block ACK Request header.
void RestartAccessIfNeeded(void)
Restart access request if needed.
void SetBlockAckThreshold(uint8_t nPackets)
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:758
QosBlockedDestinations * m_qosBlockedDestinations
Definition: edca-txop-n.h:560
void CompleteAmpduExchange(Mac48Address recipient, uint8_t tid)
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:879
void CompleteAmpduTransfer(Mac48Address recipient, uint8_t tid)
Definition: edca-txop-n.cc:328
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
Ptr< MacLow > m_low
Definition: edca-txop-n.h:543
typedef for union of different ActionValues
Definition: mgt-headers.h:574
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:535
void CompleteTx(void)
For now is typically invoked to complete transmission of a packets sent with ack policy Block Ack: th...
bool IsSuccess(void) const
Return whether the status code is success.
Definition: status-code.cc:44
void SetTxMiddle(MacTxMiddle *txMiddle)
Definition: edca-txop-n.cc:427
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: edca-txop-n.cc:649
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual Ptr< MpduAggregator > GetMpduAggregator(void) const
Definition: edca-txop-n.cc:212
void EnableNextData(uint32_t size)
Definition: mac-low.cc:143
void DoDispose()
Destructor implementation.
Definition: edca-txop-n.cc:286
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:158
bool IsLastFragment(void) const
Check if the current fragment is the last fragment.
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:148
virtual uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: edca-txop-n.cc:413
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
Ptr< WifiMacQueue > m_queue
Definition: edca-txop-n.h:540
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
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.
tuple address
Definition: first.py:37
virtual void CompleteMpduTx(Ptr< const Packet > packet, WifiMacHeader hdr, Time tstamp)
This function stores an MPDU (part of an A-MPDU) in blockackagreement (i.e.
Definition: edca-txop-n.cc:176
void SendBlockAckRequest(const struct Bar &bar)
After that all packets, for which a block ack agreement was established, have been transmitted...
TypeOfStation
Enumeration for type of station.
Definition: edca-txop-n.h:61
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: dcf-manager.cc:108
Manages all block ack agreements for an originator station.
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:775
Headers for Block ack request.
Definition: ctrl-headers.h:50
bool ExistsAgreement(Mac48Address recipient, uint8_t tid) const
void FlushAggregateQueue(void)
This function is called to flush the aggregate queue, which is used for A-MPDU.
Definition: mac-low.cc:3245
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:64
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:193
uint32_t GetNOutstandingPacketsInBa(Mac48Address address, uint8_t tid)
Definition: edca-txop-n.cc:316
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:58
void ReportFinalRtsFailed(Mac48Address address, const WifiMacHeader *header)
Should be invoked after calling ReportRtsFailed if NeedRtsRetransmission returns false.
void SetStartingSequence(uint16_t seq)
Set the starting sequence number from the given raw sequence control field.
bool NeedsAccess(void) const
Check if the EDCAF requires access.
Definition: edca-txop-n.cc:448
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:827
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:36
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
AggregationCapableTransmissionListener * m_blockAckListener
Definition: edca-txop-n.h:546
bool IsRetry(void) const
Return if the Retry bit is set.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:257
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)
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:399
TypeOfStation m_typeOfStation
Definition: edca-txop-n.h:559
Mac48Address MapSrcAddressForAggregation(const WifiMacHeader &hdr)
This functions are used only to correctly set addresses in a-msdu subframe.
Ptr< WifiMacQueue > GetEdcaQueue() const
Return the packet queue associated with this EdcaTxopN.
Definition: edca-txop-n.cc:378
void SetDsNotFrom(void)
Un-set the From DS bit in the Frame Control field.
virtual Ptr< WifiMacQueue > GetQueue(void)
Definition: edca-txop-n.cc:138
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Dcf(EdcaTxopN *txop)
Definition: edca-txop-n.cc:49