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/log.h"
22 #include "ns3/pointer.h"
23 #include "dca-txop.h"
24 #include "dcf-manager.h"
25 #include "dcf-state.h"
26 #include "wifi-mac-queue.h"
27 #include "mac-tx-middle.h"
28 
29 #undef NS_LOG_APPEND_CONTEXT
30 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
31 
32 namespace ns3 {
33 
34 NS_LOG_COMPONENT_DEFINE ("DcaTxop");
35 
37 
38 TypeId
40 {
41  static TypeId tid = TypeId ("ns3::DcaTxop")
43  .SetGroupName ("Wifi")
44  .AddConstructor<DcaTxop> ()
45  .AddAttribute ("MinCw", "The minimum value of the contention window.",
46  UintegerValue (15),
49  MakeUintegerChecker<uint32_t> ())
50  .AddAttribute ("MaxCw", "The maximum value of the contention window.",
51  UintegerValue (1023),
54  MakeUintegerChecker<uint32_t> ())
55  .AddAttribute ("Aifsn", "The AIFSN: the default value conforms to simple DCA.",
56  UintegerValue (2),
59  MakeUintegerChecker<uint32_t> ())
60  .AddAttribute ("TxopLimit", "The TXOP limit: the default value conforms to simple DCA.",
61  TimeValue (MilliSeconds (0)),
64  MakeTimeChecker ())
65  .AddAttribute ("Queue", "The WifiMacQueue object",
66  PointerValue (),
68  MakePointerChecker<WifiMacQueue> ())
69  ;
70  return tid;
71 }
72 
74  : m_manager (0),
75  m_currentPacket (0)
76 {
77  NS_LOG_FUNCTION (this);
78  m_dcf = CreateObject<DcfState> (this);
79  m_queue = CreateObject<WifiMacQueue> ();
80  m_rng = CreateObject<UniformRandomVariable> ();
81 }
82 
84 {
85  NS_LOG_FUNCTION (this);
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION (this);
92  m_queue = 0;
93  m_low = 0;
94  m_stationManager = 0;
95  m_dcf = 0;
96  m_rng = 0;
97  m_txMiddle = 0;
98 }
99 
100 void
102 {
103  NS_LOG_FUNCTION (this << manager);
104  m_manager = manager;
105  m_manager->Add (m_dcf);
106 }
107 
109 {
110  NS_LOG_FUNCTION (this);
111  m_txMiddle = txMiddle;
112 }
113 
114 void
116 {
117  NS_LOG_FUNCTION (this << low);
118  m_low = low;
119 }
120 
121 void
123 {
124  NS_LOG_FUNCTION (this << remoteManager);
125  m_stationManager = remoteManager;
126 }
127 
128 void
130 {
131  NS_LOG_FUNCTION (this << &callback);
132  m_txOkCallback = callback;
133 }
134 
135 void
137 {
138  NS_LOG_FUNCTION (this << &callback);
139  m_txFailedCallback = callback;
140 }
141 
142 void
144 {
145  NS_LOG_FUNCTION (this << &callback);
146  m_txDroppedCallback = callback;
147  m_queue->TraceConnectWithoutContext ("Drop", MakeCallback (&DcaTxop::TxDroppedPacket, this));
148 }
149 
150 void
152 {
153  if (!m_txDroppedCallback.IsNull ())
154  {
155  m_txDroppedCallback (item->GetPacket ());
156  }
157 }
158 
161 {
162  NS_LOG_FUNCTION (this);
163  return m_queue;
164 }
165 
166 void
167 DcaTxop::SetMinCw (uint32_t minCw)
168 {
169  NS_LOG_FUNCTION (this << minCw);
170  m_dcf->SetCwMin (minCw);
171 }
172 
173 void
174 DcaTxop::SetMaxCw (uint32_t maxCw)
175 {
176  NS_LOG_FUNCTION (this << maxCw);
177  m_dcf->SetCwMax (maxCw);
178 }
179 
180 void
181 DcaTxop::SetAifsn (uint32_t aifsn)
182 {
183  NS_LOG_FUNCTION (this << aifsn);
184  m_dcf->SetAifsn (aifsn);
185 }
186 
187 void
189 {
190  NS_LOG_FUNCTION (this << txopLimit);
191  m_dcf->SetTxopLimit (txopLimit);
192 }
193 
194 uint32_t
195 DcaTxop::GetMinCw (void) const
196 {
197  return m_dcf->GetCwMin ();
198 }
199 
200 uint32_t
201 DcaTxop::GetMaxCw (void) const
202 {
203  return m_dcf->GetCwMax ();
204 }
205 
206 uint32_t
207 DcaTxop::GetAifsn (void) const
208 {
209  return m_dcf->GetAifsn ();
210 }
211 
212 Time
214 {
215  return m_dcf->GetTxopLimit ();
216 }
217 
218 void
220 {
221  NS_LOG_FUNCTION (this << packet << &hdr);
222  m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet);
223  m_queue->Enqueue (Create<WifiMacQueueItem> (packet, hdr));
225 }
226 
227 int64_t
228 DcaTxop::AssignStreams (int64_t stream)
229 {
230  NS_LOG_FUNCTION (this << stream);
231  m_rng->SetStream (stream);
232  return 1;
233 }
234 
235 void
237 {
238  NS_LOG_FUNCTION (this);
239  if ((m_currentPacket != 0
240  || !m_queue->IsEmpty ())
241  && !m_dcf->IsAccessRequested ())
242  {
244  }
245 }
246 
247 void
249 {
250  NS_LOG_FUNCTION (this);
251  if (m_currentPacket == 0
252  && !m_queue->IsEmpty ()
253  && !m_dcf->IsAccessRequested ())
254  {
256  }
257 }
258 
260 DcaTxop::GetLow (void) const
261 {
262  NS_LOG_FUNCTION (this);
263  return m_low;
264 }
265 
266 void
268 {
269  NS_LOG_FUNCTION (this);
270  m_dcf->ResetCw ();
272 }
273 
274 bool
276 {
277  NS_LOG_FUNCTION (this);
278  return m_stationManager->NeedRtsRetransmission (hdr.GetAddr1 (), &hdr, packet);
279 }
280 
281 bool
283 {
284  NS_LOG_FUNCTION (this);
285  return m_stationManager->NeedDataRetransmission (hdr.GetAddr1 (), &hdr, packet);
286 }
287 
288 bool
290 {
291  NS_LOG_FUNCTION (this);
294 }
295 
296 void
298 {
299  NS_LOG_FUNCTION (this);
301 }
302 
303 uint32_t
305 {
306  NS_LOG_FUNCTION (this);
309 }
310 
311 bool
313 {
314  NS_LOG_FUNCTION (this);
317 }
318 
319 uint32_t
321 {
322  NS_LOG_FUNCTION (this);
325 }
326 
327 uint32_t
329 {
330  NS_LOG_FUNCTION (this);
333 }
334 
337 {
338  NS_LOG_FUNCTION (this << hdr);
339  *hdr = m_currentHdr;
341  uint32_t startOffset = GetFragmentOffset ();
342  Ptr<Packet> fragment;
343  if (IsLastFragment ())
344  {
345  hdr->SetNoMoreFragments ();
346  }
347  else
348  {
349  hdr->SetMoreFragments ();
350  }
351  fragment = m_currentPacket->CreateFragment (startOffset,
352  GetFragmentSize ());
353  return fragment;
354 }
355 
356 bool
358 {
359  NS_LOG_FUNCTION (this);
360  return !m_queue->IsEmpty () || m_currentPacket != 0;
361 }
362 
363 void
365 {
366  NS_LOG_FUNCTION (this);
367  if (m_currentPacket == 0)
368  {
369  if (m_queue->IsEmpty ())
370  {
371  NS_LOG_DEBUG ("queue empty");
372  return;
373  }
374  Ptr<WifiMacQueueItem> item = m_queue->Dequeue ();
375  NS_ASSERT (item != 0);
376  m_currentPacket = item->GetPacket ();
377  m_currentHdr = item->GetHeader ();
378  NS_ASSERT (m_currentPacket != 0);
379  uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor (&m_currentHdr);
380  m_currentHdr.SetSequenceNumber (sequence);
385  m_fragmentNumber = 0;
386  NS_LOG_DEBUG ("dequeued size=" << m_currentPacket->GetSize () <<
387  ", to=" << m_currentHdr.GetAddr1 () <<
388  ", seq=" << m_currentHdr.GetSequenceControl ());
389  }
391  if (m_currentHdr.GetAddr1 ().IsGroup ())
392  {
397  NS_LOG_DEBUG ("tx broadcast");
398  }
399  else
400  {
402 
403  if (NeedFragmentation ())
404  {
405  WifiMacHeader hdr;
406  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
407  if (IsLastFragment ())
408  {
409  NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
411  }
412  else
413  {
414  NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
416  }
417  GetLow ()->StartTransmission (fragment, &hdr, m_currentParams, this);
418  }
419  else
420  {
423  }
424  }
425 }
426 
427 void
429 {
430  NS_LOG_FUNCTION (this);
431  NotifyCollision ();
432 }
433 
434 void
436 {
437  NS_LOG_FUNCTION (this);
440 }
441 
442 void
444 {
445  NS_LOG_FUNCTION (this);
446  m_queue->Flush ();
447  m_currentPacket = 0;
448 }
449 
450 void
452 {
453  NS_LOG_FUNCTION (this);
454  if (m_currentPacket != 0)
455  {
456  m_queue->PushFront (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr));
457  m_currentPacket = 0;
458  }
459 }
460 
461 void
463 {
464  NS_LOG_FUNCTION (this);
466 }
467 
468 void
470 {
471  NS_LOG_FUNCTION (this);
472  NS_LOG_DEBUG ("missed cts");
474  {
475  NS_LOG_DEBUG ("Cts Fail");
477  if (!m_txFailedCallback.IsNull ())
478  {
480  }
481  //to reset the dcf.
482  m_currentPacket = 0;
483  m_dcf->ResetCw ();
484  }
485  else
486  {
487  m_dcf->UpdateFailedCw ();
488  }
491 }
492 
493 void
495 {
496  NS_LOG_FUNCTION (this);
497  if (!NeedFragmentation ()
498  || IsLastFragment ())
499  {
500  NS_LOG_DEBUG ("got ack. tx done.");
501  if (!m_txOkCallback.IsNull ())
502  {
504  }
505 
506  /* we are not fragmenting or we are done fragmenting
507  * so we can get rid of that packet now.
508  */
509  m_currentPacket = 0;
510  m_dcf->ResetCw ();
513  }
514  else
515  {
516  NS_LOG_DEBUG ("got ack. tx not done, size=" << m_currentPacket->GetSize ());
517  }
518 }
519 
520 void
522 {
523  NS_LOG_FUNCTION (this);
524  NS_LOG_DEBUG ("missed ack");
526  {
527  NS_LOG_DEBUG ("Ack Fail");
529  if (!m_txFailedCallback.IsNull ())
530  {
532  }
533  //to reset the dcf.
534  m_currentPacket = 0;
535  m_dcf->ResetCw ();
536  }
537  else
538  {
539  NS_LOG_DEBUG ("Retransmit");
541  m_dcf->UpdateFailedCw ();
542  }
545 }
546 
547 void
549 {
550  NS_LOG_FUNCTION (this);
551  NS_LOG_DEBUG ("start next packet fragment");
552  /* this callback is used only for fragments. */
553  NextFragment ();
554  WifiMacHeader hdr;
555  Ptr<Packet> fragment = GetFragmentPacket (&hdr);
559  if (IsLastFragment ())
560  {
562  }
563  else
564  {
566  }
567  GetLow ()->StartTransmission (fragment, &hdr, m_currentParams, this);
568 }
569 
570 void
572 {
573  NS_LOG_FUNCTION (this);
574  NS_LOG_DEBUG ("transmission cancelled");
575 }
576 
577 void
579 {
580  NS_LOG_FUNCTION (this);
581  NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
582  m_currentPacket = 0;
583  m_dcf->ResetCw ();
586 }
587 
588 bool
590 {
591  return false;
592 }
593 
594 void
596 {
597  NS_LOG_WARN ("StartNext should not be called for non QoS!");
598 }
599 
600 void
601 DcaTxop::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
602 {
603  NS_LOG_WARN ("GotBlockAck should not be called for non QoS!");
604 }
605 
606 void
607 DcaTxop::MissedBlockAck (uint8_t nMpdus)
608 {
609  NS_LOG_WARN ("MissedBlockAck should not be called for non QoS!");
610 }
611 
612 bool
613 DcaTxop::HasTxop (void) const
614 {
615  return false;
616 }
617 
618 } //namespace ns3
virtual uint32_t GetFragmentSize(void) const
Calculate the size of the current fragment.
Definition: dca-txop.cc:304
MacLowTransmissionParameters m_currentParams
current transmission parameters
Definition: dca-txop.h:421
void SetRetry(void)
Set the Retry bit in the Frame Control field.
virtual void NotifyInternalCollision(void)
Notify the DCF that internal collision has occurred.
Definition: dca-txop.cc:428
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: dcf-state.cc:74
void SetMoreFragments(void)
Set the More Fragment bit in the Frame Control field.
uint32_t GetMaxCw(void) const
Return the maximum contention window size.
Definition: dca-txop.cc:201
bool NeedRtsRetransmission(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Check if RTS should be re-transmitted if CTS was missed.
Definition: dca-txop.cc:275
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Ptr< DcfState > m_dcf
the DCF state
Definition: dca-txop.h:408
void SetTxDroppedCallback(TxDropped callback)
Definition: dca-txop.cc:143
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
uint8_t m_fragmentNumber
the fragment number
Definition: dca-txop.h:422
void SetTxFailedCallback(TxFailed callback)
Definition: dca-txop.cc:136
bool NeedDataRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
Definition: dcf-state.cc:118
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
virtual void StartTransmission(Ptr< const Packet > packet, const WifiMacHeader *hdr, MacLowTransmissionParameters parameters, Ptr< DcaTxop > dca)
Definition: mac-low.cc:628
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: dca-txop.cc:174
virtual uint32_t GetNextFragmentSize(void) const
Calculate the size of the next fragment.
Definition: dca-txop.cc:320
Ptr< MacLow > m_low
the MacLow
Definition: dca-txop.h:415
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:1270
#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 void StartNextFragment(void)
Start transmission for the next fragment.
Definition: dca-txop.cc:548
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1001
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:796
TxOk m_txOkCallback
the transmit OK callback
Definition: dca-txop.h:410
bool NeedDataRetransmission(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Check if DATA should be re-transmitted if ACK was missed.
Definition: dca-txop.cc:282
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dca-txop.cc:207
void SetAifsn(uint32_t aifsn)
Definition: dcf-state.cc:67
void UpdateFragmentationThreshold(void)
Typically called to update the fragmentation threshold at the start of a new transmission.
void SetManager(const Ptr< DcfManager > manager)
Set DcfManager this DcaTxop is associated to.
Definition: dca-txop.cc:101
bool IsLastFragment(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Definition: dcf-state.cc:130
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:228
void PrepareForQueue(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dcf-state.cc:112
static TypeId GetTypeId(void)
Get the type ID.
Definition: dca-txop.cc:39
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:129
virtual void NotifySleep(void)
When sleep operation occurs, if there is a pending packet transmission, it will be reinserted to the ...
Definition: dca-txop.cc:451
virtual Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
Get the next fragment from the packet with appropriate Wifi header for the fragment.
Definition: dca-txop.cc:336
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
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:227
virtual void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: dca-txop.cc:219
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dca-txop.cc:213
TxDropped m_txDroppedCallback
the packet dropped callback
Definition: dca-txop.h:412
virtual bool IsEdca()
Check for EDCA.
Definition: dca-txop.cc:589
Ptr< WifiMacQueue > m_queue
the wifi MAC queue
Definition: dca-txop.h:413
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
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
virtual void Cancel(void)
Cancel the transmission.
Definition: dca-txop.cc:571
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
AttributeValue implementation for Time.
Definition: nstime.h:1055
virtual bool NeedFragmentation(void) const
Check if the current packet should be fragmented.
Definition: dca-txop.cc:289
uint16_t GetSequenceControl(void) const
Return the raw Sequence Control field.
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual void DoInitialize(void)
Initialize() implementation.
Definition: dca-txop.cc:267
virtual void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
Definition: dca-txop.cc:443
virtual void MissedCts(void)
Event handler when a CTS timeout has occurred.
Definition: dca-txop.cc:469
virtual ~DcaTxop()
Definition: dca-txop.cc:83
Headers for Block ack response.
Definition: ctrl-headers.h:190
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
bool IsAccessRequested(void) const
Definition: dcf-state.cc:188
virtual void GotAck(void)
Event handler when an ACK is received.
Definition: dca-txop.cc:494
Ptr< WifiRemoteStationManager > m_stationManager
the wifi remote station manager
Definition: dca-txop.h:416
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
Definition: dcf-state.cc:124
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
Definition: dcf-state.cc:82
void SetAifsn(uint32_t aifsn)
Set the number of slots that make up an AIFS.
Definition: dca-txop.cc:181
uint32_t GetFragmentOffset(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-state.cc:154
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
Ptr< UniformRandomVariable > m_rng
the random stream
Definition: dca-txop.h:417
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Definition: pointer.h:36
virtual bool NeedsAccess(void) const
Check if the DCF requires access.
Definition: dca-txop.cc:357
WifiMacHeader m_currentHdr
the current header
Definition: dca-txop.h:420
bool IsGroup(void) const
void EnableAck(void)
Wait ACKTimeout for an ACK.
Definition: mac-low.cc:93
void Add(Ptr< DcfState > dcf)
Definition: dcf-manager.cc:190
uint32_t GetFragmentSize(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
Definition: dca-txop.cc:160
an EUI-48 address
Definition: mac48-address.h:43
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: nstime.h:1056
void DisableRts(void)
Do not send rts and wait for cts before sending data.
Definition: mac-low.cc:108
virtual void NotifyWakeUp(void)
When wake up operation occurs, channel access will be restarted.
Definition: dca-txop.cc:462
Ptr< const Packet > m_currentPacket
the current packet
Definition: dca-txop.h:419
Ptr< MacLow > GetLow(void) const
Return the MacLow associated with this DcaTxop.
Definition: dca-txop.cc:260
virtual void StartNextPacket(void)
Start transmission for the next packet if allowed by the TxopLimit.
Definition: dca-txop.cc:595
void SetLow(const Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
Definition: dca-txop.cc:115
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this DcaTxop is associated to.
Definition: dca-txop.cc:108
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
Definition: dcf-state.cc:94
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: dca-txop.cc:167
virtual bool IsLastFragment(void) const
Check if the current fragment is the last fragment.
Definition: dca-txop.cc:312
Ptr< MacTxMiddle > m_txMiddle
the MacTxMiddle
Definition: dca-txop.h:414
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
Event handler when a Block ACK is received.
Definition: dca-txop.cc:601
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: dca-txop.cc:188
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
uint32_t GetCw(void) const
Definition: dcf-state.cc:170
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-state.cc:106
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
void TxDroppedPacket(Ptr< const WifiMacQueueItem > item)
Pass the packet included in the wifi MAC queue item to the packet dropped callback.
Definition: dca-txop.cc:151
bool NeedFragmentation(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void DoDispose(void)
Destructor implementation.
Definition: dca-txop.cc:89
void RequestAccess(Ptr< DcfState > state)
Definition: dcf-manager.cc:292
void EnableNextData(uint32_t size)
Definition: mac-low.cc:48
virtual void NotifyCollision(void)
Notify the DCF that collision has occurred.
Definition: dca-txop.cc:435
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:63
virtual void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
Definition: dca-txop.cc:248
void NextFragment(void)
Continue to the next fragment.
Definition: dca-txop.cc:297
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
Definition: mac-low.cc:53
virtual bool HasTxop(void) const
Check if the station has TXOP granted for the next MPDU.
Definition: dca-txop.cc:613
bool NeedRtsRetransmission(Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
virtual void RestartAccessIfNeeded(void)
Restart access request if needed.
Definition: dca-txop.cc:236
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
A base class which provides memory management and object aggregation.
Definition: object.h:87
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: dcf-state.cc:137
virtual void MissedAck(void)
Event handler when an ACK is missed.
Definition: dca-txop.cc:521
handle packet fragmentation and retransmissions.
Definition: dca-txop.h:58
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:98
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
uint32_t GetMinCw(void) const
Return the minimum contention window size.
Definition: dca-txop.cc:195
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:914
virtual void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
Definition: dca-txop.cc:364
Implements the IEEE 802.11 MAC header.
virtual void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
Definition: dca-txop.cc:578
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
Definition: dca-txop.cc:122
virtual void MissedBlockAck(uint8_t nMpdus)
Event handler when a Block ACK timeout has occurred.
Definition: dca-txop.cc:607
virtual uint32_t GetFragmentOffset(void) const
Calculate the offset for the current fragment.
Definition: dca-txop.cc:328
TxFailed m_txFailedCallback
the transmit failed callback
Definition: dca-txop.h:411
Ptr< DcfManager > m_manager
the DCF manager
Definition: dca-txop.h:409