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 StartNext (void)
123  {
124  m_txop->StartNext ();
125  }
126  virtual void Cancel (void)
127  {
128  m_txop->Cancel ();
129  }
130  virtual void EndTxNoAck (void)
131  {
132  m_txop->EndTxNoAck ();
133  }
134 
135 private:
137 };
138 
140 
141 TypeId
143 {
144  static TypeId tid = TypeId ("ns3::DcaTxop")
145  .SetParent<ns3::Dcf> ()
146  .SetGroupName ("Wifi")
147  .AddConstructor<DcaTxop> ()
148  .AddAttribute ("Queue", "The WifiMacQueue object",
149  PointerValue (),
151  MakePointerChecker<WifiMacQueue> ())
152  ;
153  return tid;
154 }
155 
157  : m_manager (0),
158  m_currentPacket (0)
159 {
160  NS_LOG_FUNCTION (this);
162  m_dcf = new DcaTxop::Dcf (this);
163  m_queue = CreateObject<WifiMacQueue> ();
164  m_rng = new RealRandomStream ();
165 }
166 
168 {
169  NS_LOG_FUNCTION (this);
170 }
171 
172 void
174 {
175  NS_LOG_FUNCTION (this);
176  m_queue = 0;
177  m_low = 0;
178  m_stationManager = 0;
179  delete m_transmissionListener;
180  delete m_dcf;
181  delete m_rng;
183  m_dcf = 0;
184  m_rng = 0;
185  m_txMiddle = 0;
186 }
187 
188 void
190 {
191  NS_LOG_FUNCTION (this << manager);
192  m_manager = manager;
193  m_manager->Add (m_dcf);
194 }
195 
197 {
198  m_txMiddle = txMiddle;
199 }
200 
201 void
203 {
204  NS_LOG_FUNCTION (this << low);
205  m_low = low;
206 }
207 
208 void
210 {
211  NS_LOG_FUNCTION (this << remoteManager);
212  m_stationManager = remoteManager;
213 }
214 
215 void
217 {
218  NS_LOG_FUNCTION (this << &callback);
219  m_txOkCallback = callback;
220 }
221 
222 void
224 {
225  NS_LOG_FUNCTION (this << &callback);
226  m_txFailedCallback = callback;
227 }
228 
231 {
232  NS_LOG_FUNCTION (this);
233  return m_queue;
234 }
235 
236 void
237 DcaTxop::SetMinCw (uint32_t minCw)
238 {
239  NS_LOG_FUNCTION (this << minCw);
240  m_dcf->SetCwMin (minCw);
241 }
242 
243 void
244 DcaTxop::SetMaxCw (uint32_t maxCw)
245 {
246  NS_LOG_FUNCTION (this << maxCw);
247  m_dcf->SetCwMax (maxCw);
248 }
249 
250 void
251 DcaTxop::SetAifsn (uint32_t aifsn)
252 {
253  NS_LOG_FUNCTION (this << aifsn);
254  m_dcf->SetAifsn (aifsn);
255 }
256 
257 uint32_t
258 DcaTxop::GetMinCw (void) const
259 {
260  NS_LOG_FUNCTION (this);
261  return m_dcf->GetCwMin ();
262 }
263 
264 uint32_t
265 DcaTxop::GetMaxCw (void) const
266 {
267  NS_LOG_FUNCTION (this);
268  return m_dcf->GetCwMax ();
269 }
270 
271 uint32_t
272 DcaTxop::GetAifsn (void) const
273 {
274  NS_LOG_FUNCTION (this);
275  return m_dcf->GetAifsn ();
276 }
277 
278 void
280 {
281  NS_LOG_FUNCTION (this << packet << &hdr);
282  WifiMacTrailer fcs;
283  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet);
284  m_queue->Enqueue (packet, hdr);
286 }
287 
288 int64_t
289 DcaTxop::AssignStreams (int64_t stream)
290 {
291  NS_LOG_FUNCTION (this << stream);
292  m_rng->AssignStreams (stream);
293  return 1;
294 }
295 
296 void
298 {
299  NS_LOG_FUNCTION (this);
300  if ((m_currentPacket != 0
301  || !m_queue->IsEmpty ())
302  && !m_dcf->IsAccessRequested ())
303  {
305  }
306 }
307 
308 void
310 {
311  NS_LOG_FUNCTION (this);
312  if (m_currentPacket == 0
313  && !m_queue->IsEmpty ()
314  && !m_dcf->IsAccessRequested ())
315  {
317  }
318 }
319 
322 {
323  NS_LOG_FUNCTION (this);
324  return m_low;
325 }
326 
327 void
329 {
330  NS_LOG_FUNCTION (this);
331  m_dcf->ResetCw ();
334 }
335 
336 bool
338 {
339  NS_LOG_FUNCTION (this);
342 }
343 
344 bool
346 {
347  NS_LOG_FUNCTION (this);
350 }
351 
352 bool
354 {
355  NS_LOG_FUNCTION (this);
358 }
359 
360 void
362 {
363  NS_LOG_FUNCTION (this);
365 }
366 
367 uint32_t
369 {
370  NS_LOG_FUNCTION (this);
373 }
374 
375 bool
377 {
378  NS_LOG_FUNCTION (this);
381 }
382 
383 uint32_t
385 {
386  NS_LOG_FUNCTION (this);
389 }
390 
391 uint32_t
393 {
394  NS_LOG_FUNCTION (this);
397 }
398 
401 {
402  NS_LOG_FUNCTION (this << hdr);
403  *hdr = m_currentHdr;
405  uint32_t startOffset = GetFragmentOffset ();
406  Ptr<Packet> fragment;
407  if (IsLastFragment ())
408  {
409  hdr->SetNoMoreFragments ();
410  }
411  else
412  {
413  hdr->SetMoreFragments ();
414  }
415  fragment = m_currentPacket->CreateFragment (startOffset,
416  GetFragmentSize ());
417  return fragment;
418 }
419 
420 bool
422 {
423  NS_LOG_FUNCTION (this);
424  return !m_queue->IsEmpty () || m_currentPacket != 0;
425 }
426 void
428 {
429  NS_LOG_FUNCTION (this);
430  if (m_currentPacket == 0)
431  {
432  if (m_queue->IsEmpty ())
433  {
434  NS_LOG_DEBUG ("queue empty");
435  return;
436  }
437  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
438  NS_ASSERT (m_currentPacket != 0);
439  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
440  m_currentHdr.SetSequenceNumber (sequence);
445  m_fragmentNumber = 0;
446  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
447  ", to=" << m_currentHdr.GetAddr1 () <<
448  ", seq=" << m_currentHdr.GetSequenceControl ());
449  }
451  params.DisableOverrideDurationId ();
452  if (m_currentHdr.GetAddr1 ().IsGroup ())
453  {
454  params.DisableRts ();
455  params.DisableAck ();
456  params.DisableNextData ();
458  &m_currentHdr,
459  params,
461  NS_LOG_DEBUG ("tx broadcast");
462  }
463  else
464  {
465  params.EnableAck ();
466 
467  if (NeedFragmentation ())
468  {
469  WifiMacHeader hdr;
470  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
471  if (IsLastFragment ())
472  {
473  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
474  params.DisableNextData ();
475  }
476  else
477  {
478  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
480  }
481  Low ()->StartTransmission (fragment, &hdr, params,
483  }
484  else
485  {
486  params.DisableNextData ();
488  params, m_transmissionListener);
489  }
490  }
491 }
492 
493 void
495 {
496  NS_LOG_FUNCTION (this);
497  NotifyCollision ();
498 }
499 
500 void
502 {
503  NS_LOG_FUNCTION (this);
504  NS_LOG_DEBUG ("collision");
507 }
508 
509 void
511 {
512  NS_LOG_FUNCTION (this);
513  m_queue->Flush ();
514  m_currentPacket = 0;
515 }
516 
517 void
519 {
520  NS_LOG_FUNCTION (this);
521  if (m_currentPacket != 0)
522  {
523  m_queue->PushFront (m_currentPacket, m_currentHdr);
524  m_currentPacket = 0;
525  }
526 }
527 
528 void
530 {
531  NS_LOG_FUNCTION (this);
533 }
534 
535 void
536 DcaTxop::GotCts (double snr, WifiMode txMode)
537 {
538  NS_LOG_FUNCTION (this << snr << txMode);
539  NS_LOG_DEBUG ("got cts");
540 }
541 
542 void
544 {
545  NS_LOG_FUNCTION (this);
546  NS_LOG_DEBUG ("missed cts");
547  if (!NeedRtsRetransmission ())
548  {
549  NS_LOG_DEBUG ("Cts Fail");
551  if (!m_txFailedCallback.IsNull ())
552  {
554  }
555  //to reset the dcf.
556  m_currentPacket = 0;
557  m_dcf->ResetCw ();
558  }
559  else
560  {
561  m_dcf->UpdateFailedCw ();
562  }
565 }
566 
567 void
568 DcaTxop::GotAck (double snr, WifiMode txMode)
569 {
570  NS_LOG_FUNCTION (this << snr << txMode);
571  if (!NeedFragmentation ()
572  || IsLastFragment ())
573  {
574  NS_LOG_DEBUG ("got ack. tx done.");
575  if (!m_txOkCallback.IsNull ())
576  {
578  }
579 
580  /* we are not fragmenting or we are done fragmenting
581  * so we can get rid of that packet now.
582  */
583  m_currentPacket = 0;
584  m_dcf->ResetCw ();
587  }
588  else
589  {
590  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
591  }
592 }
593 
594 void
596 {
597  NS_LOG_FUNCTION (this);
598  NS_LOG_DEBUG ("missed ack");
599  if (!NeedDataRetransmission ())
600  {
601  NS_LOG_DEBUG ("Ack Fail");
603  if (!m_txFailedCallback.IsNull ())
604  {
606  }
607  //to reset the dcf.
608  m_currentPacket = 0;
609  m_dcf->ResetCw ();
610  }
611  else
612  {
613  NS_LOG_DEBUG ("Retransmit");
615  m_dcf->UpdateFailedCw ();
616  }
619 }
620 
621 void
623 {
624  NS_LOG_FUNCTION (this);
625  NS_LOG_DEBUG ("start next packet fragment");
626  /* this callback is used only for fragments. */
627  NextFragment ();
628  WifiMacHeader hdr;
629  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
631  params.EnableAck ();
632  params.DisableRts ();
633  params.DisableOverrideDurationId ();
634  if (IsLastFragment ())
635  {
636  params.DisableNextData ();
637  }
638  else
639  {
641  }
642  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
643 }
644 
645 void
647 {
648  NS_LOG_FUNCTION (this);
649  NS_LOG_DEBUG ("transmission cancelled");
675 }
676 
677 void
679 {
680  NS_LOG_FUNCTION (this);
681  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
682  m_currentPacket = 0;
683  m_dcf->ResetCw ();
686 }
687 
688 } //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 contention window size.
Definition: dca-txop.cc:265
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:346
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: dca-txop.cc:392
#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:336
Introspection did not find any typical Config paths.
Definition: dcf.h:32
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:223
bool NeedDataRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-manager.cc:90
#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:244
void StartNext(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:622
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:487
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
Definition: dca-txop.cc:96
Ptr< MacLow > m_low
Definition: dca-txop.h:328
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:1258
#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
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:786
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:321
TxOk m_txOkCallback
Definition: dca-txop.h:324
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:272
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:161
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Definition: dcf-manager.cc:102
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:289
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:405
virtual void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:106
static TypeId GetTypeId(void)
Definition: dca-txop.cc:142
control how a packet is transmitted.
Definition: mac-low.h:305
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:216
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:518
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:400
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:279
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:202
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:353
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:326
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:646
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:536
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:510
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:543
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:262
bool IsLastFragment(void)
Check if the curren fragment is the last fragment.
Definition: dca-txop.cc:376
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:150
Ptr< WifiRemoteStationManager > m_stationManager
Definition: dca-txop.h:329
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:96
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-manager.cc:62
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:251
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:209
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:123
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:328
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:421
WifiMacHeader m_currentHdr
Definition: dca-txop.h:335
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:188
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:130
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:230
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: dca-txop.cc:126
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:337
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:203
friend class TransmissionListener
Definition: dca-txop.h:163
void NotifyWakeUp(void)
When wake up operation occurs, channel access will be restarted.
Definition: dca-txop.cc:529
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:334
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:327
DcfManager * m_manager
Definition: dca-txop.h:323
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:73
virtual void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: dca-txop.cc:237
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:568
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
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
uint32_t GetCw(void) const
Definition: dcf-manager.cc:132
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-manager.cc:84
void SetManager(DcfManager *manager)
Set DcfManager this DcaTxop is associated to.
Definition: dca-txop.cc:189
#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:384
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:122
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:173
void EnableNextData(uint32_t size)
Definition: mac-low.cc:143
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:501
void DisableOverrideDurationId(void)
Do not force the duration/id field of the packet: its value is automatically calculated by the MacLow...
Definition: mac-low.cc:158
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:309
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:361
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:148
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:330
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:297
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:196
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:108
void MissedAck(void)
Event handler when an ACK is missed.
Definition: dca-txop.cc:595
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:193
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:345
virtual uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: dca-txop.cc:258
Dcf * m_dcf
Definition: dca-txop.h:322
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:368
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:826
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:427
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:678
RandomStream * m_rng
Definition: dca-txop.h:331
TxFailed m_txFailedCallback
Definition: dca-txop.h:325