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 
144 TypeId
146 {
147  static TypeId tid = TypeId ("ns3::EdcaTxopN")
150  .AddAttribute ("BlockAckThreshold", "If number of packets in this queue reaches this value,\
151  block ack mechanism is used. If this value is 0, block ack is never used.",
152  UintegerValue (0),
153  MakeUintegerAccessor (&EdcaTxopN::SetBlockAckThreshold,
155  MakeUintegerChecker<uint8_t> (0, 64))
156  .AddAttribute ("BlockAckInactivityTimeout", "Represents max time (blocks of 1024 micro seconds) allowed for block ack\
157  inactivity. If this value isn't equal to 0 a timer start after that a\
158  block ack setup is completed and will be reset every time that a block\
159  ack frame is received. If this value is 0, block ack inactivity timeout won't be used.",
160  UintegerValue (0),
161  MakeUintegerAccessor (&EdcaTxopN::SetBlockAckInactivityTimeout),
162  MakeUintegerChecker<uint16_t> ())
163  .AddAttribute ("Queue", "The WifiMacQueue object",
164  PointerValue (),
165  MakePointerAccessor (&EdcaTxopN::GetQueue),
166  MakePointerChecker<WifiMacQueue> ())
167  ;
168  return tid;
169 }
170 
172  : m_manager (0),
173  m_currentPacket (0),
174  m_aggregator (0),
175  m_blockAckType (COMPRESSED_BLOCK_ACK)
176 {
177  NS_LOG_FUNCTION (this);
180  m_dcf = new EdcaTxopN::Dcf (this);
181  m_queue = CreateObject<WifiMacQueue> ();
182  m_rng = new RealRandomStream ();
184  m_baManager = new BlockAckManager ();
189  m_baManager->SetMaxPacketDelay (m_queue->GetMaxDelay ());
190 }
191 
193 {
194  NS_LOG_FUNCTION (this);
195 }
196 
197 void
199 {
200  NS_LOG_FUNCTION (this);
201  m_queue = 0;
202  m_low = 0;
203  m_stationManager = 0;
204  delete m_transmissionListener;
205  delete m_dcf;
206  delete m_rng;
208  delete m_baManager;
209  delete m_blockAckListener;
211  m_dcf = 0;
212  m_rng = 0;
214  m_baManager = 0;
215  m_blockAckListener = 0;
216  m_txMiddle = 0;
217  m_aggregator = 0;
218 }
219 
220 void
222 {
223  NS_LOG_FUNCTION (this << manager);
224  m_manager = manager;
225  m_manager->Add (m_dcf);
226 }
227 
228 void
230 {
231  NS_LOG_FUNCTION (this << &callback);
232  m_txOkCallback = callback;
233 }
234 
235 void
237 {
238  NS_LOG_FUNCTION (this << &callback);
239  m_txFailedCallback = callback;
240 }
241 
242 void
244 {
245  NS_LOG_FUNCTION (this << remoteManager);
246  m_stationManager = remoteManager;
247 }
248 void
250 {
251  NS_LOG_FUNCTION (this << static_cast<uint32_t> (type));
252  m_typeOfStation = type;
253 }
254 
255 enum TypeOfStation
257 {
258  NS_LOG_FUNCTION (this);
259  return m_typeOfStation;
260 }
261 
264 {
265  NS_LOG_FUNCTION (this);
266  return m_queue;
267 }
268 
269 void
270 EdcaTxopN::SetMinCw (uint32_t minCw)
271 {
272  NS_LOG_FUNCTION (this << minCw);
273  m_dcf->SetCwMin (minCw);
274 }
275 
276 void
277 EdcaTxopN::SetMaxCw (uint32_t maxCw)
278 {
279  NS_LOG_FUNCTION (this << maxCw);
280  m_dcf->SetCwMax (maxCw);
281 }
282 
283 void
284 EdcaTxopN::SetAifsn (uint32_t aifsn)
285 {
286  NS_LOG_FUNCTION (this << aifsn);
287  m_dcf->SetAifsn (aifsn);
288 }
289 
290 uint32_t
292 {
293  NS_LOG_FUNCTION (this);
294  return m_dcf->GetCwMin ();
295 }
296 
297 uint32_t
299 {
300  NS_LOG_FUNCTION (this);
301  return m_dcf->GetCwMax ();
302 }
303 
304 uint32_t
306 {
307  NS_LOG_FUNCTION (this);
308  return m_dcf->GetAifsn ();
309 }
310 
311 void
313 {
314  NS_LOG_FUNCTION (this << txMiddle);
315  m_txMiddle = txMiddle;
316 }
317 
320 {
321  NS_LOG_FUNCTION (this);
322  return m_low;
323 }
324 
325 void
327 {
328  NS_LOG_FUNCTION (this << low);
329  m_low = low;
330 }
331 
332 bool
334 {
335  NS_LOG_FUNCTION (this);
336  return !m_queue->IsEmpty () || m_currentPacket != 0 || m_baManager->HasPackets ();
337 }
338 
339 void
341 {
342  NS_LOG_FUNCTION (this);
343  if (m_currentPacket == 0)
344  {
345  if (m_queue->IsEmpty () && !m_baManager->HasPackets ())
346  {
347  NS_LOG_DEBUG ("queue is empty");
348  return;
349  }
351  {
353  return;
354  }
355  /* check if packets need retransmission are stored in BlockAckManager */
357  if (m_currentPacket == 0)
358  {
359  if (m_queue->PeekFirstAvailable (&m_currentHdr, m_currentPacketTimestamp, m_qosBlockedDestinations) == 0)
360  {
361  NS_LOG_DEBUG ("no available packets in the queue");
362  return;
363  }
365  && m_blockAckThreshold > 0
367  && SetupBlockAckIfNeeded ())
368  {
369  return;
370  }
372  NS_ASSERT (m_currentPacket != 0);
373 
374  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
375  m_currentHdr.SetSequenceNumber (sequence);
379  m_fragmentNumber = 0;
380  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
381  ", to=" << m_currentHdr.GetAddr1 () <<
382  ", seq=" << m_currentHdr.GetSequenceControl ());
384  {
385  VerifyBlockAck ();
386  }
387  }
388  }
390  params.DisableOverrideDurationId ();
391  if (m_currentHdr.GetAddr1 ().IsGroup ())
392  {
393  params.DisableRts ();
394  params.DisableAck ();
395  params.DisableNextData ();
396  m_low->StartTransmission (m_currentPacket,
397  &m_currentHdr,
398  params,
400 
401  NS_LOG_DEBUG ("tx broadcast");
402  }
404  {
406  }
407  else
408  {
410  {
411  params.DisableAck ();
412  }
413  else
414  {
415  params.EnableAck ();
416  }
418  && !m_currentHdr.IsQosAmsdu ())
419  ||
420  (m_currentHdr.IsData ()
422  && (m_blockAckThreshold == 0
424  {
425  //With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
426  params.DisableRts ();
427  WifiMacHeader hdr;
428  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
429  if (IsLastFragment ())
430  {
431  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
432  params.DisableNextData ();
433  }
434  else
435  {
436  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
438  }
439  m_low->StartTransmission (fragment, &hdr, params,
441  }
442  else
443  {
444  WifiMacHeader peekedHdr;
445  if (m_currentHdr.IsQosData ()
446  && m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
449  && m_aggregator != 0 && !m_currentHdr.IsRetry ())
450  {
451  /* here is performed aggregation */
452  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
453  m_aggregator->Aggregate (m_currentPacket, currentAggregatedPacket,
454  MapSrcAddressForAggregation (peekedHdr),
455  MapDestAddressForAggregation (peekedHdr));
456  bool aggregated = false;
457  bool isAmsdu = false;
458  Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
461  while (peekedPacket != 0)
462  {
463  aggregated = m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket,
464  MapSrcAddressForAggregation (peekedHdr),
465  MapDestAddressForAggregation (peekedHdr));
466  if (aggregated)
467  {
468  isAmsdu = true;
469  m_queue->Remove (peekedPacket);
470  }
471  else
472  {
473  break;
474  }
475  peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (),
477  }
478  if (isAmsdu)
479  {
481  m_currentHdr.SetAddr3 (m_low->GetBssid ());
482  m_currentPacket = currentAggregatedPacket;
483  currentAggregatedPacket = 0;
484  NS_LOG_DEBUG ("tx unicast A-MSDU");
485  }
486  }
487  if (NeedRts ())
488  {
489  params.EnableRts ();
490  NS_LOG_DEBUG ("tx unicast rts");
491  }
492  else
493  {
494  params.DisableRts ();
495  NS_LOG_DEBUG ("tx unicast");
496  }
497  params.DisableNextData ();
498  m_low->StartTransmission (m_currentPacket, &m_currentHdr,
499  params, m_transmissionListener);
500  CompleteTx ();
501  }
502  }
503 }
504 
506 {
507  NS_LOG_FUNCTION (this);
508  NotifyCollision ();
509 }
510 
511 void
513 {
514  NS_LOG_FUNCTION (this);
517 }
518 
519 void
520 EdcaTxopN::GotCts (double snr, WifiMode txMode)
521 {
522  NS_LOG_FUNCTION (this << snr << txMode);
523  NS_LOG_DEBUG ("got cts");
524 }
525 
526 void
528 {
529  NS_LOG_FUNCTION (this);
530  NS_LOG_DEBUG ("missed cts");
531  if (!NeedRtsRetransmission ())
532  {
533  NS_LOG_DEBUG ("Cts Fail");
534  m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
535  if (!m_txFailedCallback.IsNull ())
536  {
538  }
539  // to reset the dcf.
540  m_currentPacket = 0;
541  m_dcf->ResetCw ();
542  }
543  else
544  {
545  m_dcf->UpdateFailedCw ();
546  }
549 }
550 
551 void
553 {
554  NS_LOG_FUNCTION (this);
555  m_queue->Flush ();
556  m_currentPacket = 0;
557 }
558 
559 void
561 {
562  NS_LOG_FUNCTION (this << packet << &hdr);
563  WifiMacTrailer fcs;
564  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
565  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
566  packet, fullPacketSize);
567  m_queue->Enqueue (packet, hdr);
569 }
570 
571 void
572 EdcaTxopN::GotAck (double snr, WifiMode txMode)
573 {
574  NS_LOG_FUNCTION (this << snr << txMode);
575  if (!NeedFragmentation ()
576  || IsLastFragment ()
577  || m_currentHdr.IsQosAmsdu ())
578  {
579  NS_LOG_DEBUG ("got ack. tx done.");
580  if (!m_txOkCallback.IsNull ())
581  {
583  }
584 
585  if (m_currentHdr.IsAction ())
586  {
587  WifiActionHeader actionHdr;
589  p->RemoveHeader (actionHdr);
590  if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK
592  {
593  MgtDelBaHeader delBa;
594  p->PeekHeader (delBa);
595  if (delBa.IsByOriginator ())
596  {
598  }
599  else
600  {
601  m_low->DestroyBlockAckAgreement (m_currentHdr.GetAddr1 (), delBa.GetTid ());
602  }
603  }
604  }
605  m_currentPacket = 0;
606 
607  m_dcf->ResetCw ();
610  }
611  else
612  {
613  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
614  }
615 }
616 
617 void
619 {
620  NS_LOG_FUNCTION (this);
621  NS_LOG_DEBUG ("missed ack");
622  if (!NeedDataRetransmission ())
623  {
624  NS_LOG_DEBUG ("Ack Fail");
625  m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
626  if (!m_txFailedCallback.IsNull ())
627  {
629  }
630  // to reset the dcf.
631  m_currentPacket = 0;
632  m_dcf->ResetCw ();
633  }
634  else
635  {
636  NS_LOG_DEBUG ("Retransmit");
638  m_dcf->UpdateFailedCw ();
639  }
642 }
643 
644 void
646 {
647  NS_LOG_FUNCTION (this);
648  NS_LOG_DEBUG ("missed block ack");
649  //should i report this to station addressed by ADDR1?
650  NS_LOG_DEBUG ("Retransmit block ack request");
652  m_dcf->UpdateFailedCw ();
653 
656 }
657 
660 {
661  return m_aggregator;
662 }
663 
664 void
666 {
667  NS_LOG_FUNCTION (this);
668  if ((m_currentPacket != 0
669  || !m_queue->IsEmpty () || m_baManager->HasPackets ())
670  && !m_dcf->IsAccessRequested ())
671  {
673  }
674 }
675 
676 void
678 {
679  NS_LOG_FUNCTION (this);
680  if (m_currentPacket == 0
681  && (!m_queue->IsEmpty () || m_baManager->HasPackets ())
682  && !m_dcf->IsAccessRequested ())
683  {
685  }
686 }
687 
688 bool
690 {
691  NS_LOG_FUNCTION (this);
692  return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
694 }
695 
696 bool
698 {
699  NS_LOG_FUNCTION (this);
700  return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
702 }
703 
704 bool
706 {
707  NS_LOG_FUNCTION (this);
708  return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
710 }
711 
712 void
714 {
715  NS_LOG_FUNCTION (this);
717 }
718 
719 void
721 {
722  NS_LOG_FUNCTION (this);
723  NS_LOG_DEBUG ("start next packet fragment");
724  /* this callback is used only for fragments. */
725  NextFragment ();
726  WifiMacHeader hdr;
727  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
729  params.EnableAck ();
730  params.DisableRts ();
731  params.DisableOverrideDurationId ();
732  if (IsLastFragment ())
733  {
734  params.DisableNextData ();
735  }
736  else
737  {
739  }
740  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
741 }
742 
743 void
745 {
746  NS_LOG_FUNCTION (this);
747  NS_LOG_DEBUG ("transmission cancelled");
748 }
749 
750 void
752 {
753  NS_LOG_FUNCTION (this);
754  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
755  m_currentPacket = 0;
756  m_dcf->ResetCw ();
759 }
760 
761 bool
763 {
764  NS_LOG_FUNCTION (this);
765  return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
767 }
768 
769 uint32_t
771 {
772  NS_LOG_FUNCTION (this);
773  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
775 }
776 
777 uint32_t
779 {
780  NS_LOG_FUNCTION (this);
781  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
783 }
784 
785 uint32_t
787 {
788  NS_LOG_FUNCTION (this);
789  return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
791 }
792 
793 
794 bool
796 {
797  NS_LOG_FUNCTION (this);
798  return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
800 }
801 
804 {
805  NS_LOG_FUNCTION (this << hdr);
806  *hdr = m_currentHdr;
808  uint32_t startOffset = GetFragmentOffset ();
809  Ptr<Packet> fragment;
810  if (IsLastFragment ())
811  {
812  hdr->SetNoMoreFragments ();
813  }
814  else
815  {
816  hdr->SetMoreFragments ();
817  }
818  fragment = m_currentPacket->CreateFragment (startOffset,
819  GetFragmentSize ());
820  return fragment;
821 }
822 
823 void
825 {
826  NS_LOG_FUNCTION (this << static_cast<uint32_t> (ac));
827  m_ac = ac;
828 }
829 
832 {
833  NS_LOG_FUNCTION (this << &hdr);
834  Mac48Address retval;
836  {
837  retval = hdr.GetAddr2 ();
838  }
839  else
840  {
841  retval = hdr.GetAddr3 ();
842  }
843  return retval;
844 }
845 
848 {
849  NS_LOG_FUNCTION (this << &hdr);
850  Mac48Address retval;
852  {
853  retval = hdr.GetAddr1 ();
854  }
855  else
856  {
857  retval = hdr.GetAddr3 ();
858  }
859  return retval;
860 }
861 
862 void
864 {
865  NS_LOG_FUNCTION (this << aggr);
866  m_aggregator = aggr;
867 }
868 
869 void
871 {
872  NS_LOG_FUNCTION (this << packet << &hdr);
873  WifiMacTrailer fcs;
874  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
875  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
876  packet, fullPacketSize);
877  m_queue->PushFront (packet, hdr);
879 }
880 
881 void
883 {
884  NS_LOG_FUNCTION (this << respHdr << recipient);
885  NS_LOG_DEBUG ("received ADDBA response from " << recipient);
886  uint8_t tid = respHdr->GetTid ();
888  {
889  if (respHdr->GetStatusCode ().IsSuccess ())
890  {
891  NS_LOG_DEBUG ("block ack agreement established with " << recipient);
892  m_baManager->UpdateAgreement (respHdr, recipient);
893  }
894  else
895  {
896  NS_LOG_DEBUG ("discard ADDBA response" << recipient);
897  m_baManager->NotifyAgreementUnsuccessful (recipient, tid);
898  }
899  }
901 }
902 
903 void
905 {
906  NS_LOG_FUNCTION (this << delBaHdr << recipient);
907  NS_LOG_DEBUG ("received DELBA frame from=" << recipient);
908  m_baManager->TearDownBlockAck (recipient, delBaHdr->GetTid ());
909 }
910 
911 void
913 {
914  NS_LOG_FUNCTION (this << blockAck << recipient);
915  NS_LOG_DEBUG ("got block ack from=" << recipient);
916  m_baManager->NotifyGotBlockAck (blockAck, recipient);
917  m_currentPacket = 0;
918  m_dcf->ResetCw ();
921 }
922 
923 void
925 {
926  NS_LOG_FUNCTION (this);
927  uint8_t tid = m_currentHdr.GetQosTid ();
928  Mac48Address recipient = m_currentHdr.GetAddr1 ();
929  uint16_t sequence = m_currentHdr.GetSequenceNumber ();
931  {
932  m_baManager->SwitchToBlockAckIfNeeded (recipient, tid, sequence);
933  }
935  {
937  }
938 }
939 
940 void
942 {
943  NS_LOG_FUNCTION (this);
945  {
946  if (!m_currentHdr.IsRetry ())
947  {
949  }
952  m_currentHdr.GetAddr1 ()));
953  }
954 }
955 
956 bool
958 {
959  NS_LOG_FUNCTION (this);
960  uint8_t tid = m_currentHdr.GetQosTid ();
961  Mac48Address recipient = m_currentHdr.GetAddr1 ();
962 
963  uint32_t packets = m_queue->GetNPacketsByTidAndAddress (tid, WifiMacHeader::ADDR1, recipient);
964 
965  if (packets >= m_blockAckThreshold)
966  {
967  /* Block ack setup */
968  uint16_t startingSequence = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
969  SendAddBaRequest (recipient, tid, startingSequence, m_blockAckInactivityTimeout, true);
970  return true;
971  }
972  return false;
973 }
974 
975 void
977 {
978  NS_LOG_FUNCTION (this << &bar);
979  WifiMacHeader hdr;
981  hdr.SetAddr1 (bar.recipient);
982  hdr.SetAddr2 (m_low->GetAddress ());
983  hdr.SetAddr3 (m_low->GetBssid ());
984  hdr.SetDsNotTo ();
985  hdr.SetDsNotFrom ();
986  hdr.SetNoRetry ();
987  hdr.SetNoMoreFragments ();
988 
989  m_currentPacket = bar.bar;
990  m_currentHdr = hdr;
991 
993  params.DisableRts ();
994  params.DisableNextData ();
995  params.DisableOverrideDurationId ();
996  if (bar.immediate)
997  {
999  {
1000  params.EnableBasicBlockAck ();
1001  }
1003  {
1004  params.EnableCompressedBlockAck ();
1005  }
1006  else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
1007  {
1008  NS_FATAL_ERROR ("Multi-tid block ack is not supported");
1009  }
1010  }
1011  else
1012  {
1013  //Delayed block ack
1014  params.EnableAck ();
1015  }
1016  m_low->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener);
1017 }
1018 
1019 void
1021 {
1022  NS_LOG_FUNCTION (this);
1024  m_low->RegisterBlockAckListenerForAc (m_ac, m_blockAckListener);
1026 }
1027 
1028 void
1030 {
1031  NS_LOG_FUNCTION (this << static_cast<uint32_t> (threshold));
1032  m_blockAckThreshold = threshold;
1033  m_baManager->SetBlockAckThreshold (threshold);
1034 }
1035 
1036 void
1038 {
1039  NS_LOG_FUNCTION (this << timeout);
1041 }
1042 
1043 uint8_t
1045 {
1046  NS_LOG_FUNCTION (this);
1047  return m_blockAckThreshold;
1048 }
1049 
1050 void
1051 EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
1052  uint16_t timeout, bool immediateBAck)
1053 {
1054  NS_LOG_FUNCTION (this << dest << static_cast<uint32_t> (tid) << startSeq << timeout << immediateBAck);
1055  NS_LOG_DEBUG ("sent ADDBA request to " << dest);
1056  WifiMacHeader hdr;
1057  hdr.SetAction ();
1058  hdr.SetAddr1 (dest);
1059  hdr.SetAddr2 (m_low->GetAddress ());
1060  hdr.SetAddr3 (m_low->GetAddress ());
1061  hdr.SetDsNotTo ();
1062  hdr.SetDsNotFrom ();
1063 
1064  WifiActionHeader actionHdr;
1067  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1068 
1069  Ptr<Packet> packet = Create<Packet> ();
1070  /*Setting ADDBARequest header*/
1071  MgtAddBaRequestHeader reqHdr;
1072  reqHdr.SetAmsduSupport (true);
1073  if (immediateBAck)
1074  {
1075  reqHdr.SetImmediateBlockAck ();
1076  }
1077  else
1078  {
1079  reqHdr.SetDelayedBlockAck ();
1080  }
1081  reqHdr.SetTid (tid);
1082  /* For now we don't use buffer size field in the ADDBA request frame. The recipient
1083  * will choose how many packets it can receive under block ack.
1084  */
1085  reqHdr.SetBufferSize (0);
1086  reqHdr.SetTimeout (timeout);
1087  reqHdr.SetStartingSequence (startSeq);
1088 
1089  m_baManager->CreateAgreement (&reqHdr, dest);
1090 
1091  packet->AddHeader (reqHdr);
1092  packet->AddHeader (actionHdr);
1093 
1094  m_currentPacket = packet;
1095  m_currentHdr = hdr;
1096 
1097  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
1098  m_currentHdr.SetSequenceNumber (sequence);
1102 
1104  params.EnableAck ();
1105  params.DisableRts ();
1106  params.DisableNextData ();
1107  params.DisableOverrideDurationId ();
1108 
1109  m_low->StartTransmission (m_currentPacket, &m_currentHdr, params,
1111 }
1112 
1113 void
1114 EdcaTxopN::SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator)
1115 {
1116  NS_LOG_FUNCTION (this << addr << static_cast<uint32_t> (tid) << byOriginator);
1117  WifiMacHeader hdr;
1118  hdr.SetAction ();
1119  hdr.SetAddr1 (addr);
1120  hdr.SetAddr2 (m_low->GetAddress ());
1121  hdr.SetAddr3 (m_low->GetAddress ());
1122  hdr.SetDsNotTo ();
1123  hdr.SetDsNotFrom ();
1124 
1125  MgtDelBaHeader delbaHdr;
1126  delbaHdr.SetTid (tid);
1127  if (byOriginator)
1128  {
1129  delbaHdr.SetByOriginator ();
1130  }
1131  else
1132  {
1133  delbaHdr.SetByRecipient ();
1134  }
1135 
1136  WifiActionHeader actionHdr;
1139  actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action);
1140 
1141  Ptr<Packet> packet = Create<Packet> ();
1142  packet->AddHeader (delbaHdr);
1143  packet->AddHeader (actionHdr);
1144 
1145  PushFront (packet, hdr);
1146 }
1147 
1148 int64_t
1150 {
1151  NS_LOG_FUNCTION (this << stream);
1152  m_rng->AssignStreams (stream);
1153  return 1;
1154 }
1155 
1156 void
1158 {
1159  NS_LOG_FUNCTION (this);
1160  m_dcf->ResetCw ();
1163 }
1164 } // 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:277
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:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
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:770
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:924
void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
Event handler when a Block ACK is received.
Definition: edca-txop-n.cc:912
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:512
void SetTypeOfStation(enum TypeOfStation type)
Set type of station with the given type.
Definition: edca-txop-n.cc:249
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:705
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:236
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:572
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:1014
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)
Definition: assert.h:64
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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:243
bool HasBar(struct Bar &bar)
uint32_t GetSize(void) const
Definition: packet.h:650
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:482
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:513
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:713
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:229
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:697
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:744
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
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:305
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:618
enum TypeOfStation GetTypeOfStation(void) const
Return type of station.
Definition: edca-txop-n.cc:256
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:326
Ptr< MacLow > Low(void)
Return the MacLow associated with this EdcaTxopN.
Definition: edca-txop-n.cc:319
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:904
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:340
RandomStream * m_rng
Definition: edca-txop-n.h:439
NS_LOG_COMPONENT_DEFINE("EdcaTxopN")
void NotifyInternalCollision(void)
Notify the EDCAF that internal collision has occurred.
Definition: edca-txop-n.cc:505
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:270
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:527
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:1238
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
Definition: edca-txop-n.cc:552
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:803
virtual ~EdcaTxopN()
Definition: edca-txop-n.cc:192
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
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:291
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:645
void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
Definition: edca-txop-n.cc:751
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:762
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:659
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:824
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:847
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:957
StatusCode GetStatusCode(void) const
Return the status code.
Definition: mgt-headers.cc:929
void StartNext(void)
Start transmission for the next fragment.
Definition: edca-txop-n.cc:720
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:744
void SetManager(DcfManager *manager)
Set DcfManager this EdcaTxopN is associated to.
Definition: edca-txop-n.cc:221
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:560
void SetMsduAggregator(Ptr< MsduAggregator > aggr)
Definition: edca-txop-n.cc:863
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool > callback)
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:935
void SetMaxPacketDelay(Time maxDelay)
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: edca-txop-n.cc:870
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:145
BlockAckEventListener * m_blockAckListener
Definition: edca-txop-n.h:438
static TypeId GetTypeId(void)
Definition: dcf.cc:32
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
Definition: edca-txop-n.cc:778
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:665
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)
Definition: log.h:289
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:941
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:312
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: edca-txop-n.cc:520
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:198
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:795
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:298
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:677
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:689
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:976
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:539
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:263
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:333
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
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:786
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:343
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:882
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:284
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:831
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