The backoff class is used for calculating backoff times when many net devices can write to the same channel. More...
#include "backoff.h"
Public Member Functions | |
Backoff (Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries) | |
Constructor. More... | |
Backoff (void) | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
Time | GetBackoffTime () |
void | IncrNumRetries (void) |
Increments the number of retries by 1. More... | |
bool | MaxRetriesReached (void) |
void | ResetBackoffTime (void) |
Indicates to the backoff object that the last packet was successfully transmitted and that the number of retries should be reset to 0. More... | |
Public Attributes | |
uint32_t | m_ceiling |
Caps the exponential function when the number of retries reaches m_ceiling. More... | |
uint32_t | m_maxRetries |
Maximum number of transmission retries before the packet is dropped. More... | |
uint32_t | m_maxSlots |
Maximum number of backoff slots (when multiplied by m_slotTime, determines maximum backoff time) More... | |
uint32_t | m_minSlots |
Minimum number of backoff slots (when multiplied by m_slotTime, determines minimum backoff time) More... | |
Time | m_slotTime |
Length of one slot. More... | |
Private Attributes | |
uint32_t | m_numBackoffRetries |
Number of times that the transmitter has tried to unsuccessfully transmit the current packet. More... | |
Ptr< UniformRandomVariable > | m_rng |
Random number generator. More... | |
The backoff class is used for calculating backoff times when many net devices can write to the same channel.
ns3::Backoff::Backoff | ( | void | ) |
Definition at line 28 of file backoff.cc.
References m_ceiling, m_maxRetries, m_maxSlots, m_minSlots, m_numBackoffRetries, m_rng, m_slotTime, ns3::MicroSeconds(), and ResetBackoffTime().
ns3::Backoff::Backoff | ( | Time | slotTime, |
uint32_t | minSlots, | ||
uint32_t | maxSlots, | ||
uint32_t | ceiling, | ||
uint32_t | maxRetries | ||
) |
Constructor.
slotTime | Length of one slot |
minSlots | Minimum number of backoff slots |
maxSlots | Maximum number of backoff slots |
ceiling | Cap to the exponential function |
maxRetries | Maximum number of transmission retries |
Definition at line 41 of file backoff.cc.
References m_ceiling, m_maxRetries, m_maxSlots, m_minSlots, m_numBackoffRetries, m_rng, and m_slotTime.
int64_t ns3::Backoff::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Definition at line 98 of file backoff.cc.
References m_rng, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
Referenced by ns3::CsmaNetDevice::AssignStreams().
Time ns3::Backoff::GetBackoffTime | ( | void | ) |
Definition at line 53 of file backoff.cc.
References ns3::UniformRandomVariable::GetValue(), m_ceiling, m_maxSlots, m_minSlots, m_numBackoffRetries, m_rng, and m_slotTime.
Referenced by ns3::CsmaNetDevice::TransmitStart().
void ns3::Backoff::IncrNumRetries | ( | void | ) |
Increments the number of retries by 1.
Definition at line 92 of file backoff.cc.
References m_numBackoffRetries.
Referenced by ns3::CsmaNetDevice::TransmitStart().
bool ns3::Backoff::MaxRetriesReached | ( | void | ) |
Definition at line 86 of file backoff.cc.
References m_maxRetries, and m_numBackoffRetries.
Referenced by ns3::CsmaNetDevice::TransmitStart().
void ns3::Backoff::ResetBackoffTime | ( | void | ) |
Indicates to the backoff object that the last packet was successfully transmitted and that the number of retries should be reset to 0.
Definition at line 80 of file backoff.cc.
References m_numBackoffRetries.
Referenced by Backoff(), ns3::CsmaNetDevice::TransmitAbort(), and ns3::CsmaNetDevice::TransmitStart().
uint32_t ns3::Backoff::m_ceiling |
Caps the exponential function when the number of retries reaches m_ceiling.
Definition at line 52 of file backoff.h.
Referenced by Backoff(), GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().
uint32_t ns3::Backoff::m_maxRetries |
Maximum number of transmission retries before the packet is dropped.
Definition at line 57 of file backoff.h.
Referenced by Backoff(), MaxRetriesReached(), and ns3::CsmaNetDevice::SetBackoffParams().
uint32_t ns3::Backoff::m_maxSlots |
Maximum number of backoff slots (when multiplied by m_slotTime, determines maximum backoff time)
Definition at line 47 of file backoff.h.
Referenced by Backoff(), GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().
uint32_t ns3::Backoff::m_minSlots |
Minimum number of backoff slots (when multiplied by m_slotTime, determines minimum backoff time)
Definition at line 42 of file backoff.h.
Referenced by Backoff(), GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().
|
private |
Number of times that the transmitter has tried to unsuccessfully transmit the current packet.
Definition at line 113 of file backoff.h.
Referenced by Backoff(), GetBackoffTime(), IncrNumRetries(), MaxRetriesReached(), and ResetBackoffTime().
|
private |
Random number generator.
Definition at line 118 of file backoff.h.
Referenced by Backoff(), AssignStreams(), and GetBackoffTime().
Time ns3::Backoff::m_slotTime |
Length of one slot.
A slot time, it usually the packet transmission time, if the packet size is fixed.
Definition at line 62 of file backoff.h.
Referenced by Backoff(), GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().