A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dcf-manager.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 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/log.h"
23 #include "ns3/simulator.h"
24 #include <cmath>
25 
26 #include "dcf-manager.h"
27 #include "wifi-phy.h"
28 #include "wifi-mac.h"
29 #include "mac-low.h"
30 
31 NS_LOG_COMPONENT_DEFINE ("DcfManager");
32 
33 #define MY_DEBUG(x) \
34  NS_LOG_DEBUG (Simulator::Now () << " " << this << " " << x)
35 
36 namespace ns3 {
37 
38 /****************************************************************
39  * Implement the DCF state holder
40  ****************************************************************/
41 
43  : m_backoffSlots (0),
44  m_backoffStart (Seconds (0.0)),
45  m_cwMin (0),
46  m_cwMax (0),
47  m_cw (0),
48  m_accessRequested (false)
49 {
50 }
51 
53 {
54 }
55 
56 void
57 DcfState::SetAifsn (uint32_t aifsn)
58 {
59  m_aifsn = aifsn;
60 }
61 void
62 DcfState::SetCwMin (uint32_t minCw)
63 {
64  m_cwMin = minCw;
65  ResetCw ();
66 }
67 void
68 DcfState::SetCwMax (uint32_t maxCw)
69 {
70  m_cwMax = maxCw;
71  ResetCw ();
72 }
73 uint32_t
74 DcfState::GetAifsn (void) const
75 {
76  return m_aifsn;
77 }
78 uint32_t
79 DcfState::GetCwMin (void) const
80 {
81  return m_cwMin;
82 }
83 uint32_t
84 DcfState::GetCwMax (void) const
85 {
86  return m_cwMax;
87 }
88 
89 void
91 {
92  m_cw = m_cwMin;
93 }
94 void
96 {
97  // see 802.11-2007, section 9.9.1.5
98  m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
99 }
100 void
101 DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)
102 {
103  m_backoffSlots -= nSlots;
104  m_backoffStart = backoffUpdateBound;
105  MY_DEBUG ("update slots=" << nSlots << " slots, backoff=" << m_backoffSlots);
106 }
107 
108 void
109 DcfState::StartBackoffNow (uint32_t nSlots)
110 {
111  NS_ASSERT (m_backoffSlots == 0);
112  MY_DEBUG ("start backoff=" << nSlots << " slots");
113  m_backoffSlots = nSlots;
115 }
116 
117 uint32_t
118 DcfState::GetCw (void) const
119 {
120  return m_cw;
121 }
122 uint32_t
124 {
125  return m_backoffSlots;
126 }
127 Time
129 {
130  return m_backoffStart;
131 }
132 bool
134 {
135  return m_accessRequested;
136 }
137 void
139 {
140  m_accessRequested = true;
141 }
142 void
144 {
146  m_accessRequested = false;
148 }
149 void
151 {
153 }
154 void
156 {
158 }
159 void
161 {
163 }
164 
165 
166 /***************************************************************
167  * Listener for Nav events. Forwards to DcfManager
168  ***************************************************************/
169 
171 {
172 public:
174  : m_dcf (dcf)
175  {
176  }
177  virtual ~LowDcfListener ()
178  {
179  }
180  virtual void NavStart (Time duration)
181  {
182  m_dcf->NotifyNavStartNow (duration);
183  }
184  virtual void NavReset (Time duration)
185  {
186  m_dcf->NotifyNavResetNow (duration);
187  }
188  virtual void AckTimeoutStart (Time duration)
189  {
190  m_dcf->NotifyAckTimeoutStartNow (duration);
191  }
192  virtual void AckTimeoutReset ()
193  {
195  }
196  virtual void CtsTimeoutStart (Time duration)
197  {
198  m_dcf->NotifyCtsTimeoutStartNow (duration);
199  }
200  virtual void CtsTimeoutReset ()
201  {
203  }
204 private:
206 };
207 
208 /***************************************************************
209  * Listener for PHY events. Forwards to DcfManager
210  ***************************************************************/
211 
213 {
214 public:
216  : m_dcf (dcf)
217  {
218  }
219  virtual ~PhyListener ()
220  {
221  }
222  virtual void NotifyRxStart (Time duration)
223  {
224  m_dcf->NotifyRxStartNow (duration);
225  }
226  virtual void NotifyRxEndOk (void)
227  {
229  }
230  virtual void NotifyRxEndError (void)
231  {
233  }
234  virtual void NotifyTxStart (Time duration)
235  {
236  m_dcf->NotifyTxStartNow (duration);
237  }
238  virtual void NotifyMaybeCcaBusyStart (Time duration)
239  {
240  m_dcf->NotifyMaybeCcaBusyStartNow (duration);
241  }
242  virtual void NotifySwitchingStart (Time duration)
243  {
244  m_dcf->NotifySwitchingStartNow (duration);
245  }
246 private:
248 };
249 
250 /****************************************************************
251  * Implement the DCF manager of all DCF state holders
252  ****************************************************************/
253 
255  : m_lastAckTimeoutEnd (MicroSeconds (0)),
256  m_lastCtsTimeoutEnd (MicroSeconds (0)),
257  m_lastNavStart (MicroSeconds (0)),
258  m_lastNavDuration (MicroSeconds (0)),
259  m_lastRxStart (MicroSeconds (0)),
260  m_lastRxDuration (MicroSeconds (0)),
261  m_lastRxReceivedOk (true),
262  m_lastRxEnd (MicroSeconds (0)),
263  m_lastTxStart (MicroSeconds (0)),
264  m_lastTxDuration (MicroSeconds (0)),
265  m_lastBusyStart (MicroSeconds (0)),
266  m_lastBusyDuration (MicroSeconds (0)),
267  m_lastSwitchingStart (MicroSeconds (0)),
268  m_lastSwitchingDuration (MicroSeconds (0)),
269  m_rxing (false),
270  m_slotTimeUs (0),
271  m_sifs (Seconds (0.0)),
272  m_phyListener (0),
273  m_lowListener (0)
274 {
275  NS_LOG_FUNCTION (this);
276 }
277 
279 {
280  delete m_phyListener;
281  delete m_lowListener;
282  m_phyListener = 0;
283  m_lowListener = 0;
284 }
285 
286 void
288 {
289  NS_LOG_FUNCTION (this << phy);
290  if (m_phyListener != 0)
291  {
292  delete m_phyListener;
293  }
294  m_phyListener = new PhyListener (this);
296 }
297 void
299 {
300  NS_LOG_FUNCTION (this << low);
301  if (m_lowListener != 0)
302  {
303  delete m_lowListener;
304  }
305  m_lowListener = new LowDcfListener (this);
306  low->RegisterDcfListener (m_lowListener);
307 }
308 
309 void
311 {
312  NS_LOG_FUNCTION (this << slotTime);
313  m_slotTimeUs = slotTime.GetMicroSeconds ();
314 }
315 void
317 {
318  NS_LOG_FUNCTION (this << sifs);
319  m_sifs = sifs;
320 }
321 void
323 {
324  NS_LOG_FUNCTION (this << eifsNoDifs);
325  m_eifsNoDifs = eifsNoDifs;
326 }
327 Time
329 {
330  NS_LOG_FUNCTION (this);
331  return m_eifsNoDifs;
332 }
333 
334 void
336 {
337  NS_LOG_FUNCTION (this << dcf);
338  m_states.push_back (dcf);
339 }
340 
341 Time
343 {
344  NS_LOG_FUNCTION (this << a << b);
345  return Max (a, b);
346 }
347 Time
349 {
350  NS_LOG_FUNCTION (this << a << b << c);
351  Time retval;
352  retval = Max (a, b);
353  retval = Max (retval, c);
354  return retval;
355 }
356 Time
358 {
359  NS_LOG_FUNCTION (this << a << b << c << d);
360  Time e = Max (a, b);
361  Time f = Max (c, d);
362  Time retval = Max (e, f);
363  return retval;
364 }
365 Time
367 {
368  NS_LOG_FUNCTION (this << a << b << c << d << e << f);
369  Time g = Max (a, b);
370  Time h = Max (c, d);
371  Time i = Max (e, f);
372  Time k = Max (g, h);
373  Time retval = Max (k, i);
374  return retval;
375 }
376 
377 Time
378 DcfManager::MostRecent (Time a, Time b, Time c, Time d, Time e, Time f, Time g) const
379 {
380  NS_LOG_FUNCTION (this << a << b << c << d << e << f << g);
381  Time h = Max (a, b);
382  Time i = Max (c, d);
383  Time j = Max (e, f);
384  Time k = Max (h, i);
385  Time l = Max (j, g);
386  Time retval = Max (k, l);
387  return retval;
388 }
389 
390 bool
391 DcfManager::IsBusy (void) const
392 {
393  NS_LOG_FUNCTION (this);
394  // PHY busy
395  if (m_rxing)
396  {
397  return true;
398  }
399  Time lastTxEnd = m_lastTxStart + m_lastTxDuration;
400  if (lastTxEnd > Simulator::Now ())
401  {
402  return true;
403  }
404  // NAV busy
405  Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
406  if (lastNavEnd > Simulator::Now ())
407  {
408  return true;
409  }
410  return false;
411 }
412 
413 
414 void
416 {
417  NS_LOG_FUNCTION (this << state);
418  UpdateBackoff ();
419  NS_ASSERT (!state->IsAccessRequested ());
420  state->NotifyAccessRequested ();
425  if (state->GetBackoffSlots () == 0
426  && IsBusy ())
427  {
428  MY_DEBUG ("medium is busy: collision");
429  /* someone else has accessed the medium.
430  * generate a backoff.
431  */
432  state->NotifyCollision ();
433  }
434  DoGrantAccess ();
436 }
437 
438 void
440 {
441  NS_LOG_FUNCTION (this);
442  uint32_t k = 0;
443  for (States::const_iterator i = m_states.begin (); i != m_states.end (); k++)
444  {
445  DcfState *state = *i;
446  if (state->IsAccessRequested ()
447  && GetBackoffEndFor (state) <= Simulator::Now () )
448  {
453  MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots=" << state->GetBackoffSlots ());
454  i++; // go to the next item in the list.
455  k++;
456  std::vector<DcfState *> internalCollisionStates;
457  for (States::const_iterator j = i; j != m_states.end (); j++, k++)
458  {
459  DcfState *otherState = *j;
460  if (otherState->IsAccessRequested ()
461  && GetBackoffEndFor (otherState) <= Simulator::Now ())
462  {
463  MY_DEBUG ("dcf " << k << " needs access. backoff expired. internal collision. slots=" <<
464  otherState->GetBackoffSlots ());
470  internalCollisionStates.push_back (otherState);
471  }
472  }
473 
481  state->NotifyAccessGranted ();
482  for (std::vector<DcfState *>::const_iterator k = internalCollisionStates.begin ();
483  k != internalCollisionStates.end (); k++)
484  {
485  (*k)->NotifyInternalCollision ();
486  }
487  break;
488  }
489  i++;
490  }
491 }
492 
493 void
495 {
496  NS_LOG_FUNCTION (this);
497  UpdateBackoff ();
498  DoGrantAccess ();
500 }
501 
502 Time
504 {
505  NS_LOG_FUNCTION (this);
506  Time rxAccessStart;
507  if (!m_rxing)
508  {
509  rxAccessStart = m_lastRxEnd + m_sifs;
510  if (!m_lastRxReceivedOk)
511  {
512  rxAccessStart += m_eifsNoDifs;
513  }
514  }
515  else
516  {
517  rxAccessStart = m_lastRxStart + m_lastRxDuration + m_sifs;
518  }
519  Time busyAccessStart = m_lastBusyStart + m_lastBusyDuration + m_sifs;
520  Time txAccessStart = m_lastTxStart + m_lastTxDuration + m_sifs;
521  Time navAccessStart = m_lastNavStart + m_lastNavDuration + m_sifs;
522  Time ackTimeoutAccessStart = m_lastAckTimeoutEnd + m_sifs;
523  Time ctsTimeoutAccessStart = m_lastCtsTimeoutEnd + m_sifs;
524  Time switchingAccessStart = m_lastSwitchingStart + m_lastSwitchingDuration + m_sifs;
525  Time accessGrantedStart = MostRecent (rxAccessStart,
526  busyAccessStart,
527  txAccessStart,
528  navAccessStart,
529  ackTimeoutAccessStart,
530  ctsTimeoutAccessStart,
531  switchingAccessStart
532  );
533  NS_LOG_INFO ("access grant start=" << accessGrantedStart <<
534  ", rx access start=" << rxAccessStart <<
535  ", busy access start=" << busyAccessStart <<
536  ", tx access start=" << txAccessStart <<
537  ", nav access start=" << navAccessStart);
538  return accessGrantedStart;
539 }
540 
541 Time
543 {
544  NS_LOG_FUNCTION (this << state);
545  Time mostRecentEvent = MostRecent (state->GetBackoffStart (),
546  GetAccessGrantStart () + MicroSeconds (state->GetAifsn () * m_slotTimeUs));
547 
548  return mostRecentEvent;
549 }
550 
551 Time
553 {
554  return GetBackoffStartFor (state) + MicroSeconds (state->GetBackoffSlots () * m_slotTimeUs);
555 }
556 
557 void
559 {
560  NS_LOG_FUNCTION (this);
561  uint32_t k = 0;
562  for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++)
563  {
564  DcfState *state = *i;
565 
566  Time backoffStart = GetBackoffStartFor (state);
567  if (backoffStart <= Simulator::Now ())
568  {
569  uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds ();
570  uint32_t nIntSlots = nus / m_slotTimeUs;
571  uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ());
572  MY_DEBUG ("dcf " << k << " dec backoff slots=" << n);
573  Time backoffUpdateBound = backoffStart + MicroSeconds (n * m_slotTimeUs);
574  state->UpdateBackoffSlotsNow (n, backoffUpdateBound);
575  }
576  }
577 }
578 
579 void
581 {
582  NS_LOG_FUNCTION (this);
587  bool accessTimeoutNeeded = false;
588  Time expectedBackoffEnd = Simulator::GetMaximumSimulationTime ();
589  for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++)
590  {
591  DcfState *state = *i;
592  if (state->IsAccessRequested ())
593  {
594  Time tmp = GetBackoffEndFor (state);
595  if (tmp > Simulator::Now ())
596  {
597  accessTimeoutNeeded = true;
598  expectedBackoffEnd = std::min (expectedBackoffEnd, tmp);
599  }
600  }
601  }
602  if (accessTimeoutNeeded)
603  {
604  MY_DEBUG ("expected backoff end=" << expectedBackoffEnd);
605  Time expectedBackoffDelay = expectedBackoffEnd - Simulator::Now ();
607  && Simulator::GetDelayLeft (m_accessTimeout) > expectedBackoffDelay)
608  {
610  }
611  if (m_accessTimeout.IsExpired ())
612  {
613  m_accessTimeout = Simulator::Schedule (expectedBackoffDelay,
615  }
616  }
617 }
618 
619 void
621 {
622  NS_LOG_FUNCTION (this << duration);
623  MY_DEBUG ("rx start for=" << duration);
624  UpdateBackoff ();
626  m_lastRxDuration = duration;
627  m_rxing = true;
628 }
629 void
631 {
632  NS_LOG_FUNCTION (this);
633  MY_DEBUG ("rx end ok");
635  m_lastRxReceivedOk = true;
636  m_rxing = false;
637 }
638 void
640 {
641  NS_LOG_FUNCTION (this);
642  MY_DEBUG ("rx end error");
644  m_lastRxReceivedOk = false;
645  m_rxing = false;
646 }
647 void
649 {
650  NS_LOG_FUNCTION (this << duration);
651  if (m_rxing)
652  {
653  //this may be caused only if PHY has started to receive a packet
654  //inside SIFS, so, we check that lastRxStart was maximum a SIFS
655  //ago
659  m_lastRxReceivedOk = true;
660  m_rxing = false;
661  }
662  MY_DEBUG ("tx start for " << duration);
663  UpdateBackoff ();
665  m_lastTxDuration = duration;
666 }
667 void
669 {
670  NS_LOG_FUNCTION (this << duration);
671  MY_DEBUG ("busy start for " << duration);
672  UpdateBackoff ();
674  m_lastBusyDuration = duration;
675 }
676 
677 
678 void
680 {
681  NS_LOG_FUNCTION (this << duration);
682  Time now = Simulator::Now ();
685 
686  if (m_rxing)
687  {
688  // channel switching during packet reception
691  m_lastRxReceivedOk = true;
692  m_rxing = false;
693  }
694  if (m_lastNavStart + m_lastNavDuration > now)
695  {
697  }
699  {
701  }
702  if (m_lastAckTimeoutEnd > now)
703  {
704  m_lastAckTimeoutEnd = now;
705  }
706  if (m_lastCtsTimeoutEnd > now)
707  {
708  m_lastCtsTimeoutEnd = now;
709  }
710 
711  // Cancel timeout
712  if (m_accessTimeout.IsRunning ())
713  {
715  }
716 
717  // Reset backoffs
718  for (States::iterator i = m_states.begin (); i != m_states.end (); i++)
719  {
720  DcfState *state = *i;
721  uint32_t remainingSlots = state->GetBackoffSlots ();
722  if (remainingSlots > 0)
723  {
724  state->UpdateBackoffSlotsNow (remainingSlots, now);
725  NS_ASSERT (state->GetBackoffSlots () == 0);
726  }
727  state->ResetCw ();
728  state->m_accessRequested = false;
729  state->NotifyChannelSwitching ();
730  }
731 
732  MY_DEBUG ("switching start for " << duration);
734  m_lastSwitchingDuration = duration;
735 
736 }
737 
738 void
740 {
741  NS_LOG_FUNCTION (this << duration);
742  MY_DEBUG ("nav reset for=" << duration);
743  UpdateBackoff ();
745  m_lastNavDuration = duration;
746  UpdateBackoff ();
754 }
755 void
757 {
758  NS_LOG_FUNCTION (this << duration);
760  MY_DEBUG ("nav start for=" << duration);
761  UpdateBackoff ();
762  Time newNavEnd = Simulator::Now () + duration;
763  Time lastNavEnd = m_lastNavStart + m_lastNavDuration;
764  if (newNavEnd > lastNavEnd)
765  {
767  m_lastNavDuration = duration;
768  }
769 }
770 void
772 {
773  NS_LOG_FUNCTION (this << duration);
775  m_lastAckTimeoutEnd = Simulator::Now () + duration;
776 }
777 void
779 {
780  NS_LOG_FUNCTION (this);
783 }
784 void
786 {
787  NS_LOG_FUNCTION (this << duration);
788  m_lastCtsTimeoutEnd = Simulator::Now () + duration;
789 }
790 void
792 {
793  NS_LOG_FUNCTION (this);
796 }
797 } // namespace ns3
uint32_t m_cwMin
Definition: dcf-manager.h:152
ns3::DcfManager * m_dcf
Definition: dcf-manager.cc:247
static Time GetDelayLeft(const EventId &id)
Definition: simulator.cc:189
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
ns3::DcfManager * m_dcf
Definition: dcf-manager.cc:205
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:311
virtual void NavReset(Time duration)
Definition: dcf-manager.cc:184
void NotifyInternalCollision(void)
Definition: dcf-manager.cc:155
bool m_lastRxReceivedOk
Definition: dcf-manager.h:318
uint32_t GetCwMin(void) const
Definition: dcf-manager.cc:79
virtual void NotifyRxStart(Time duration)
Definition: dcf-manager.cc:222
void NotifyAccessGranted(void)
Definition: dcf-manager.cc:143
void RequestAccess(DcfState *state)
Definition: dcf-manager.cc:415
Time GetBackoffStart(void) const
Definition: dcf-manager.cc:128
void SetupLowListener(Ptr< MacLow > low)
Definition: dcf-manager.cc:298
#define NS_ASSERT(condition)
Definition: assert.h:64
Time m_lastAckTimeoutEnd
Definition: dcf-manager.h:312
virtual void NotifySwitchingStart(Time duration)
Definition: dcf-manager.cc:242
LowDcfListener(ns3::DcfManager *dcf)
Definition: dcf-manager.cc:173
void UpdateBackoff(void)
Definition: dcf-manager.cc:558
virtual void DoNotifyCollision(void)=0
Time m_lastCtsTimeoutEnd
Definition: dcf-manager.h:313
#define NS_LOG_INFO(msg)
Definition: log.h:264
bool m_accessRequested
Definition: dcf-manager.h:155
void SetAifsn(uint32_t aifsn)
Definition: dcf-manager.cc:57
bool IsRunning(void) const
Definition: event-id.cc:59
void ResetCw(void)
Definition: dcf-manager.cc:90
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Definition: simulator.h:824
Time m_lastSwitchingDuration
Definition: dcf-manager.h:325
PhyListener(ns3::DcfManager *dcf)
Definition: dcf-manager.cc:215
void Add(DcfState *dcf)
Definition: dcf-manager.cc:335
virtual void NotifyRxEndOk(void)
Definition: dcf-manager.cc:226
virtual void RegisterListener(WifiPhyListener *listener)=0
void DoGrantAccess(void)
Definition: dcf-manager.cc:439
void NotifyNavResetNow(Time duration)
Definition: dcf-manager.cc:739
Time GetBackoffStartFor(DcfState *state)
Definition: dcf-manager.cc:542
void NotifyCtsTimeoutStartNow(Time duration)
Definition: dcf-manager.cc:785
void NotifyRxEndOkNow(void)
Definition: dcf-manager.cc:630
uint32_t m_backoffSlots
Definition: dcf-manager.h:147
PhyListener * m_phyListener
Definition: dcf-manager.h:331
int64_t GetMicroSeconds(void) const
Definition: nstime.h:283
Time GetAccessGrantStart(void) const
Definition: dcf-manager.cc:503
receive notifications about phy events.
Definition: wifi-phy.h:44
Time GetBackoffEndFor(DcfState *state)
Definition: dcf-manager.cc:552
void NotifyTxStartNow(Time duration)
Definition: dcf-manager.cc:648
void NotifyAckTimeoutStartNow(Time duration)
Definition: dcf-manager.cc:771
virtual void NavStart(Time duration)
Definition: dcf-manager.cc:180
void SetupPhyListener(Ptr< WifiPhy > phy)
Definition: dcf-manager.cc:287
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:173
keep track of the state needed for a single DCF function.Multiple instances of a DcfState can be regi...
Definition: dcf-manager.h:46
virtual void AckTimeoutStart(Time duration)
Definition: dcf-manager.cc:188
virtual void CtsTimeoutReset()
Definition: dcf-manager.cc:200
bool IsAccessRequested(void) const
Definition: dcf-manager.cc:133
uint32_t GetBackoffSlots(void) const
Definition: dcf-manager.cc:123
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Definition: int64x64.h:95
virtual ~DcfState()
Definition: dcf-manager.cc:52
#define MY_DEBUG(x)
Definition: dcf-manager.cc:33
uint32_t GetCwMax(void) const
Definition: dcf-manager.cc:84
Time m_lastBusyDuration
Definition: dcf-manager.h:323
void SetCwMin(uint32_t minCw)
Definition: dcf-manager.cc:62
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-manager.cc:109
virtual void NotifyMaybeCcaBusyStart(Time duration)
Definition: dcf-manager.cc:238
uint32_t m_cwMax
Definition: dcf-manager.h:153
virtual void DoNotifyAccessGranted(void)=0
void NotifyAccessRequested(void)
Definition: dcf-manager.cc:138
void NotifyRxEndErrorNow(void)
Definition: dcf-manager.cc:639
virtual void CtsTimeoutStart(Time duration)
Definition: dcf-manager.cc:196
uint32_t m_cw
Definition: dcf-manager.h:154
Time m_lastSwitchingStart
Definition: dcf-manager.h:324
void SetEifsNoDifs(Time eifsNoDifs)
Definition: dcf-manager.cc:322
virtual void DoNotifyInternalCollision(void)=0
listen to NAV eventsThis class is typically connected to an instance of ns3::Dcf and calls to its met...
Definition: mac-low.h:147
static Time Now(void)
Definition: simulator.cc:180
void NotifyMaybeCcaBusyStartNow(Time duration)
Definition: dcf-manager.cc:668
void AccessTimeout(void)
Definition: dcf-manager.cc:494
virtual void DoNotifyChannelSwitching()=0
Time m_lastNavDuration
Definition: dcf-manager.h:315
void SetSlot(Time slotTime)
Definition: dcf-manager.cc:310
void SetCwMax(uint32_t maxCw)
Definition: dcf-manager.cc:68
void NotifyAckTimeoutResetNow()
Definition: dcf-manager.cc:778
LowDcfListener * m_lowListener
Definition: dcf-manager.h:332
void NotifyNavStartNow(Time duration)
Definition: dcf-manager.cc:756
void NotifyChannelSwitching(void)
Definition: dcf-manager.cc:160
uint32_t GetCw(void) const
Definition: dcf-manager.cc:118
uint32_t GetAifsn(void) const
Definition: dcf-manager.cc:74
uint32_t m_aifsn
Definition: dcf-manager.h:146
void NotifyRxStartNow(Time duration)
Definition: dcf-manager.cc:620
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound)
Definition: dcf-manager.cc:101
virtual ~PhyListener()
Definition: dcf-manager.cc:219
Time GetEifsNoDifs() const
Definition: dcf-manager.cc:328
void Cancel(void)
Definition: event-id.cc:47
virtual void NotifyRxEndError(void)
Definition: dcf-manager.cc:230
void NotifyCtsTimeoutResetNow()
Definition: dcf-manager.cc:791
void NotifyCollision(void)
Definition: dcf-manager.cc:150
bool IsBusy(void) const
Definition: dcf-manager.cc:391
Time m_backoffStart
Definition: dcf-manager.h:151
NS_LOG_COMPONENT_DEFINE("DcfManager")
void DoRestartAccessTimeoutIfNeeded(void)
Definition: dcf-manager.cc:580
EventId m_accessTimeout
Definition: dcf-manager.h:328
virtual ~LowDcfListener()
Definition: dcf-manager.cc:177
void UpdateFailedCw(void)
Definition: dcf-manager.cc:95
void NotifySwitchingStartNow(Time duration)
Definition: dcf-manager.cc:679
bool IsExpired(void) const
Definition: event-id.cc:53
static Time GetMaximumSimulationTime(void)
Definition: simulator.cc:293
uint32_t m_slotTimeUs
Definition: dcf-manager.h:329
Time MostRecent(Time a, Time b) const
Definition: dcf-manager.cc:342
void SetSifs(Time sifs)
Definition: dcf-manager.cc:316
virtual void NotifyTxStart(Time duration)
Definition: dcf-manager.cc:234
virtual void AckTimeoutReset()
Definition: dcf-manager.cc:192