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 
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 #undef NS_LOG_APPEND_CONTEXT
39 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
40 
41 namespace ns3 {
42 
43 NS_LOG_COMPONENT_DEFINE ("DcaTxop");
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  }
69  virtual void DoNotifySleep (void)
70  {
71  m_txop->NotifySleep ();
72  }
73  virtual void DoNotifyWakeUp (void)
74  {
75  m_txop->NotifyWakeUp ();
76  }
78 };
79 
84 {
85 public:
93  m_txop (txop) {
94  }
95 
96  virtual ~TransmissionListener () {}
97 
98  virtual void GotCts (double snr, WifiMode txMode)
99  {
100  m_txop->GotCts (snr, txMode);
101  }
102  virtual void MissedCts (void)
103  {
104  m_txop->MissedCts ();
105  }
106  virtual void GotAck (double snr, WifiMode txMode)
107  {
108  m_txop->GotAck (snr, txMode);
109  }
110  virtual void MissedAck (void)
111  {
112  m_txop->MissedAck ();
113  }
114  virtual void StartNext (void)
115  {
116  m_txop->StartNext ();
117  }
118  virtual void Cancel (void)
119  {
120  m_txop->Cancel ();
121  }
122  virtual void EndTxNoAck (void)
123  {
124  m_txop->EndTxNoAck ();
125  }
126 
127 private:
129 };
130 
132 
133 TypeId
135 {
136  static TypeId tid = TypeId ("ns3::DcaTxop")
139  .AddAttribute ("Queue", "The WifiMacQueue object",
140  PointerValue (),
142  MakePointerChecker<WifiMacQueue> ())
143  ;
144  return tid;
145 }
146 
148  : m_manager (0),
149  m_currentPacket (0)
150 {
151  NS_LOG_FUNCTION (this);
153  m_dcf = new DcaTxop::Dcf (this);
154  m_queue = CreateObject<WifiMacQueue> ();
155  m_rng = new RealRandomStream ();
156 }
157 
159 {
160  NS_LOG_FUNCTION (this);
161 }
162 
163 void
165 {
166  NS_LOG_FUNCTION (this);
167  m_queue = 0;
168  m_low = 0;
169  m_stationManager = 0;
170  delete m_transmissionListener;
171  delete m_dcf;
172  delete m_rng;
174  m_dcf = 0;
175  m_rng = 0;
176  m_txMiddle = 0;
177 }
178 
179 void
181 {
182  NS_LOG_FUNCTION (this << manager);
183  m_manager = manager;
184  m_manager->Add (m_dcf);
185 }
186 
188 {
189  m_txMiddle = txMiddle;
190 }
191 
192 void
194 {
195  NS_LOG_FUNCTION (this << low);
196  m_low = low;
197 }
198 void
200 {
201  NS_LOG_FUNCTION (this << remoteManager);
202  m_stationManager = remoteManager;
203 }
204 void
206 {
207  NS_LOG_FUNCTION (this << &callback);
208  m_txOkCallback = callback;
209 }
210 void
212 {
213  NS_LOG_FUNCTION (this << &callback);
214  m_txFailedCallback = callback;
215 }
216 
219 {
220  NS_LOG_FUNCTION (this);
221  return m_queue;
222 }
223 
224 void
225 DcaTxop::SetMinCw (uint32_t minCw)
226 {
227  NS_LOG_FUNCTION (this << minCw);
228  m_dcf->SetCwMin (minCw);
229 }
230 void
231 DcaTxop::SetMaxCw (uint32_t maxCw)
232 {
233  NS_LOG_FUNCTION (this << maxCw);
234  m_dcf->SetCwMax (maxCw);
235 }
236 void
237 DcaTxop::SetAifsn (uint32_t aifsn)
238 {
239  NS_LOG_FUNCTION (this << aifsn);
240  m_dcf->SetAifsn (aifsn);
241 }
242 uint32_t
243 DcaTxop::GetMinCw (void) const
244 {
245  NS_LOG_FUNCTION (this);
246  return m_dcf->GetCwMin ();
247 }
248 uint32_t
249 DcaTxop::GetMaxCw (void) const
250 {
251  NS_LOG_FUNCTION (this);
252  return m_dcf->GetCwMax ();
253 }
254 uint32_t
255 DcaTxop::GetAifsn (void) const
256 {
257  NS_LOG_FUNCTION (this);
258  return m_dcf->GetAifsn ();
259 }
260 
261 void
263 {
264  NS_LOG_FUNCTION (this << packet << &hdr);
265  WifiMacTrailer fcs;
266  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
267  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr,
268  packet, fullPacketSize);
269  m_queue->Enqueue (packet, hdr);
271 }
272 
273 int64_t
274 DcaTxop::AssignStreams (int64_t stream)
275 {
276  NS_LOG_FUNCTION (this << stream);
277  m_rng->AssignStreams (stream);
278  return 1;
279 }
280 
281 void
283 {
284  NS_LOG_FUNCTION (this);
285  if ((m_currentPacket != 0
286  || !m_queue->IsEmpty ())
287  && !m_dcf->IsAccessRequested ())
288  {
290  }
291 }
292 
293 void
295 {
296  NS_LOG_FUNCTION (this);
297  if (m_currentPacket == 0
298  && !m_queue->IsEmpty ()
299  && !m_dcf->IsAccessRequested ())
300  {
302  }
303 }
304 
305 
308 {
309  NS_LOG_FUNCTION (this);
310  return m_low;
311 }
312 
313 bool
315 {
316  NS_LOG_FUNCTION (this << packet << header);
317  return m_stationManager->NeedRts (header->GetAddr1 (), header,
318  packet);
319 }
320 
321 void
323 {
324  NS_LOG_FUNCTION (this);
325  m_dcf->ResetCw ();
328 }
329 bool
331 {
332  NS_LOG_FUNCTION (this);
333  return m_stationManager->NeedRtsRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
335 }
336 
337 bool
339 {
340  NS_LOG_FUNCTION (this);
341  return m_stationManager->NeedDataRetransmission (m_currentHdr.GetAddr1 (), &m_currentHdr,
343 }
344 bool
346 {
347  NS_LOG_FUNCTION (this);
348  return m_stationManager->NeedFragmentation (m_currentHdr.GetAddr1 (), &m_currentHdr,
350 }
351 
352 void
354 {
355  NS_LOG_FUNCTION (this);
357 }
358 
359 uint32_t
361 {
362  NS_LOG_FUNCTION (this);
363  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
365 }
366 bool
368 {
369  NS_LOG_FUNCTION (this);
370  return m_stationManager->IsLastFragment (m_currentHdr.GetAddr1 (), &m_currentHdr,
372 }
373 
374 uint32_t
376 {
377  NS_LOG_FUNCTION (this);
378  return m_stationManager->GetFragmentSize (m_currentHdr.GetAddr1 (), &m_currentHdr,
380 }
381 
382 uint32_t
384 {
385  NS_LOG_FUNCTION (this);
386  return m_stationManager->GetFragmentOffset (m_currentHdr.GetAddr1 (), &m_currentHdr,
388 }
389 
392 {
393  NS_LOG_FUNCTION (this << hdr);
394  *hdr = m_currentHdr;
396  uint32_t startOffset = GetFragmentOffset ();
397  Ptr<Packet> fragment;
398  if (IsLastFragment ())
399  {
400  hdr->SetNoMoreFragments ();
401  }
402  else
403  {
404  hdr->SetMoreFragments ();
405  }
406  fragment = m_currentPacket->CreateFragment (startOffset,
407  GetFragmentSize ());
408  return fragment;
409 }
410 
411 bool
413 {
414  NS_LOG_FUNCTION (this);
415  return !m_queue->IsEmpty () || m_currentPacket != 0;
416 }
417 void
419 {
420  NS_LOG_FUNCTION (this);
421  if (m_currentPacket == 0)
422  {
423  if (m_queue->IsEmpty ())
424  {
425  NS_LOG_DEBUG ("queue empty");
426  return;
427  }
428  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
429  NS_ASSERT (m_currentPacket != 0);
430  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
431  m_currentHdr.SetSequenceNumber (sequence);
435  m_fragmentNumber = 0;
436  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
437  ", to=" << m_currentHdr.GetAddr1 () <<
438  ", seq=" << m_currentHdr.GetSequenceControl ());
439  }
441  params.DisableOverrideDurationId ();
442  if (m_currentHdr.GetAddr1 ().IsGroup ())
443  {
444  params.DisableRts ();
445  params.DisableAck ();
446  params.DisableNextData ();
447  Low ()->StartTransmission (m_currentPacket,
448  &m_currentHdr,
449  params,
451  NS_LOG_DEBUG ("tx broadcast");
452  }
453  else
454  {
455  params.EnableAck ();
456 
457  if (NeedFragmentation ())
458  {
459  WifiMacHeader hdr;
460  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
461  if (NeedRts (fragment, &hdr))
462  {
463  params.EnableRts ();
464  }
465  else
466  {
467  params.DisableRts ();
468  }
469  if (IsLastFragment ())
470  {
471  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
472  params.DisableNextData ();
473  }
474  else
475  {
476  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
478  }
479  Low ()->StartTransmission (fragment, &hdr, params,
481  }
482  else
483  {
485  {
486  params.EnableRts ();
487  NS_LOG_DEBUG ("tx unicast rts");
488  }
489  else
490  {
491  params.DisableRts ();
492  NS_LOG_DEBUG ("tx unicast");
493  }
494  params.DisableNextData ();
495  Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
496  params, m_transmissionListener);
497  }
498  }
499 }
500 
501 void
503 {
504  NS_LOG_FUNCTION (this);
505  NotifyCollision ();
506 }
507 void
509 {
510  NS_LOG_FUNCTION (this);
511  NS_LOG_DEBUG ("collision");
514 }
515 
516 void
518 {
519  NS_LOG_FUNCTION (this);
520  m_queue->Flush ();
521  m_currentPacket = 0;
522 }
523 void
525 {
526  NS_LOG_FUNCTION (this);
527  if (m_currentPacket != 0)
528  {
529  m_queue->PushFront (m_currentPacket, m_currentHdr);
530  m_currentPacket = 0;
531  }
532 }
533 void
535 {
536  NS_LOG_FUNCTION (this);
538 }
539 
540 void
541 DcaTxop::GotCts (double snr, WifiMode txMode)
542 {
543  NS_LOG_FUNCTION (this << snr << txMode);
544  NS_LOG_DEBUG ("got cts");
545 }
546 void
548 {
549  NS_LOG_FUNCTION (this);
550  NS_LOG_DEBUG ("missed cts");
551  if (!NeedRtsRetransmission ())
552  {
553  NS_LOG_DEBUG ("Cts Fail");
554  m_stationManager->ReportFinalRtsFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
555  if (!m_txFailedCallback.IsNull ())
556  {
558  }
559  // to reset the dcf.
560  m_currentPacket = 0;
561  m_dcf->ResetCw ();
562  }
563  else
564  {
565  m_dcf->UpdateFailedCw ();
566  }
569 }
570 void
571 DcaTxop::GotAck (double snr, WifiMode txMode)
572 {
573  NS_LOG_FUNCTION (this << snr << txMode);
574  if (!NeedFragmentation ()
575  || IsLastFragment ())
576  {
577  NS_LOG_DEBUG ("got ack. tx done.");
578  if (!m_txOkCallback.IsNull ())
579  {
581  }
582 
583  /* we are not fragmenting or we are done fragmenting
584  * so we can get rid of that packet now.
585  */
586  m_currentPacket = 0;
587  m_dcf->ResetCw ();
590  }
591  else
592  {
593  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
594  }
595 }
596 void
598 {
599  NS_LOG_FUNCTION (this);
600  NS_LOG_DEBUG ("missed ack");
601  if (!NeedDataRetransmission ())
602  {
603  NS_LOG_DEBUG ("Ack Fail");
604  m_stationManager->ReportFinalDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
605  if (!m_txFailedCallback.IsNull ())
606  {
608  }
609  // to reset the dcf.
610  m_currentPacket = 0;
611  m_dcf->ResetCw ();
612  }
613  else
614  {
615  NS_LOG_DEBUG ("Retransmit");
617  m_dcf->UpdateFailedCw ();
618  }
621 }
622 void
624 {
625  NS_LOG_FUNCTION (this);
626  NS_LOG_DEBUG ("start next packet fragment");
627  /* this callback is used only for fragments. */
628  NextFragment ();
629  WifiMacHeader hdr;
630  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
632  params.EnableAck ();
633  params.DisableRts ();
634  params.DisableOverrideDurationId ();
635  if (IsLastFragment ())
636  {
637  params.DisableNextData ();
638  }
639  else
640  {
642  }
643  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
644 }
645 
646 void
648 {
649  NS_LOG_FUNCTION (this);
650  NS_LOG_DEBUG ("transmission cancelled");
676 }
677 
678 void
680 {
681  NS_LOG_FUNCTION (this);
682  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
683  m_currentPacket = 0;
684  m_dcf->ResetCw ();
687 }
688 
689 } // 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:502
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:249
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: dca-txop.cc:383
#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:335
TypeId AddConstructor(void)
Definition: type-id.h:454
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:211
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-manager.cc:79
#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:110
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dca-txop.cc:231
void StartNext(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:623
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:455
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
Definition: dca-txop.cc:91
Ptr< MacLow > m_low
Definition: dca-txop.h:327
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:1072
#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:201
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:766
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:307
TxOk m_txOkCallback
Definition: dca-txop.h:323
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:255
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:274
listen to events coming from ns3::MacLow.
Definition: mac-low.h:58
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
void Add(DcfState *dcf)
Definition: dcf-manager.cc:375
virtual void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:98
static TypeId GetTypeId(void)
Definition: dca-txop.cc:134
control how a packet is transmitted.
Definition: mac-low.h:285
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:205
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:524
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:391
virtual void GotAck(double snr, WifiMode txMode)
Definition: dca-txop.cc:106
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:262
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:193
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:345
virtual uint32_t GetSerializedSize(void) const
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:325
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:210
void Cancel(void)
Cancel the transmission.
Definition: dca-txop.cc:647
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:541
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:517
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:547
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:367
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:328
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:314
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-manager.cc:62
DcaTxop * m_txop
Definition: dca-txop.cc:77
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:237
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:199
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.
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:322
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:412
WifiMacHeader m_currentHdr
Definition: dca-txop.h:334
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:171
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:122
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:218
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
Definition: dca-txop.cc:118
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:330
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:186
friend class TransmissionListener
Definition: dca-txop.h:160
void NotifyWakeUp(void)
When wake up operation occurs, channel access will be restarted.
Definition: dca-txop.cc:534
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:333
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Definition: dca-txop.cc:102
Listener for MacLow events.
Definition: dca-txop.cc:83
MacTxMiddle * m_txMiddle
Definition: dca-txop.h:326
DcfManager * m_manager
Definition: dca-txop.h:322
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:225
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:571
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:181
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:180
#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:375
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:114
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:164
void EnableNextData(uint32_t size)
Definition: mac-low.cc:126
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:508
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:141
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:294
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:353
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:131
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:329
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:282
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:187
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:597
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:176
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:338
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
Definition: dca-txop.cc:243
Dcf * m_dcf
Definition: dca-txop.h:321
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:360
a unique identifier for an interface.
Definition: type-id.h:51
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:418
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:345
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:679
virtual uint32_t GetSerializedSize(void) const
RandomStream * m_rng
Definition: dca-txop.h:330
TxFailed m_txFailedCallback
Definition: dca-txop.h:324