A Discrete-Event Network Simulator
API
dca-txop.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/assert.h"
22 #include "ns3/packet.h"
23 #include "ns3/log.h"
24 #include "ns3/simulator.h"
25 #include "ns3/node.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/pointer.h"
28 #include "dca-txop.h"
29 #include "dcf-manager.h"
30 #include "mac-low.h"
31 #include "wifi-mac-queue.h"
32 #include "mac-tx-middle.h"
33 #include "wifi-mac-trailer.h"
34 #include "wifi-mac.h"
35 #include "random-stream.h"
36 
37 #undef NS_LOG_APPEND_CONTEXT
38 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
39 
40 namespace ns3 {
41 
42 NS_LOG_COMPONENT_DEFINE ("DcaTxop");
43 
44 class DcaTxop::Dcf : public DcfState
45 {
46 public:
47  Dcf (DcaTxop * txop)
48  : m_txop (txop)
49  {
50  }
51  virtual bool IsEdca (void) const
52  {
53  return false;
54  }
55 private:
56  virtual void DoNotifyAccessGranted (void)
57  {
59  }
60  virtual void DoNotifyInternalCollision (void)
61  {
63  }
64  virtual void DoNotifyCollision (void)
65  {
67  }
68  virtual void DoNotifyChannelSwitching (void)
69  {
71  }
72  virtual void DoNotifySleep (void)
73  {
74  m_txop->NotifySleep ();
75  }
76  virtual void DoNotifyWakeUp (void)
77  {
78  m_txop->NotifyWakeUp ();
79  }
80 
82 };
83 
84 
89 {
90 public:
98  m_txop (txop)
99  {
100  }
101 
103  {
104  }
105 
106  virtual void GotCts (double snr, WifiMode txMode)
107  {
108  m_txop->GotCts (snr, txMode);
109  }
110  virtual void MissedCts (void)
111  {
112  m_txop->MissedCts ();
113  }
114  virtual void GotAck (double snr, WifiMode txMode)
115  {
116  m_txop->GotAck (snr, txMode);
117  }
118  virtual void MissedAck (void)
119  {
120  m_txop->MissedAck ();
121  }
122  virtual void StartNextFragment (void)
123  {
125  }
126  virtual void StartNext (void)
127  {
128  }
129  virtual void Cancel (void)
130  {
131  m_txop->Cancel ();
132  }
133  virtual void EndTxNoAck (void)
134  {
135  m_txop->EndTxNoAck ();
136  }
137 
138 private:
140 };
141 
143 
144 TypeId
146 {
147  static TypeId tid = TypeId ("ns3::DcaTxop")
148  .SetParent<ns3::Dcf> ()
149  .SetGroupName ("Wifi")
150  .AddConstructor<DcaTxop> ()
151  .AddAttribute ("Queue", "The WifiMacQueue object",
152  PointerValue (),
154  MakePointerChecker<WifiMacQueue> ())
155  ;
156  return tid;
157 }
158 
160  : m_manager (0),
161  m_currentPacket (0)
162 {
163  NS_LOG_FUNCTION (this);
165  m_dcf = new DcaTxop::Dcf (this);
166  m_queue = CreateObject<WifiMacQueue> ();
167  m_rng = new RealRandomStream ();
168 }
169 
171 {
172  NS_LOG_FUNCTION (this);
173 }
174 
175 void
177 {
178  NS_LOG_FUNCTION (this);
179  m_queue = 0;
180  m_low = 0;
181  m_stationManager = 0;
182  delete m_transmissionListener;
183  delete m_dcf;
184  delete m_rng;
186  m_dcf = 0;
187  m_rng = 0;
188  m_txMiddle = 0;
189 }
190 
191 void
193 {
194  NS_LOG_FUNCTION (this << manager);
195  m_manager = manager;
196  m_manager->Add (m_dcf);
197 }
198 
200 {
201  m_txMiddle = txMiddle;
202 }
203 
204 void
206 {
207  NS_LOG_FUNCTION (this << low);
208  m_low = low;
209 }
210 
211 void
213 {
214  NS_LOG_FUNCTION (this << remoteManager);
215  m_stationManager = remoteManager;
216 }
217 
218 void
220 {
221  NS_LOG_FUNCTION (this << &callback);
222  m_txOkCallback = callback;
223 }
224 
225 void
227 {
228  NS_LOG_FUNCTION (this << &callback);
229  m_txFailedCallback = callback;
230 }
231 
234 {
235  NS_LOG_FUNCTION (this);
236  return m_queue;
237 }
238 
239 void
240 DcaTxop::SetMinCw (uint32_t minCw)
241 {
242  NS_LOG_FUNCTION (this << minCw);
243  m_dcf->SetCwMin (minCw);
244 }
245 
246 void
247 DcaTxop::SetMaxCw (uint32_t maxCw)
248 {
249  NS_LOG_FUNCTION (this << maxCw);
250  m_dcf->SetCwMax (maxCw);
251 }
252 
253 void
254 DcaTxop::SetAifsn (uint32_t aifsn)
255 {
256  NS_LOG_FUNCTION (this << aifsn);
257  m_dcf->SetAifsn (aifsn);
258 }
259 
260 void
262 {
263  NS_LOG_FUNCTION (this << txopLimit);
264  m_dcf->SetTxopLimit (txopLimit);
265 }
266 
267 uint32_t
268 DcaTxop::GetMinCw (void) const
269 {
270  NS_LOG_FUNCTION (this);
271  return m_dcf->GetCwMin ();
272 }
273 
274 uint32_t
275 DcaTxop::GetMaxCw (void) const
276 {
277  NS_LOG_FUNCTION (this);
278  return m_dcf->GetCwMax ();
279 }
280 
281 uint32_t
282 DcaTxop::GetAifsn (void) const
283 {
284  NS_LOG_FUNCTION (this);
285  return m_dcf->GetAifsn ();
286 }
287 
288 Time
290 {
291  NS_LOG_FUNCTION (this);
292  return m_dcf->GetTxopLimit ();
293 }
294 
295 void
297 {
298  NS_LOG_FUNCTION (this << packet << &hdr);
299  WifiMacTrailer fcs;
300  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet);
301  m_queue->Enqueue (packet, hdr);
303 }
304 
305 int64_t
306 DcaTxop::AssignStreams (int64_t stream)
307 {
308  NS_LOG_FUNCTION (this << stream);
309  m_rng->AssignStreams (stream);
310  return 1;
311 }
312 
313 void
315 {
316  NS_LOG_FUNCTION (this);
317  if ((m_currentPacket != 0
318  || !m_queue->IsEmpty ())
319  && !m_dcf->IsAccessRequested ())
320  {
322  }
323 }
324 
325 void
327 {
328  NS_LOG_FUNCTION (this);
329  if (m_currentPacket == 0
330  && !m_queue->IsEmpty ()
331  && !m_dcf->IsAccessRequested ())
332  {
334  }
335 }
336 
339 {
340  NS_LOG_FUNCTION (this);
341  return m_low;
342 }
343 
344 void
346 {
347  NS_LOG_FUNCTION (this);
348  m_dcf->ResetCw ();
351 }
352 
353 bool
355 {
356  NS_LOG_FUNCTION (this);
359 }
360 
361 bool
363 {
364  NS_LOG_FUNCTION (this);
367 }
368 
369 bool
371 {
372  NS_LOG_FUNCTION (this);
375 }
376 
377 void
379 {
380  NS_LOG_FUNCTION (this);
382 }
383 
384 uint32_t
386 {
387  NS_LOG_FUNCTION (this);
390 }
391 
392 bool
394 {
395  NS_LOG_FUNCTION (this);
398 }
399 
400 uint32_t
402 {
403  NS_LOG_FUNCTION (this);
406 }
407 
408 uint32_t
410 {
411  NS_LOG_FUNCTION (this);
414 }
415 
418 {
419  NS_LOG_FUNCTION (this << hdr);
420  *hdr = m_currentHdr;
422  uint32_t startOffset = GetFragmentOffset ();
423  Ptr<Packet> fragment;
424  if (IsLastFragment ())
425  {
426  hdr->SetNoMoreFragments ();
427  }
428  else
429  {
430  hdr->SetMoreFragments ();
431  }
432  fragment = m_currentPacket->CreateFragment (startOffset,
433  GetFragmentSize ());
434  return fragment;
435 }
436 
437 bool
439 {
440  NS_LOG_FUNCTION (this);
441  return !m_queue->IsEmpty () || m_currentPacket != 0;
442 }
443 void
445 {
446  NS_LOG_FUNCTION (this);
447  if (m_currentPacket == 0)
448  {
449  if (m_queue->IsEmpty ())
450  {
451  NS_LOG_DEBUG ("queue empty");
452  return;
453  }
454  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
455  NS_ASSERT (m_currentPacket != 0);
456  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
457  m_currentHdr.SetSequenceNumber (sequence);
462  m_fragmentNumber = 0;
463  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
464  ", to=" << m_currentHdr.GetAddr1 () <<
465  ", seq=" << m_currentHdr.GetSequenceControl ());
466  }
468  params.DisableOverrideDurationId ();
469  if (m_currentHdr.GetAddr1 ().IsGroup ())
470  {
471  params.DisableRts ();
472  params.DisableAck ();
473  params.DisableNextData ();
475  &m_currentHdr,
476  params,
478  NS_LOG_DEBUG ("tx broadcast");
479  }
480  else
481  {
482  params.EnableAck ();
483 
484  if (NeedFragmentation ())
485  {
486  WifiMacHeader hdr;
487  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
488  if (IsLastFragment ())
489  {
490  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
491  params.DisableNextData ();
492  }
493  else
494  {
495  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
497  }
498  Low ()->StartTransmission (fragment, &hdr, params,
500  }
501  else
502  {
503  params.DisableNextData ();
505  params, m_transmissionListener);
506  }
507  }
508 }
509 
510 void
512 {
513  NS_LOG_FUNCTION (this);
514  NotifyCollision ();
515 }
516 
517 void
519 {
520  NS_LOG_FUNCTION (this);
523 }
524 
525 void
527 {
528  NS_LOG_FUNCTION (this);
529  m_queue->Flush ();
530  m_currentPacket = 0;
531 }
532 
533 void
535 {
536  NS_LOG_FUNCTION (this);
537  if (m_currentPacket != 0)
538  {
539  m_queue->PushFront (m_currentPacket, m_currentHdr);
540  m_currentPacket = 0;
541  }
542 }
543 
544 void
546 {
547  NS_LOG_FUNCTION (this);
549 }
550 
551 void
552 DcaTxop::GotCts (double snr, WifiMode txMode)
553 {
554  NS_LOG_FUNCTION (this << snr << txMode);
555  NS_LOG_DEBUG ("got cts");
556 }
557 
558 void
560 {
561  NS_LOG_FUNCTION (this);
562  NS_LOG_DEBUG ("missed cts");
563  if (!NeedRtsRetransmission ())
564  {
565  NS_LOG_DEBUG ("Cts Fail");
567  if (!m_txFailedCallback.IsNull ())
568  {
570  }
571  //to reset the dcf.
572  m_currentPacket = 0;
573  m_dcf->ResetCw ();
574  }
575  else
576  {
577  m_dcf->UpdateFailedCw ();
578  }
581 }
582 
583 void
584 DcaTxop::GotAck (double snr, WifiMode txMode)
585 {
586  NS_LOG_FUNCTION (this << snr << txMode);
587  if (!NeedFragmentation ()
588  || IsLastFragment ())
589  {
590  NS_LOG_DEBUG ("got ack. tx done.");
591  if (!m_txOkCallback.IsNull ())
592  {
594  }
595 
596  /* we are not fragmenting or we are done fragmenting
597  * so we can get rid of that packet now.
598  */
599  m_currentPacket = 0;
600  m_dcf->ResetCw ();
603  }
604  else
605  {
606  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
607  }
608 }
609 
610 void
612 {
613  NS_LOG_FUNCTION (this);
614  NS_LOG_DEBUG ("missed ack");
615  if (!NeedDataRetransmission ())
616  {
617  NS_LOG_DEBUG ("Ack Fail");
619  if (!m_txFailedCallback.IsNull ())
620  {
622  }
623  //to reset the dcf.
624  m_currentPacket = 0;
625  m_dcf->ResetCw ();
626  }
627  else
628  {
629  NS_LOG_DEBUG ("Retransmit");
631  m_dcf->UpdateFailedCw ();
632  }
635 }
636 
637 void
639 {
640  NS_LOG_FUNCTION (this);
641  NS_LOG_DEBUG ("start next packet fragment");
642  /* this callback is used only for fragments. */
643  NextFragment ();
644  WifiMacHeader hdr;
645  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
647  params.EnableAck ();
648  params.DisableRts ();
649  params.DisableOverrideDurationId ();
650  if (IsLastFragment ())
651  {
652  params.DisableNextData ();
653  }
654  else
655  {
657  }
658  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
659 }
660 
661 void
663 {
664  NS_LOG_FUNCTION (this);
665  NS_LOG_DEBUG ("transmission cancelled");
691 }
692 
693 void
695 {
696  NS_LOG_FUNCTION (this);
697  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
698  m_currentPacket = 0;
699  m_dcf->ResetCw ();
702 }
703 
704 } //namespace ns3
void SetRetry(void)
Set the Retry bit in the Frame Control field.
void NotifyInternalCollision(void)
Notify the DCF that internal collision has occurred.
Definition: dca-txop.cc:511
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: dcf-manager.cc:62
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
virtual uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: dca-txop.cc:275
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: dca-txop.cc:409
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual bool IsEdca(void) const
Definition: dca-txop.cc:51
uint8_t m_fragmentNumber
Definition: dca-txop.h:338
Introspection did not find any typical Config paths.
Definition: dcf.h:33
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: dca-txop.cc:60
void SetTxFailedCallback(TxFailed callback)
Definition: dca-txop.cc:226
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:103
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
virtual void MissedAck(void)
ns3::MacLow did not receive an expected ACK within AckTimeout.
Definition: dca-txop.cc:118
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: dca-txop.cc:247
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:526
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
Definition: dca-txop.cc:96
Ptr< MacLow > m_low
Definition: dca-txop.h:330
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: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
void StartNextFragment(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:638
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
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:792
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:338
TxOk m_txOkCallback
Definition: dca-txop.h:326
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:282
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:56
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)
friend class Dcf
Definition: dca-txop.h:163
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:115
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: dca-txop.cc:306
void PrepareForQueue(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
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
void Add(DcfState *dcf)
Definition: dcf-manager.cc:424
virtual void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:106
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dcf-manager.cc:97
static TypeId GetTypeId(void)
Definition: dca-txop.cc:145
control how a packet is transmitted.
Definition: mac-low.h:311
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:219
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:534
Handles sequence numbering of IEEE 802.11 data frames.
Definition: mac-tx-middle.h:39
Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
Get the next fragment from the packet with appropriate Wifi header for the fragment.
Definition: dca-txop.cc:417
virtual void GotAck(double snr, WifiMode txMode)
Definition: dca-txop.cc:114
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
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: dca-txop.cc:296
virtual Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dca-txop.cc:289
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:205
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:370
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:328
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 Cancel(void)
Cancel the transmission.
Definition: dca-txop.cc:662
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:552
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
Definition: dca-txop.cc:526
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:559
virtual void DoNotifySleep(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to sleep.
Definition: dca-txop.cc:72
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:279
bool IsLastFragment(void)
Check if the curren fragment is the last fragment.
Definition: dca-txop.cc:393
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:169
Ptr< WifiRemoteStationManager > m_stationManager
Definition: dca-txop.h:331
virtual void DoNotifyChannelSwitching(void)
Called by DcfManager to notify a DcfState subclass that a channel switching occured.
Definition: dca-txop.cc:68
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
Definition: dcf-manager.cc:109
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-manager.cc:69
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, MacLowTransmissionListener *listener)
Definition: mac-low.cc:724
DcaTxop * m_txop
Definition: dca-txop.cc:81
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:254
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:212
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:136
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Definition: pointer.h:36
void DoInitialize()
Initialize() implementation.
Definition: dca-txop.cc:345
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:438
WifiMacHeader m_currentHdr
Definition: dca-txop.h:337
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:189
uint32_t GetFragmentSize(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
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: dca-txop.cc:133
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:233
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: dca-txop.cc:129
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:354
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:204
friend class TransmissionListener
Definition: dca-txop.h:165
void NotifyWakeUp(void)
When wake up operation occurs, channel access will be restarted.
Definition: dca-txop.cc:545
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:336
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: dca-txop.cc:110
Listener for MacLow events.
Definition: dca-txop.cc:88
MacTxMiddle * m_txMiddle
Definition: dca-txop.h:329
DcfManager * m_manager
Definition: dca-txop.h:325
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:80
virtual void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: dca-txop.cc:240
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:584
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: dca-txop.cc:64
virtual void SetTxopLimit(Time txopLimit)
Definition: dca-txop.cc:261
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
uint32_t GetCw(void) const
Definition: dcf-manager.cc:151
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-manager.cc:91
virtual void StartNextFragment(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:122
void SetManager(DcfManager *manager)
Set DcfManager this DcaTxop is associated to.
Definition: dca-txop.cc:192
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:236
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
Definition: dca-txop.cc:401
virtual void StartNext(void)
Invoked when ns3::MacLow wants to continue the TXOP.
Definition: dca-txop.cc:126
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:176
void EnableNextData(uint32_t size)
Definition: mac-low.cc:144
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:518
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:159
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:326
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:378
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:149
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:332
virtual void DoNotifyAccessGranted(void)
Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start...
Definition: dca-txop.cc:56
void RestartAccessIfNeeded(void)
Restart access request if needed.
Definition: dca-txop.cc:314
virtual void DoNotifyWakeUp(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to wake up...
Definition: dca-txop.cc:76
void SetTxMiddle(MacTxMiddle *txMiddle)
Set MacTxMiddle this DcaTxop is associated to.
Definition: dca-txop.cc:199
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.
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: dcf-manager.cc:121
void MissedAck(void)
Event handler when an ACK is missed.
Definition: dca-txop.cc:611
handle packet fragmentation and retransmissions.
Definition: dca-txop.h:67
Dcf(DcaTxop *txop)
Definition: dca-txop.cc:47
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:194
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:362
virtual uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: dca-txop.cc:268
Dcf * m_dcf
Definition: dca-txop.h:324
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:385
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.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:444
Implements the IEEE 802.11 MAC header.
Implements the IEEE 802.11 MAC trailer.
void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
Definition: dca-txop.cc:694
RandomStream * m_rng
Definition: dca-txop.h:333
TxFailed m_txFailedCallback
Definition: dca-txop.h:327