A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
29 #include "dca-txop.h"
30 #include "dcf-manager.h"
31 #include "mac-low.h"
32 #include "wifi-mac-queue.h"
33 #include "mac-tx-middle.h"
34 #include "wifi-mac-trailer.h"
35 #include "wifi-mac.h"
36 #include "random-stream.h"
37 
38 NS_LOG_COMPONENT_DEFINE ("DcaTxop");
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 DcaTxop::Dcf : public DcfState
46 {
47 public:
48  Dcf (DcaTxop * 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 
76 {
77 public:
85  m_txop (txop) {
86  }
87 
88  virtual ~TransmissionListener () {}
89 
90  virtual void GotCts (double snr, WifiMode txMode)
91  {
92  m_txop->GotCts (snr, txMode);
93  }
94  virtual void MissedCts (void)
95  {
96  m_txop->MissedCts ();
97  }
98  virtual void GotAck (double snr, WifiMode txMode)
99  {
100  m_txop->GotAck (snr, txMode);
101  }
102  virtual void MissedAck (void)
103  {
104  m_txop->MissedAck ();
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 TypeId
127 {
128  static TypeId tid = TypeId ("ns3::DcaTxop")
131  .AddAttribute ("Queue", "The WifiMacQueue object",
132  PointerValue (),
133  MakePointerAccessor (&DcaTxop::GetQueue),
134  MakePointerChecker<WifiMacQueue> ())
135  ;
136  return tid;
137 }
138 
140  : m_manager (0),
141  m_currentPacket (0)
142 {
143  NS_LOG_FUNCTION (this);
145  m_dcf = new DcaTxop::Dcf (this);
146  m_queue = CreateObject<WifiMacQueue> ();
147  m_rng = new RealRandomStream ();
148 }
149 
151 {
152  NS_LOG_FUNCTION (this);
153 }
154 
155 void
157 {
158  NS_LOG_FUNCTION (this);
159  m_queue = 0;
160  m_low = 0;
161  m_stationManager = 0;
162  delete m_transmissionListener;
163  delete m_dcf;
164  delete m_rng;
166  m_dcf = 0;
167  m_rng = 0;
168  m_txMiddle = 0;
169 }
170 
171 void
173 {
174  NS_LOG_FUNCTION (this << manager);
175  m_manager = manager;
176  m_manager->Add (m_dcf);
177 }
178 
180 {
181  m_txMiddle = txMiddle;
182 }
183 
184 void
186 {
187  NS_LOG_FUNCTION (this << low);
188  m_low = low;
189 }
190 void
192 {
193  NS_LOG_FUNCTION (this << remoteManager);
194  m_stationManager = remoteManager;
195 }
196 void
198 {
199  NS_LOG_FUNCTION (this << &callback);
200  m_txOkCallback = callback;
201 }
202 void
204 {
205  NS_LOG_FUNCTION (this << &callback);
206  m_txFailedCallback = callback;
207 }
208 
211 {
212  NS_LOG_FUNCTION (this);
213  return m_queue;
214 }
215 
216 void
217 DcaTxop::SetMinCw (uint32_t minCw)
218 {
219  NS_LOG_FUNCTION (this << minCw);
220  m_dcf->SetCwMin (minCw);
221 }
222 void
223 DcaTxop::SetMaxCw (uint32_t maxCw)
224 {
225  NS_LOG_FUNCTION (this << maxCw);
226  m_dcf->SetCwMax (maxCw);
227 }
228 void
229 DcaTxop::SetAifsn (uint32_t aifsn)
230 {
231  NS_LOG_FUNCTION (this << aifsn);
232  m_dcf->SetAifsn (aifsn);
233 }
234 uint32_t
235 DcaTxop::GetMinCw (void) const
236 {
237  NS_LOG_FUNCTION (this);
238  return m_dcf->GetCwMin ();
239 }
240 uint32_t
241 DcaTxop::GetMaxCw (void) const
242 {
243  NS_LOG_FUNCTION (this);
244  return m_dcf->GetCwMax ();
245 }
246 uint32_t
247 DcaTxop::GetAifsn (void) const
248 {
249  NS_LOG_FUNCTION (this);
250  return m_dcf->GetAifsn ();
251 }
252 
253 void
255 {
256  NS_LOG_FUNCTION (this << packet << &hdr);
257  WifiMacTrailer fcs;
258  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
259  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
260  packet, fullPacketSize);
261  m_queue->Enqueue (packet, hdr);
263 }
264 
265 int64_t
266 DcaTxop::AssignStreams (int64_t stream)
267 {
268  NS_LOG_FUNCTION (this << stream);
269  m_rng->AssignStreams (stream);
270  return 1;
271 }
272 
273 void
275 {
276  NS_LOG_FUNCTION (this);
277  if ((m_currentPacket != 0
278  || !m_queue->IsEmpty ())
279  && !m_dcf->IsAccessRequested ())
280  {
282  }
283 }
284 
285 void
287 {
288  NS_LOG_FUNCTION (this);
289  if (m_currentPacket == 0
290  && !m_queue->IsEmpty ()
291  && !m_dcf->IsAccessRequested ())
292  {
294  }
295 }
296 
297 
300 {
301  NS_LOG_FUNCTION (this);
302  return m_low;
303 }
304 
305 bool
307 {
308  NS_LOG_FUNCTION (this << packet << header);
309  return m_stationManager->NeedRts (header->GetAddr1 (), header,
310  packet);
311 }
312 
313 void
315 {
316  NS_LOG_FUNCTION (this);
317  m_dcf->ResetCw ();
320 }
321 bool
323 {
324  NS_LOG_FUNCTION (this);
325  return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
327 }
328 
329 bool
331 {
332  NS_LOG_FUNCTION (this);
333  return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
335 }
336 bool
338 {
339  NS_LOG_FUNCTION (this);
340  return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
342 }
343 
344 void
346 {
347  NS_LOG_FUNCTION (this);
349 }
350 
351 uint32_t
353 {
354  NS_LOG_FUNCTION (this);
355  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
357 }
358 bool
360 {
361  NS_LOG_FUNCTION (this);
362  return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
364 }
365 
366 uint32_t
368 {
369  NS_LOG_FUNCTION (this);
370  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
372 }
373 
374 uint32_t
376 {
377  NS_LOG_FUNCTION (this);
378  return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
380 }
381 
384 {
385  NS_LOG_FUNCTION (this << hdr);
386  *hdr = m_currentHdr;
388  uint32_t startOffset = GetFragmentOffset ();
389  Ptr<Packet> fragment;
390  if (IsLastFragment ())
391  {
392  hdr->SetNoMoreFragments ();
393  }
394  else
395  {
396  hdr->SetMoreFragments ();
397  }
398  fragment = m_currentPacket->CreateFragment (startOffset,
399  GetFragmentSize ());
400  return fragment;
401 }
402 
403 bool
405 {
406  NS_LOG_FUNCTION (this);
407  return !m_queue->IsEmpty () || m_currentPacket != 0;
408 }
409 void
411 {
412  NS_LOG_FUNCTION (this);
413  if (m_currentPacket == 0)
414  {
415  if (m_queue->IsEmpty ())
416  {
417  NS_LOG_DEBUG ("queue empty");
418  return;
419  }
420  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
421  NS_ASSERT (m_currentPacket != 0);
422  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
423  m_currentHdr.SetSequenceNumber (sequence);
427  m_fragmentNumber = 0;
428  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
429  ", to=" << m_currentHdr.GetAddr1 () <<
430  ", seq=" << m_currentHdr.GetSequenceControl ());
431  }
433  params.DisableOverrideDurationId ();
434  if (m_currentHdr.GetAddr1 ().IsGroup ())
435  {
436  params.DisableRts ();
437  params.DisableAck ();
438  params.DisableNextData ();
439  Low ()->StartTransmission (m_currentPacket,
440  &m_currentHdr,
441  params,
443  NS_LOG_DEBUG ("tx broadcast");
444  }
445  else
446  {
447  params.EnableAck ();
448 
449  if (NeedFragmentation ())
450  {
451  WifiMacHeader hdr;
452  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
453  if (NeedRts (fragment, &hdr))
454  {
455  params.EnableRts ();
456  }
457  else
458  {
459  params.DisableRts ();
460  }
461  if (IsLastFragment ())
462  {
463  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
464  params.DisableNextData ();
465  }
466  else
467  {
468  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
470  }
471  Low ()->StartTransmission (fragment, &hdr, params,
473  }
474  else
475  {
477  {
478  params.EnableRts ();
479  NS_LOG_DEBUG ("tx unicast rts");
480  }
481  else
482  {
483  params.DisableRts ();
484  NS_LOG_DEBUG ("tx unicast");
485  }
486  params.DisableNextData ();
487  Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
488  params, m_transmissionListener);
489  }
490  }
491 }
492 
493 void
495 {
496  NS_LOG_FUNCTION (this);
497  NotifyCollision ();
498 }
499 void
501 {
502  NS_LOG_FUNCTION (this);
503  NS_LOG_DEBUG ("collision");
506 }
507 
508 void
510 {
511  NS_LOG_FUNCTION (this);
512  m_queue->Flush ();
513  m_currentPacket = 0;
514 }
515 
516 void
517 DcaTxop::GotCts (double snr, WifiMode txMode)
518 {
519  NS_LOG_FUNCTION (this << snr << txMode);
520  NS_LOG_DEBUG ("got cts");
521 }
522 void
524 {
525  NS_LOG_FUNCTION (this);
526  NS_LOG_DEBUG ("missed cts");
527  if (!NeedRtsRetransmission ())
528  {
529  NS_LOG_DEBUG ("Cts Fail");
530  m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
531  if (!m_txFailedCallback.IsNull ())
532  {
534  }
535  // to reset the dcf.
536  m_currentPacket = 0;
537  m_dcf->ResetCw ();
538  }
539  else
540  {
541  m_dcf->UpdateFailedCw ();
542  }
545 }
546 void
547 DcaTxop::GotAck (double snr, WifiMode txMode)
548 {
549  NS_LOG_FUNCTION (this << snr << txMode);
550  if (!NeedFragmentation ()
551  || IsLastFragment ())
552  {
553  NS_LOG_DEBUG ("got ack. tx done.");
554  if (!m_txOkCallback.IsNull ())
555  {
557  }
558 
559  /* we are not fragmenting or we are done fragmenting
560  * so we can get rid of that packet now.
561  */
562  m_currentPacket = 0;
563  m_dcf->ResetCw ();
566  }
567  else
568  {
569  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
570  }
571 }
572 void
574 {
575  NS_LOG_FUNCTION (this);
576  NS_LOG_DEBUG ("missed ack");
577  if (!NeedDataRetransmission ())
578  {
579  NS_LOG_DEBUG ("Ack Fail");
580  m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
581  if (!m_txFailedCallback.IsNull ())
582  {
584  }
585  // to reset the dcf.
586  m_currentPacket = 0;
587  m_dcf->ResetCw ();
588  }
589  else
590  {
591  NS_LOG_DEBUG ("Retransmit");
593  m_dcf->UpdateFailedCw ();
594  }
597 }
598 void
600 {
601  NS_LOG_FUNCTION (this);
602  NS_LOG_DEBUG ("start next packet fragment");
603  /* this callback is used only for fragments. */
604  NextFragment ();
605  WifiMacHeader hdr;
606  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
608  params.EnableAck ();
609  params.DisableRts ();
610  params.DisableOverrideDurationId ();
611  if (IsLastFragment ())
612  {
613  params.DisableNextData ();
614  }
615  else
616  {
618  }
619  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
620 }
621 
622 void
624 {
625  NS_LOG_FUNCTION (this);
626  NS_LOG_DEBUG ("transmission cancelled");
652 }
653 
654 void
656 {
657  NS_LOG_FUNCTION (this);
658  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
659  m_currentPacket = 0;
660  m_dcf->ResetCw ();
663 }
664 
665 } // 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:494
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
virtual uint32_t GetMaxCw(void) const
Return the maximum congestion window size.
Definition: dca-txop.cc:241
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: dca-txop.cc:375
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t m_fragmentNumber
Definition: dca-txop.h:326
TypeId AddConstructor(void)
Definition: type-id.h:418
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:57
void SetTxFailedCallback(TxFailed callback)
Definition: dca-txop.cc:203
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-manager.cc:79
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
virtual void MissedAck(void)
ns3::MacLow did not receive an expected ACK within AckTimeout.
Definition: dca-txop.cc:102
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dca-txop.cc:223
void StartNext(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:599
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:423
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
Definition: dca-txop.cc:83
Ptr< MacLow > m_low
Definition: dca-txop.h:318
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1018
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:299
TxOk m_txOkCallback
Definition: dca-txop.h:314
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:247
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:57
friend class Dcf
Definition: dca-txop.h:158
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
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:266
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
void Add(DcfState *dcf)
Definition: dcf-manager.cc:343
virtual void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:90
static TypeId GetTypeId(void)
Definition: dca-txop.cc:126
control how a packet is transmitted.
Definition: mac-low.h:218
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:197
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:383
virtual void GotAck(double snr, WifiMode txMode)
Definition: dca-txop.cc:98
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:254
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:185
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:337
virtual uint32_t GetSerializedSize(void) const
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:316
void Cancel(void)
Cancel the transmission.
Definition: dca-txop.cc:623
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:517
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:509
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:523
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:229
bool IsLastFragment(void)
Check if the curren fragment is the last fragment.
Definition: dca-txop.cc:359
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:133
Ptr< WifiRemoteStationManager > m_stationManager
Definition: dca-txop.h:319
virtual void DoNotifyChannelSwitching(void)
Called by DcfManager to notify a DcfState subclass that a channel switching occured.
Definition: dca-txop.cc:65
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
Definition: dcf-manager.cc:84
bool NeedRts(Ptr< const Packet > packet, const WifiMacHeader *header)
Check if the current packet should be sent with a RTS protection.
Definition: dca-txop.cc:306
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-manager.cc:62
DcaTxop * m_txop
Definition: dca-txop.cc:69
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:229
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:191
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:109
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.
hold objects of type Ptr
Definition: pointer.h:33
void DoInitialize()
This method is called only once by Object::Initialize.
Definition: dca-txop.cc:314
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:404
WifiMacHeader m_currentHdr
Definition: dca-txop.h:325
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:128
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:114
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:210
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: dca-txop.cc:110
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:322
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:143
friend class TransmissionListener
Definition: dca-txop.h:160
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:324
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: dca-txop.cc:94
Listener for MacLow events.
Definition: dca-txop.cc:75
MacTxMiddle * m_txMiddle
Definition: dca-txop.h:317
DcfManager * m_manager
Definition: dca-txop.h:313
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:68
virtual void SetMinCw(uint32_t minCw)
Set the minimum congestion window size.
Definition: dca-txop.cc:217
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:547
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:61
static TypeId GetTypeId(void)
Definition: dcf.cc:31
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
Definition: mac-low.cc:138
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 SetManager(DcfManager *manager)
Set DcfManager this DcaTxop is associated to.
Definition: dca-txop.cc:172
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
Definition: dca-txop.cc:367
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:106
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: dca-txop.cc:156
void EnableNextData(uint32_t size)
Definition: mac-low.cc:83
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:500
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
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:286
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:345
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:88
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:320
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:53
void RestartAccessIfNeeded(void)
Restart access request if needed.
Definition: dca-txop.cc:274
void SetTxMiddle(MacTxMiddle *txMiddle)
Set MacTxMiddle this DcaTxop is associated to.
Definition: dca-txop.cc:179
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:95
void MissedAck(void)
Event handler when an ACK is received.
Definition: dca-txop.cc:573
handle packet fragmentation and retransmissions.
Definition: dca-txop.h:67
Dcf(DcaTxop *txop)
Definition: dca-txop.cc:48
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
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:330
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
Definition: dca-txop.cc:235
Dcf * m_dcf
Definition: dca-txop.h:312
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:352
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:410
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:342
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:655
virtual uint32_t GetSerializedSize(void) const
RandomStream * m_rng
Definition: dca-txop.h:321
TxFailed m_txFailedCallback
Definition: dca-txop.h:315