A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::Backoff Class Reference

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)
 
int64_t AssignStreams (int64_t stream)
 
Time GetBackoffTime ()
 
void IncrNumRetries (void)
 
bool MaxRetriesReached (void)
 
void ResetBackoffTime (void)
 

Public Attributes

uint32_t m_ceiling
 
uint32_t m_maxRetries
 
uint32_t m_maxSlots
 
uint32_t m_minSlots
 
Time m_slotTime
 

Private Attributes

uint32_t m_numBackoffRetries
 
Ptr< UniformRandomVariablem_rng
 

Detailed Description

The backoff class is used for calculating backoff times when many net devices can write to the same channel.

Definition at line 37 of file backoff.h.

Member Function Documentation

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.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 96 of file backoff.cc.

References NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

Referenced by ns3::CsmaNetDevice::AssignStreams().

Time ns3::Backoff::GetBackoffTime ( void  )
Returns
The amount of time that the net device should wait before trying to retransmit the packet

Definition at line 51 of file backoff.cc.

References ns3::UniformRandomVariable::GetValue(), m_ceiling, m_maxSlots, m_minSlots, m_numBackoffRetries, and m_slotTime.

Referenced by ns3::CsmaNetDevice::TransmitStart().

void ns3::Backoff::IncrNumRetries ( void  )

Increments the number of retries by 1.

Definition at line 90 of file backoff.cc.

References m_numBackoffRetries.

Referenced by ns3::CsmaNetDevice::TransmitStart().

bool ns3::Backoff::MaxRetriesReached ( void  )
Returns
True if the maximum number of retries has been reached

Definition at line 84 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 78 of file backoff.cc.

References m_numBackoffRetries.

Referenced by ns3::CsmaNetDevice::TransmitAbort(), and ns3::CsmaNetDevice::TransmitStart().

Member Data Documentation

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 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 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 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 GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().

uint32_t ns3::Backoff::m_numBackoffRetries
private

Number of times that the transmitter has tried to unsuccessfully transmit the current packet.

Definition at line 105 of file backoff.h.

Referenced by GetBackoffTime(), IncrNumRetries(), MaxRetriesReached(), and ResetBackoffTime().

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 GetBackoffTime(), and ns3::CsmaNetDevice::SetBackoffParams().


The documentation for this class was generated from the following files: