A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
csma
model
backoff.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 Emmanuelle Laprise
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: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
19
* Derived from the p2p net device file
20
Transmi */
21
22
#ifndef BACKOFF_H
23
#define BACKOFF_H
24
25
#include <stdint.h>
26
#include "ns3/nstime.h"
27
#include "ns3/random-variable-stream.h"
28
29
namespace
ns3
{
30
37
class
Backoff
{
38
public
:
42
uint32_t
m_minSlots
;
43
47
uint32_t
m_maxSlots
;
48
52
uint32_t
m_ceiling
;
53
57
uint32_t
m_maxRetries
;
58
62
Time
m_slotTime
;
63
64
Backoff
(
void
);
73
Backoff
(
Time
slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries);
74
79
Time
GetBackoffTime
();
80
86
void
ResetBackoffTime
(
void
);
87
91
bool
MaxRetriesReached
(
void
);
92
96
void
IncrNumRetries
(
void
);
97
106
int64_t
AssignStreams
(int64_t stream);
107
108
private
:
109
113
uint32_t
m_numBackoffRetries
;
114
118
Ptr<UniformRandomVariable>
m_rng
;
119
};
120
121
}
// namespace ns3
122
123
#endif
/* BACKOFF_H */
ns3::Backoff::Backoff
Backoff(void)
Definition:
backoff.cc:28
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Backoff::ResetBackoffTime
void ResetBackoffTime(void)
Indicates to the backoff object that the last packet was successfully transmitted and that the number...
Definition:
backoff.cc:80
ns3::Ptr< UniformRandomVariable >
ns3::Backoff::m_maxSlots
uint32_t m_maxSlots
Maximum number of backoff slots (when multiplied by m_slotTime, determines maximum backoff time) ...
Definition:
backoff.h:47
ns3::Backoff::m_maxRetries
uint32_t m_maxRetries
Maximum number of transmission retries before the packet is dropped.
Definition:
backoff.h:57
ns3::Backoff
The backoff class is used for calculating backoff times when many net devices can write to the same c...
Definition:
backoff.h:37
ns3::Backoff::MaxRetriesReached
bool MaxRetriesReached(void)
Definition:
backoff.cc:86
ns3::Backoff::m_rng
Ptr< UniformRandomVariable > m_rng
Random number generator.
Definition:
backoff.h:118
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Backoff::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition:
backoff.cc:98
ns3::Backoff::GetBackoffTime
Time GetBackoffTime()
Definition:
backoff.cc:53
ns3::Backoff::m_minSlots
uint32_t m_minSlots
Minimum number of backoff slots (when multiplied by m_slotTime, determines minimum backoff time) ...
Definition:
backoff.h:42
ns3::Backoff::m_slotTime
Time m_slotTime
Length of one slot.
Definition:
backoff.h:62
ns3::Backoff::IncrNumRetries
void IncrNumRetries(void)
Increments the number of retries by 1.
Definition:
backoff.cc:92
ns3::Backoff::m_numBackoffRetries
uint32_t m_numBackoffRetries
Number of times that the transmitter has tried to unsuccessfully transmit the current packet...
Definition:
backoff.h:113
ns3::Backoff::m_ceiling
uint32_t m_ceiling
Caps the exponential function when the number of retries reaches m_ceiling.
Definition:
backoff.h:52
Generated on Wed Nov 7 2018 10:01:51 for ns-3 by
1.8.14