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 
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  }
69  virtual void DoNotifySleep (void)
70  {
71  m_txop->NotifySleep ();
72  }
73  virtual void DoNotifyWakeUp (void)
74  {
75  m_txop->NotifyWakeUp ();
76  }
77 
79 };
80 
81 
86 {
87 public:
95  m_txop (txop)
96  {
97  }
98 
100  {
101  }
102 
103  virtual void GotCts (double snr, WifiMode txMode)
104  {
105  m_txop->GotCts (snr, txMode);
106  }
107  virtual void MissedCts (void)
108  {
109  m_txop->MissedCts ();
110  }
111  virtual void GotAck (double snr, WifiMode txMode)
112  {
113  m_txop->GotAck (snr, txMode);
114  }
115  virtual void MissedAck (void)
116  {
117  m_txop->MissedAck ();
118  }
119  virtual void StartNext (void)
120  {
121  m_txop->StartNext ();
122  }
123  virtual void Cancel (void)
124  {
125  m_txop->Cancel ();
126  }
127  virtual void EndTxNoAck (void)
128  {
129  m_txop->EndTxNoAck ();
130  }
131 
132 private:
134 };
135 
137 
138 TypeId
140 {
141  static TypeId tid = TypeId ("ns3::DcaTxop")
142  .SetParent<ns3::Dcf> ()
143  .SetGroupName ("Wifi")
144  .AddConstructor<DcaTxop> ()
145  .AddAttribute ("Queue", "The WifiMacQueue object",
146  PointerValue (),
148  MakePointerChecker<WifiMacQueue> ())
149  ;
150  return tid;
151 }
152 
154  : m_manager (0),
155  m_currentPacket (0)
156 {
157  NS_LOG_FUNCTION (this);
159  m_dcf = new DcaTxop::Dcf (this);
160  m_queue = CreateObject<WifiMacQueue> ();
161  m_rng = new RealRandomStream ();
162 }
163 
165 {
166  NS_LOG_FUNCTION (this);
167 }
168 
169 void
171 {
172  NS_LOG_FUNCTION (this);
173  m_queue = 0;
174  m_low = 0;
175  m_stationManager = 0;
176  delete m_transmissionListener;
177  delete m_dcf;
178  delete m_rng;
180  m_dcf = 0;
181  m_rng = 0;
182  m_txMiddle = 0;
183 }
184 
185 void
187 {
188  NS_LOG_FUNCTION (this << manager);
189  m_manager = manager;
190  m_manager->Add (m_dcf);
191 }
192 
194 {
195  m_txMiddle = txMiddle;
196 }
197 
198 void
200 {
201  NS_LOG_FUNCTION (this << low);
202  m_low = low;
203 }
204 
205 void
207 {
208  NS_LOG_FUNCTION (this << remoteManager);
209  m_stationManager = remoteManager;
210 }
211 
212 void
214 {
215  NS_LOG_FUNCTION (this << &callback);
216  m_txOkCallback = callback;
217 }
218 
219 void
221 {
222  NS_LOG_FUNCTION (this << &callback);
223  m_txFailedCallback = callback;
224 }
225 
228 {
229  NS_LOG_FUNCTION (this);
230  return m_queue;
231 }
232 
233 void
234 DcaTxop::SetMinCw (uint32_t minCw)
235 {
236  NS_LOG_FUNCTION (this << minCw);
237  m_dcf->SetCwMin (minCw);
238 }
239 
240 void
241 DcaTxop::SetMaxCw (uint32_t maxCw)
242 {
243  NS_LOG_FUNCTION (this << maxCw);
244  m_dcf->SetCwMax (maxCw);
245 }
246 
247 void
248 DcaTxop::SetAifsn (uint32_t aifsn)
249 {
250  NS_LOG_FUNCTION (this << aifsn);
251  m_dcf->SetAifsn (aifsn);
252 }
253 
254 uint32_t
255 DcaTxop::GetMinCw (void) const
256 {
257  NS_LOG_FUNCTION (this);
258  return m_dcf->GetCwMin ();
259 }
260 
261 uint32_t
262 DcaTxop::GetMaxCw (void) const
263 {
264  NS_LOG_FUNCTION (this);
265  return m_dcf->GetCwMax ();
266 }
267 
268 uint32_t
269 DcaTxop::GetAifsn (void) const
270 {
271  NS_LOG_FUNCTION (this);
272  return m_dcf->GetAifsn ();
273 }
274 
275 void
277 {
278  NS_LOG_FUNCTION (this << packet << &hdr);
279  WifiMacTrailer fcs;
280  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
282  packet, fullPacketSize);
283  m_queue->Enqueue (packet, hdr);
285 }
286 
287 int64_t
288 DcaTxop::AssignStreams (int64_t stream)
289 {
290  NS_LOG_FUNCTION (this << stream);
291  m_rng->AssignStreams (stream);
292  return 1;
293 }
294 
295 void
297 {
298  NS_LOG_FUNCTION (this);
299  if ((m_currentPacket != 0
300  || !m_queue->IsEmpty ())
301  && !m_dcf->IsAccessRequested ())
302  {
304  }
305 }
306 
307 void
309 {
310  NS_LOG_FUNCTION (this);
311  if (m_currentPacket == 0
312  && !m_queue->IsEmpty ()
313  && !m_dcf->IsAccessRequested ())
314  {
316  }
317 }
318 
321 {
322  NS_LOG_FUNCTION (this);
323  return m_low;
324 }
325 
326 bool
328 {
329  NS_LOG_FUNCTION (this << packet << header);
330  return m_stationManager->NeedRts (header->GetAddr1 (), header,
331  packet);
332 }
333 
334 void
336 {
337  NS_LOG_FUNCTION (this);
338  m_dcf->ResetCw ();
341 }
342 
343 bool
345 {
346  NS_LOG_FUNCTION (this);
349 }
350 
351 bool
353 {
354  NS_LOG_FUNCTION (this);
357 }
358 
359 bool
361 {
362  NS_LOG_FUNCTION (this);
365 }
366 
367 void
369 {
370  NS_LOG_FUNCTION (this);
372 }
373 
374 uint32_t
376 {
377  NS_LOG_FUNCTION (this);
380 }
381 
382 bool
384 {
385  NS_LOG_FUNCTION (this);
388 }
389 
390 uint32_t
392 {
393  NS_LOG_FUNCTION (this);
396 }
397 
398 uint32_t
400 {
401  NS_LOG_FUNCTION (this);
404 }
405 
408 {
409  NS_LOG_FUNCTION (this << hdr);
410  *hdr = m_currentHdr;
412  uint32_t startOffset = GetFragmentOffset ();
413  Ptr<Packet> fragment;
414  if (IsLastFragment ())
415  {
416  hdr->SetNoMoreFragments ();
417  }
418  else
419  {
420  hdr->SetMoreFragments ();
421  }
422  fragment = m_currentPacket->CreateFragment (startOffset,
423  GetFragmentSize ());
424  return fragment;
425 }
426 
427 bool
429 {
430  NS_LOG_FUNCTION (this);
431  return !m_queue->IsEmpty () || m_currentPacket != 0;
432 }
433 void
435 {
436  NS_LOG_FUNCTION (this);
437  if (m_currentPacket == 0)
438  {
439  if (m_queue->IsEmpty ())
440  {
441  NS_LOG_DEBUG ("queue empty");
442  return;
443  }
444  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
445  NS_ASSERT (m_currentPacket != 0);
446  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
447  m_currentHdr.SetSequenceNumber (sequence);
452  m_fragmentNumber = 0;
453  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
454  ", to=" << m_currentHdr.GetAddr1 () <<
455  ", seq=" << m_currentHdr.GetSequenceControl ());
456  }
458  params.DisableOverrideDurationId ();
459  if (m_currentHdr.GetAddr1 ().IsGroup ())
460  {
461  params.DisableRts ();
462  params.DisableAck ();
463  params.DisableNextData ();
465  &m_currentHdr,
466  params,
468  NS_LOG_DEBUG ("tx broadcast");
469  }
470  else
471  {
472  params.EnableAck ();
473 
474  if (NeedFragmentation ())
475  {
476  WifiMacHeader hdr;
477  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
478  if (NeedRts (fragment, &hdr))
479  {
480  params.EnableRts ();
481  }
482  else
483  {
484  params.DisableRts ();
485  }
486  if (IsLastFragment ())
487  {
488  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
489  params.DisableNextData ();
490  }
491  else
492  {
493  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
495  }
496  Low ()->StartTransmission (fragment, &hdr, params,
498  }
499  else
500  {
502  {
503  params.EnableRts ();
504  NS_LOG_DEBUG ("tx unicast rts");
505  }
506  else
507  {
508  params.DisableRts ();
509  NS_LOG_DEBUG ("tx unicast");
510  }
511  params.DisableNextData ();
513  params, m_transmissionListener);
514  }
515  }
516 }
517 
518 void
520 {
521  NS_LOG_FUNCTION (this);
522  NotifyCollision ();
523 }
524 
525 void
527 {
528  NS_LOG_FUNCTION (this);
529  NS_LOG_DEBUG ("collision");
532 }
533 
534 void
536 {
537  NS_LOG_FUNCTION (this);
538  m_queue->Flush ();
539  m_currentPacket = 0;
540 }
541 
542 void
544 {
545  NS_LOG_FUNCTION (this);
546  if (m_currentPacket != 0)
547  {
548  m_queue->PushFront (m_currentPacket, m_currentHdr);
549  m_currentPacket = 0;
550  }
551 }
552 
553 void
555 {
556  NS_LOG_FUNCTION (this);
558 }
559 
560 void
561 DcaTxop::GotCts (double snr, WifiMode txMode)
562 {
563  NS_LOG_FUNCTION (this << snr << txMode);
564  NS_LOG_DEBUG ("got cts");
565 }
566 
567 void
569 {
570  NS_LOG_FUNCTION (this);
571  NS_LOG_DEBUG ("missed cts");
572  if (!NeedRtsRetransmission ())
573  {
574  NS_LOG_DEBUG ("Cts Fail");
576  if (!m_txFailedCallback.IsNull ())
577  {
579  }
580  //to reset the dcf.
581  m_currentPacket = 0;
582  m_dcf->ResetCw ();
583  }
584  else
585  {
586  m_dcf->UpdateFailedCw ();
587  }
590 }
591 
592 void
593 DcaTxop::GotAck (double snr, WifiMode txMode)
594 {
595  NS_LOG_FUNCTION (this << snr << txMode);
596  if (!NeedFragmentation ()
597  || IsLastFragment ())
598  {
599  NS_LOG_DEBUG ("got ack. tx done.");
600  if (!m_txOkCallback.IsNull ())
601  {
603  }
604 
605  /* we are not fragmenting or we are done fragmenting
606  * so we can get rid of that packet now.
607  */
608  m_currentPacket = 0;
609  m_dcf->ResetCw ();
612  }
613  else
614  {
615  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
616  }
617 }
618 
619 void
621 {
622  NS_LOG_FUNCTION (this);
623  NS_LOG_DEBUG ("missed ack");
624  if (!NeedDataRetransmission ())
625  {
626  NS_LOG_DEBUG ("Ack Fail");
628  if (!m_txFailedCallback.IsNull ())
629  {
631  }
632  //to reset the dcf.
633  m_currentPacket = 0;
634  m_dcf->ResetCw ();
635  }
636  else
637  {
638  NS_LOG_DEBUG ("Retransmit");
640  m_dcf->UpdateFailedCw ();
641  }
644 }
645 
646 void
648 {
649  NS_LOG_FUNCTION (this);
650  NS_LOG_DEBUG ("start next packet fragment");
651  /* this callback is used only for fragments. */
652  NextFragment ();
653  WifiMacHeader hdr;
654  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
656  params.EnableAck ();
657  params.DisableRts ();
658  params.DisableOverrideDurationId ();
659  if (IsLastFragment ())
660  {
661  params.DisableNextData ();
662  }
663  else
664  {
666  }
667  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
668 }
669 
670 void
672 {
673  NS_LOG_FUNCTION (this);
674  NS_LOG_DEBUG ("transmission cancelled");
700 }
701 
702 void
704 {
705  NS_LOG_FUNCTION (this);
706  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
707  m_currentPacket = 0;
708  m_dcf->ResetCw ();
711 }
712 
713 } //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:519
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:262
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:399
#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:346
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:57
void SetTxFailedCallback(TxFailed callback)
Definition: dca-txop.cc:220
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:82
#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:115
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dca-txop.cc:241
void StartNext(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:647
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:479
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
Definition: dca-txop.cc:93
Ptr< MacLow > m_low
Definition: dca-txop.h:338
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:320
TxOk m_txOkCallback
Definition: dca-txop.h:334
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:269
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:94
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:288
listen to events coming from ns3::MacLow.
Definition: mac-low.h:61
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
void Add(DcfState *dcf)
Definition: dcf-manager.cc:397
virtual void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:103
static TypeId GetTypeId(void)
Definition: dca-txop.cc:139
control how a packet is transmitted.
Definition: mac-low.h:296
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:213
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:543
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:407
virtual void GotAck(double snr, WifiMode txMode)
Definition: dca-txop.cc:111
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:276
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:199
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:360
virtual uint32_t GetSerializedSize(void) const
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:336
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:671
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:561
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:535
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:568
virtual void DoNotifySleep(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to sleep.
Definition: dca-txop.cc:69
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:252
bool IsLastFragment(void)
Check if the curren fragment is the last fragment.
Definition: dca-txop.cc:383
keep track of the state needed for a single DCF function.
Definition: dcf-manager.h:46
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:142
Ptr< WifiRemoteStationManager > m_stationManager
Definition: dca-txop.h:339
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:88
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:327
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:722
DcaTxop * m_txop
Definition: dca-txop.cc:78
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:248
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:206
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:115
void PrepareForQueue(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fullPacketSize)
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:335
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:428
WifiMacHeader m_currentHdr
Definition: dca-txop.h:345
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:184
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:127
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:227
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: dca-txop.cc:123
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:344
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:199
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:554
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:344
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: dca-txop.cc:107
Listener for MacLow events.
Definition: dca-txop.cc:85
MacTxMiddle * m_txMiddle
Definition: dca-txop.h:337
DcfManager * m_manager
Definition: dca-txop.h:333
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-manager.cc:69
virtual void SetMinCw(uint32_t minCw)
Set the minimum congestion window size.
Definition: dca-txop.cc:234
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:593
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
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:194
uint32_t GetCw(void) const
Definition: dcf-manager.cc:124
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-manager.cc:76
void SetManager(DcfManager *manager)
Set DcfManager this DcaTxop is associated to.
Definition: dca-txop.cc:186
#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:391
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:119
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:170
void EnableNextData(uint32_t size)
Definition: mac-low.cc:139
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:526
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:154
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:308
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:368
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:144
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:340
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:296
virtual void DoNotifyWakeUp(void)
Called by DcfManager to notify a DcfState subclass that the device has begun to wake up...
Definition: dca-txop.cc:73
void SetTxMiddle(MacTxMiddle *txMiddle)
Set MacTxMiddle this DcaTxop is associated to.
Definition: dca-txop.cc:193
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:100
bool NeedRts(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
void MissedAck(void)
Event handler when an ACK is received.
Definition: dca-txop.cc:620
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:189
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:352
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
Definition: dca-txop.cc:255
Dcf * m_dcf
Definition: dca-txop.h:332
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:375
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:434
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:703
virtual uint32_t GetSerializedSize(void) const
RandomStream * m_rng
Definition: dca-txop.h:341
TxFailed m_txFailedCallback
Definition: dca-txop.h:335