OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void NotifyRxEndOk (void) | 51 void NotifyRxEndOk (void) |
52 { | 52 { |
53 m_dcf->NotifyRxEndOkNow (); | 53 m_dcf->NotifyRxEndOkNow (); |
54 } | 54 } |
55 void NotifyRxEndError (void) | 55 void NotifyRxEndError (void) |
56 { | 56 { |
57 m_dcf->NotifyRxEndErrorNow (); | 57 m_dcf->NotifyRxEndErrorNow (); |
58 } | 58 } |
59 void NotifyTxStart (Time duration, double txPowerDbm) | 59 void NotifyTxStart (Time duration, double txPowerDbm) |
60 { | 60 { |
| 61 NS_UNUSED(txPowerDbm); |
61 m_dcf->NotifyTxStartNow (duration); | 62 m_dcf->NotifyTxStartNow (duration); |
62 } | 63 } |
63 void NotifyMaybeCcaBusyStart (Time duration) | 64 void NotifyMaybeCcaBusyStart (Time duration) |
64 { | 65 { |
65 m_dcf->NotifyMaybeCcaBusyStartNow (duration); | 66 m_dcf->NotifyMaybeCcaBusyStartNow (duration); |
66 } | 67 } |
67 void NotifySwitchingStart (Time duration) | 68 void NotifySwitchingStart (Time duration) |
68 { | 69 { |
69 m_dcf->NotifySwitchingStartNow (duration); | 70 m_dcf->NotifySwitchingStartNow (duration); |
70 } | 71 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DcfManager::SetupLow (Ptr<MacLow> low) | 161 DcfManager::SetupLow (Ptr<MacLow> low) |
161 { | 162 { |
162 NS_LOG_FUNCTION (this << low); | 163 NS_LOG_FUNCTION (this << low); |
163 low->RegisterDcf (this); | 164 low->RegisterDcf (this); |
164 } | 165 } |
165 | 166 |
166 void | 167 void |
167 DcfManager::SetSlot (Time slotTime) | 168 DcfManager::SetSlot (Time slotTime) |
168 { | 169 { |
169 NS_LOG_FUNCTION (this << slotTime); | 170 NS_LOG_FUNCTION (this << slotTime); |
170 m_slotTimeUs = slotTime.GetMicroSeconds (); | 171 m_slotTimeUs = static_cast<uint32_t>(slotTime.GetMicroSeconds ()); |
171 } | 172 } |
172 | 173 |
173 void | 174 void |
174 DcfManager::SetSifs (Time sifs) | 175 DcfManager::SetSifs (Time sifs) |
175 { | 176 { |
176 NS_LOG_FUNCTION (this << sifs); | 177 NS_LOG_FUNCTION (this << sifs); |
177 m_sifs = sifs; | 178 m_sifs = sifs; |
178 } | 179 } |
179 | 180 |
180 void | 181 void |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 } | 379 } |
379 | 380 |
380 /** | 381 /** |
381 * Now, we notify all of these changes in one go. It is necessary to | 382 * Now, we notify all of these changes in one go. It is necessary to |
382 * perform first the calculations of which states are colliding and th
en | 383 * perform first the calculations of which states are colliding and th
en |
383 * only apply the changes because applying the changes through notific
ation | 384 * only apply the changes because applying the changes through notific
ation |
384 * could change the global state of the manager, and, thus, could chan
ge | 385 * could change the global state of the manager, and, thus, could chan
ge |
385 * the result of the calculations. | 386 * the result of the calculations. |
386 */ | 387 */ |
387 state->NotifyAccessGranted (); | 388 state->NotifyAccessGranted (); |
388 for (std::vector<Ptr<DcfState> >::iterator k = internalCollisionStates
.begin (); | 389 for (std::vector<Ptr<DcfState> >::iterator l = internalCollisionStates
.begin (); |
389 k != internalCollisionStates.end (); k++) | 390 l != internalCollisionStates.end (); l++) |
390 { | 391 { |
391 (*k)->NotifyInternalCollision (); | 392 (*l)->NotifyInternalCollision (); |
392 } | 393 } |
393 break; | 394 break; |
394 } | 395 } |
395 i++; | 396 i++; |
396 } | 397 } |
397 } | 398 } |
398 | 399 |
399 void | 400 void |
400 DcfManager::AccessTimeout (void) | 401 DcfManager::AccessTimeout (void) |
401 { | 402 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 { | 470 { |
470 NS_LOG_FUNCTION (this); | 471 NS_LOG_FUNCTION (this); |
471 uint32_t k = 0; | 472 uint32_t k = 0; |
472 for (States::iterator i = m_states.begin (); i != m_states.end (); i++, k++) | 473 for (States::iterator i = m_states.begin (); i != m_states.end (); i++, k++) |
473 { | 474 { |
474 Ptr<DcfState> state = *i; | 475 Ptr<DcfState> state = *i; |
475 | 476 |
476 Time backoffStart = GetBackoffStartFor (state); | 477 Time backoffStart = GetBackoffStartFor (state); |
477 if (backoffStart <= Simulator::Now ()) | 478 if (backoffStart <= Simulator::Now ()) |
478 { | 479 { |
479 uint32_t nus = (Simulator::Now () - backoffStart).GetMicroSeconds (); | 480 uint32_t nus = static_cast<uint32_t>((Simulator::Now () - backoffStart
).GetMicroSeconds ()); |
480 uint32_t nIntSlots = nus / m_slotTimeUs; | 481 uint32_t nIntSlots = nus / m_slotTimeUs; |
481 /* | 482 /* |
482 * EDCA behaves slightly different to DCA. For EDCA we | 483 * EDCA behaves slightly different to DCA. For EDCA we |
483 * decrement once at the slot boundary at the end of AIFS as | 484 * decrement once at the slot boundary at the end of AIFS as |
484 * well as once at the end of each clear slot | 485 * well as once at the end of each clear slot |
485 * thereafter. For DCA we only decrement at the end of each | 486 * thereafter. For DCA we only decrement at the end of each |
486 * clear slot after DIFS. We account for the extra backoff | 487 * clear slot after DIFS. We account for the extra backoff |
487 * by incrementing the slot count here in the case of | 488 * by incrementing the slot count here in the case of |
488 * EDCA. The if statement whose body we are in has confirmed | 489 * EDCA. The if statement whose body we are in has confirmed |
489 * that a minimum of AIFS has elapsed since last busy | 490 * that a minimum of AIFS has elapsed since last busy |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 780 |
780 void | 781 void |
781 DcfManager::NotifyCtsTimeoutResetNow () | 782 DcfManager::NotifyCtsTimeoutResetNow () |
782 { | 783 { |
783 NS_LOG_FUNCTION (this); | 784 NS_LOG_FUNCTION (this); |
784 m_lastCtsTimeoutEnd = Simulator::Now (); | 785 m_lastCtsTimeoutEnd = Simulator::Now (); |
785 DoRestartAccessTimeoutIfNeeded (); | 786 DoRestartAccessTimeoutIfNeeded (); |
786 } | 787 } |
787 | 788 |
788 } //namespace ns3 | 789 } //namespace ns3 |
OLD | NEW |