/usr/include/ns3.27/ns3/lte-rlc-sequence-number.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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* 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: Manuel Requena <manuel.requena@cttc.es>
*/
#ifndef LTE_RLC_SEQUENCE_NUMBER_H
#define LTE_RLC_SEQUENCE_NUMBER_H
#include <ns3/assert.h>
#include <limits>
#include <iostream>
#include <stdint.h>
// #include "ns3/lte-rlc.h"
namespace ns3 {
/// SequenceNumber10 class
class SequenceNumber10
{
public:
SequenceNumber10 ()
: m_value (0),
m_modulusBase (0)
{}
/**
* Constructor
*
* \param value the value
*/
explicit SequenceNumber10 (uint16_t value)
: m_value (value % 1024),
m_modulusBase (0)
{}
/**
* Constructor
*
* \param value the value
*/
SequenceNumber10 (SequenceNumber10 const &value)
: m_value (value.m_value),
m_modulusBase (value.m_modulusBase)
{}
/**
* Assignment operator
*
* \param value the value
* \returns SequenceNumber10
*/
SequenceNumber10& operator= (uint16_t value)
{
m_value = value % 1024;
return *this;
}
/**
* \brief Extracts the numeric value of the sequence number
* \returns the sequence number value
*/
uint16_t GetValue () const
{
return m_value;
}
/**
* \brief Set modulus base
* \param modulusBase the modulus
*/
void SetModulusBase (SequenceNumber10 modulusBase)
{
m_modulusBase = modulusBase.m_value;
}
/**
* \brief Set modulus base
* \param modulusBase the modulus
*/
void SetModulusBase (uint16_t modulusBase)
{
m_modulusBase = modulusBase;
}
/**
* postfix ++ operator
* \returns SequenceNumber10
*/
SequenceNumber10 operator++ (int)
{
SequenceNumber10 retval (m_value);
m_value = ((uint32_t)m_value + 1) % 1024;
retval.SetModulusBase (m_modulusBase);
return retval;
}
/**
* addition operator
* \param delta the amount to add
* \returns SequenceNumber10
*/
SequenceNumber10 operator + (uint16_t delta) const
{
SequenceNumber10 ret ((m_value + delta) % 1024);
ret.SetModulusBase (m_modulusBase);
return ret;
}
/**
* subtraction operator
* \param delta the amount to subtract
* \returns SequenceNumber10
*/
SequenceNumber10 operator - (uint16_t delta) const
{
SequenceNumber10 ret ((m_value - delta) % 1024);
ret.SetModulusBase (m_modulusBase);
return ret;
}
/**
* subtraction operator
* \param other the amount to subtract
* \returns SequenceNumber10
*/
uint16_t operator - (const SequenceNumber10 &other) const
{
uint16_t diff = m_value - other.m_value;
return (diff);
}
/**
* greater than operator
* \param other the object to compare
* \returns true if greater than
*/
bool operator > (const SequenceNumber10 &other) const
{
NS_ASSERT (m_modulusBase == other.m_modulusBase);
uint16_t v1 = (m_value - m_modulusBase) % 1024;
uint16_t v2 = (other.m_value - other.m_modulusBase) % 1024;
return v1 > v2;
}
/**
* equality operator
* \param other the object to compare
* \returns true if equal
*/
bool operator == (const SequenceNumber10 &other) const
{
return (m_value == other.m_value);
}
/**
* inequality operator
* \param other the object to compare
* \returns true if not equal
*/
bool operator != (const SequenceNumber10 &other) const
{
return (m_value != other.m_value);
}
/**
* less than or equal operator
* \param other the object to compare
* \returns true if less than or equal
*/
bool operator <= (const SequenceNumber10 &other) const
{
return (!this->operator> (other));
}
/**
* greater than or equal operator
* \param other the object to compare
* \returns true if greater than or equal
*/
bool operator >= (const SequenceNumber10 &other) const
{
return (this->operator> (other) || this->operator== (other));
}
/**
* less than operator
* \param other the object to compare
* \returns true if less than
*/
bool operator < (const SequenceNumber10 &other) const
{
return !this->operator> (other) && m_value != other.m_value;
}
friend std::ostream & operator<< (std::ostream& os, const SequenceNumber10 &val);
private:
uint16_t m_value; ///< the value
uint16_t m_modulusBase; ///< the modulus base
};
} // namespace ns3
#endif // LTE_RLC_SEQUENCE_NUMBER_H
|