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")
138  .SetGroupName ("Wifi")
140  .AddAttribute ("Queue", "The WifiMacQueue object",
141  PointerValue (),
143  MakePointerChecker<WifiMacQueue> ())
144  ;
145  return tid;
146 }
147 
149  : m_manager (0),
150  m_currentPacket (0)
151 {
152  NS_LOG_FUNCTION (this);
154  m_dcf = new DcaTxop::Dcf (this);
155  m_queue = CreateObject<WifiMacQueue> ();
156  m_rng = new RealRandomStream ();
157 }
158 
160 {
161  NS_LOG_FUNCTION (this);
162 }
163 
164 void
166 {
167  NS_LOG_FUNCTION (this);
168  m_queue = 0;
169  m_low = 0;
170  m_stationManager = 0;
171  delete m_transmissionListener;
172  delete m_dcf;
173  delete m_rng;
175  m_dcf = 0;
176  m_rng = 0;
177  m_txMiddle = 0;
178 }
179 
180 void
182 {
183  NS_LOG_FUNCTION (this << manager);
184  m_manager = manager;
185  m_manager->Add (m_dcf);
186 }
187 
189 {
190  m_txMiddle = txMiddle;
191 }
192 
193 void
195 {
196  NS_LOG_FUNCTION (this << low);
197  m_low = low;
198 }
199 void
201 {
202  NS_LOG_FUNCTION (this << remoteManager);
203  m_stationManager = remoteManager;
204 }
205 void
207 {
208  NS_LOG_FUNCTION (this << &callback);
209  m_txOkCallback = callback;
210 }
211 void
213 {
214  NS_LOG_FUNCTION (this << &callback);
215  m_txFailedCallback = callback;
216 }
217 
220 {
221  NS_LOG_FUNCTION (this);
222  return m_queue;
223 }
224 
225 void
226 DcaTxop::SetMinCw (uint32_t minCw)
227 {
228  NS_LOG_FUNCTION (this << minCw);
229  m_dcf->SetCwMin (minCw);
230 }
231 void
232 DcaTxop::SetMaxCw (uint32_t maxCw)
233 {
234  NS_LOG_FUNCTION (this << maxCw);
235  m_dcf->SetCwMax (maxCw);
236 }
237 void
238 DcaTxop::SetAifsn (uint32_t aifsn)
239 {
240  NS_LOG_FUNCTION (this << aifsn);
241  m_dcf->SetAifsn (aifsn);
242 }
243 uint32_t
244 DcaTxop::GetMinCw (void) const
245 {
246  NS_LOG_FUNCTION (this);
247  return m_dcf->GetCwMin ();
248 }
249 uint32_t
250 DcaTxop::GetMaxCw (void) const
251 {
252  NS_LOG_FUNCTION (this);
253  return m_dcf->GetCwMax ();
254 }
255 uint32_t
256 DcaTxop::GetAifsn (void) const
257 {
258  NS_LOG_FUNCTION (this);
259  return m_dcf->GetAifsn ();
260 }
261 
262 void
264 {
265  NS_LOG_FUNCTION (this << packet << &hdr);
266  WifiMacTrailer fcs;
267  uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize ();
269  packet, fullPacketSize);
270  m_queue->Enqueue (packet, hdr);
272 }
273 
274 int64_t
275 DcaTxop::AssignStreams (int64_t stream)
276 {
277  NS_LOG_FUNCTION (this << stream);
278  m_rng->AssignStreams (stream);
279  return 1;
280 }
281 
282 void
284 {
285  NS_LOG_FUNCTION (this);
286  if ((m_currentPacket != 0
287  || !m_queue->IsEmpty ())
288  && !m_dcf->IsAccessRequested ())
289  {
291  }
292 }
293 
294 void
296 {
297  NS_LOG_FUNCTION (this);
298  if (m_currentPacket == 0
299  && !m_queue->IsEmpty ()
300  && !m_dcf->IsAccessRequested ())
301  {
303  }
304 }
305 
306 
309 {
310  NS_LOG_FUNCTION (this);
311  return m_low;
312 }
313 
314 bool
316 {
317  NS_LOG_FUNCTION (this << packet << header);
318  return m_stationManager->NeedRts (header->GetAddr1 (), header,
319  packet);
320 }
321 
322 void
324 {
325  NS_LOG_FUNCTION (this);
326  m_dcf->ResetCw ();
329 }
330 bool
332 {
333  NS_LOG_FUNCTION (this);
336 }
337 
338 bool
340 {
341  NS_LOG_FUNCTION (this);
344 }
345 bool
347 {
348  NS_LOG_FUNCTION (this);
351 }
352 
353 void
355 {
356  NS_LOG_FUNCTION (this);
358 }
359 
360 uint32_t
362 {
363  NS_LOG_FUNCTION (this);
366 }
367 bool
369 {
370  NS_LOG_FUNCTION (this);
373 }
374 
375 uint32_t
377 {
378  NS_LOG_FUNCTION (this);
381 }
382 
383 uint32_t
385 {
386  NS_LOG_FUNCTION (this);
389 }
390 
393 {
394  NS_LOG_FUNCTION (this << hdr);
395  *hdr = m_currentHdr;
397  uint32_t startOffset = GetFragmentOffset ();
398  Ptr<Packet> fragment;
399  if (IsLastFragment ())
400  {
401  hdr->SetNoMoreFragments ();
402  }
403  else
404  {
405  hdr->SetMoreFragments ();
406  }
407  fragment = m_currentPacket->CreateFragment (startOffset,
408  GetFragmentSize ());
409  return fragment;
410 }
411 
412 bool
414 {
415  NS_LOG_FUNCTION (this);
416  return !m_queue->IsEmpty () || m_currentPacket != 0;
417 }
418 void
420 {
421  NS_LOG_FUNCTION (this);
422  if (m_currentPacket == 0)
423  {
424  if (m_queue->IsEmpty ())
425  {
426  NS_LOG_DEBUG ("queue empty");
427  return;
428  }
429  m_currentPacket = m_queue->Dequeue (&m_currentHdr);
430  NS_ASSERT (m_currentPacket != 0);
431  uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr);
432  m_currentHdr.SetSequenceNumber (sequence);
436  m_fragmentNumber = 0;
437  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
438  ", to=" << m_currentHdr.GetAddr1 () <<
439  ", seq=" << m_currentHdr.GetSequenceControl ());
440  }
442  params.DisableOverrideDurationId ();
443  if (m_currentHdr.GetAddr1 ().IsGroup ())
444  {
445  params.DisableRts ();
446  params.DisableAck ();
447  params.DisableNextData ();
449  &m_currentHdr,
450  params,
452  NS_LOG_DEBUG ("tx broadcast");
453  }
454  else
455  {
456  params.EnableAck ();
457 
458  if (NeedFragmentation ())
459  {
460  WifiMacHeader hdr;
461  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
462  if (NeedRts (fragment, &hdr))
463  {
464  params.EnableRts ();
465  }
466  else
467  {
468  params.DisableRts ();
469  }
470  if (IsLastFragment ())
471  {
472  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
473  params.DisableNextData ();
474  }
475  else
476  {
477  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
479  }
480  Low ()->StartTransmission (fragment, &hdr, params,
482  }
483  else
484  {
486  {
487  params.EnableRts ();
488  NS_LOG_DEBUG ("tx unicast rts");
489  }
490  else
491  {
492  params.DisableRts ();
493  NS_LOG_DEBUG ("tx unicast");
494  }
495  params.DisableNextData ();
497  params, m_transmissionListener);
498  }
499  }
500 }
501 
502 void
504 {
505  NS_LOG_FUNCTION (this);
506  NotifyCollision ();
507 }
508 void
510 {
511  NS_LOG_FUNCTION (this);
512  NS_LOG_DEBUG ("collision");
515 }
516 
517 void
519 {
520  NS_LOG_FUNCTION (this);
521  m_queue->Flush ();
522  m_currentPacket = 0;
523 }
524 void
526 {
527  NS_LOG_FUNCTION (this);
528  if (m_currentPacket != 0)
529  {
530  m_queue->PushFront (m_currentPacket, m_currentHdr);
531  m_currentPacket = 0;
532  }
533 }
534 void
536 {
537  NS_LOG_FUNCTION (this);
539 }
540 
541 void
542 DcaTxop::GotCts (double snr, WifiMode txMode)
543 {
544  NS_LOG_FUNCTION (this << snr << txMode);
545  NS_LOG_DEBUG ("got cts");
546 }
547 void
549 {
550  NS_LOG_FUNCTION (this);
551  NS_LOG_DEBUG ("missed cts");
552  if (!NeedRtsRetransmission ())
553  {
554  NS_LOG_DEBUG ("Cts Fail");
556  if (!m_txFailedCallback.IsNull ())
557  {
559  }
560  // to reset the dcf.
561  m_currentPacket = 0;
562  m_dcf->ResetCw ();
563  }
564  else
565  {
566  m_dcf->UpdateFailedCw ();
567  }
570 }
571 void
572 DcaTxop::GotAck (double snr, WifiMode txMode)
573 {
574  NS_LOG_FUNCTION (this << snr << txMode);
575  if (!NeedFragmentation ()
576  || IsLastFragment ())
577  {
578  NS_LOG_DEBUG ("got ack. tx done.");
579  if (!m_txOkCallback.IsNull ())
580  {
582  }
583 
584  /* we are not fragmenting or we are done fragmenting
585  * so we can get rid of that packet now.
586  */
587  m_currentPacket = 0;
588  m_dcf->ResetCw ();
591  }
592  else
593  {
594  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
595  }
596 }
597 void
599 {
600  NS_LOG_FUNCTION (this);
601  NS_LOG_DEBUG ("missed ack");
602  if (!NeedDataRetransmission ())
603  {
604  NS_LOG_DEBUG ("Ack Fail");
606  if (!m_txFailedCallback.IsNull ())
607  {
609  }
610  // to reset the dcf.
611  m_currentPacket = 0;
612  m_dcf->ResetCw ();
613  }
614  else
615  {
616  NS_LOG_DEBUG ("Retransmit");
618  m_dcf->UpdateFailedCw ();
619  }
622 }
623 void
625 {
626  NS_LOG_FUNCTION (this);
627  NS_LOG_DEBUG ("start next packet fragment");
628  /* this callback is used only for fragments. */
629  NextFragment ();
630  WifiMacHeader hdr;
631  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
633  params.EnableAck ();
634  params.DisableRts ();
635  params.DisableOverrideDurationId ();
636  if (IsLastFragment ())
637  {
638  params.DisableNextData ();
639  }
640  else
641  {
643  }
644  Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener);
645 }
646 
647 void
649 {
650  NS_LOG_FUNCTION (this);
651  NS_LOG_DEBUG ("transmission cancelled");
677 }
678 
679 void
681 {
682  NS_LOG_FUNCTION (this);
683  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
684  m_currentPacket = 0;
685  m_dcf->ResetCw ();
688 }
689 
690 } // 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:503
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:250
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
Definition: dca-txop.cc:384
#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:460
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:212
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: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:232
void StartNext(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:624
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:1078
#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:766
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:308
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:256
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:57
bool IsLastFragment(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
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:275
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: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:296
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:206
void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:525
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:392
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:263
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:194
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Definition: dca-txop.cc:346
virtual uint32_t GetSerializedSize(void) const
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:325
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:210
void Cancel(void)
Cancel the transmission.
Definition: dca-txop.cc:648
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
Definition: dca-txop.cc:542
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:518
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:548
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:368
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:315
TypeId SetGroupName(std::string groupName)
Definition: type-id.cc:645
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:683
DcaTxop * m_txop
Definition: dca-txop.cc:77
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:238
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:200
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:109
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:323
bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:413
WifiMacHeader m_currentHdr
Definition: dca-txop.h:334
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:187
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:122
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:219
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:331
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:202
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:535
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:226
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
Definition: dca-txop.cc:572
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:197
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:181
#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:376
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
Definition: dca-txop.cc:114
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:165
void EnableNextData(uint32_t size)
Definition: mac-low.cc:142
void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:509
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:157
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:295
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:354
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:147
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
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:283
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:188
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
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:598
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:192
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:339
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
Definition: dca-txop.cc:244
Dcf * m_dcf
Definition: dca-txop.h:321
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
Definition: dca-txop.cc:361
a unique identifier for an interface.
Definition: type-id.h:57
void ReportFinalRtsFailed(Mac48Address address, const WifiMacHeader *header)
Should be invoked after calling ReportRtsFailed if NeedRtsRetransmission returns false.
TypeId SetParent(TypeId tid)
Definition: type-id.cc:638
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:419
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:346
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:680
virtual uint32_t GetSerializedSize(void) const
RandomStream * m_rng
Definition: dca-txop.h:330
TxFailed m_txFailedCallback
Definition: dca-txop.h:324