/usr/include/ns3.27/ns3/backoff.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 Emmanuelle Laprise
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
* Derived from the p2p net device file
Transmi */
#ifndef BACKOFF_H
#define BACKOFF_H
#include <stdint.h>
#include "ns3/nstime.h"
#include "ns3/random-variable-stream.h"
namespace ns3 {
/**
* \ingroup csma
* \brief The backoff class is used for calculating backoff times
* when many net devices can write to the same channel
*/
class Backoff {
public:
/**
* Minimum number of backoff slots (when multiplied by m_slotTime, determines minimum backoff time)
*/
uint32_t m_minSlots;
/**
* Maximum number of backoff slots (when multiplied by m_slotTime, determines maximum backoff time)
*/
uint32_t m_maxSlots;
/**
* Caps the exponential function when the number of retries reaches m_ceiling.
*/
uint32_t m_ceiling;
/**
* Maximum number of transmission retries before the packet is dropped.
*/
uint32_t m_maxRetries;
/**
* Length of one slot. A slot time, it usually the packet transmission time, if the packet size is fixed.
*/
Time m_slotTime;
Backoff (void);
/**
* \brief Constructor
* \param slotTime Length of one slot
* \param minSlots Minimum number of backoff slots
* \param maxSlots Maximum number of backoff slots
* \param ceiling Cap to the exponential function
* \param maxRetries Maximum number of transmission retries
*/
Backoff (Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries);
/**
* \return The amount of time that the net device should wait before
* trying to retransmit the packet
*/
Time GetBackoffTime ();
/**
* Indicates to the backoff object that the last packet was
* successfully transmitted and that the number of retries should be
* reset to 0.
*/
void ResetBackoffTime (void);
/**
* \return True if the maximum number of retries has been reached
*/
bool MaxRetriesReached (void);
/**
* Increments the number of retries by 1.
*/
void IncrNumRetries (void);
/**
* 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.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams (int64_t stream);
private:
/**
* Number of times that the transmitter has tried to unsuccessfully transmit the current packet.
*/
uint32_t m_numBackoffRetries;
/**
* Random number generator
*/
Ptr<UniformRandomVariable> m_rng;
};
} // namespace ns3
#endif /* BACKOFF_H */
|