A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
backoff.h
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 
63 
64  Backoff (void);
65  Backoff (Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries);
66 
72 
78  void ResetBackoffTime (void);
79 
83  bool MaxRetriesReached (void);
84 
88  void IncrNumRetries (void);
89 
98  int64_t AssignStreams (int64_t stream);
99 
100 private:
101 
107 };
108 
109 } // namespace ns3
110 
111 #endif /* BACKOFF_H */
keep track of time unit.
Definition: nstime.h:149
void ResetBackoffTime(void)
Definition: backoff.cc:78
uint32_t m_maxSlots
Definition: backoff.h:47
uint32_t m_maxRetries
Definition: backoff.h:57
The backoff class is used for calculating backoff times when many net devices can write to the same c...
Definition: backoff.h:37
bool MaxRetriesReached(void)
Definition: backoff.cc:84
int64_t AssignStreams(int64_t stream)
Definition: backoff.cc:96
Time GetBackoffTime()
Definition: backoff.cc:51
uint32_t m_minSlots
Definition: backoff.h:42
Time m_slotTime
Definition: backoff.h:62
void IncrNumRetries(void)
Definition: backoff.cc:90
uint32_t m_numBackoffRetries
Definition: backoff.h:105
uint32_t m_ceiling
Definition: backoff.h:52