A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
backoff.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 Emmanuelle Laprise
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
18 * Derived from the p2p net device file
19Transmi */
20
21#ifndef BACKOFF_H
22#define BACKOFF_H
23
24#include "ns3/nstime.h"
25#include "ns3/random-variable-stream.h"
26
27#include <stdint.h>
28
29namespace ns3
30{
31
39{
40 public:
46
52
57
62
68
69 Backoff();
78 Backoff(Time slotTime,
79 uint32_t minSlots,
80 uint32_t maxSlots,
81 uint32_t ceiling,
82 uint32_t maxRetries);
83
89
95 void ResetBackoffTime();
96
100 bool MaxRetriesReached() const;
101
105 void IncrNumRetries();
106
115 int64_t AssignStreams(int64_t stream);
116
117 private:
122
127};
128
129} // namespace ns3
130
131#endif /* BACKOFF_H */
The backoff class is used for calculating backoff times when many net devices can write to the same c...
Definition: backoff.h:39
void ResetBackoffTime()
Indicates to the backoff object that the last packet was successfully transmitted and that the number...
Definition: backoff.cc:85
uint32_t m_maxRetries
Maximum number of transmission retries before the packet is dropped.
Definition: backoff.h:61
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: backoff.cc:103
uint32_t m_maxSlots
Maximum number of backoff slots (when multiplied by m_slotTime, determines maximum backoff time)
Definition: backoff.h:51
uint32_t m_numBackoffRetries
Number of times that the transmitter has tried to unsuccessfuly transmit the current packet.
Definition: backoff.h:121
bool MaxRetriesReached() const
Definition: backoff.cc:91
void IncrNumRetries()
Increments the number of retries by 1.
Definition: backoff.cc:97
uint32_t m_minSlots
Minimum number of backoff slots (when multiplied by m_slotTime, determines minimum backoff time)
Definition: backoff.h:45
Time GetBackoffTime()
Definition: backoff.cc:58
Ptr< UniformRandomVariable > m_rng
Random number generator.
Definition: backoff.h:126
uint32_t m_ceiling
Caps the exponential function when the number of retries reaches m_ceiling.
Definition: backoff.h:56
Time m_slotTime
Length of one slot.
Definition: backoff.h:67
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.