/usr/include/ns3.26/ns3/lte-rlc-sequence-number.h is in libns3-dev 3.26+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 | /* -*- 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 <limits>
#include <iostream>
#include <stdint.h>
// #include "ns3/lte-rlc.h"
namespace ns3 {
class SequenceNumber10
{
public:
SequenceNumber10 ()
: m_value (0),
m_modulusBase (0)
{}
explicit SequenceNumber10 (uint16_t value)
: m_value (value % 1024),
m_modulusBase (0)
{}
SequenceNumber10 (SequenceNumber10 const &value)
: m_value (value.m_value),
m_modulusBase (value.m_modulusBase)
{}
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;
}
void SetModulusBase (SequenceNumber10 modulusBase)
{
m_modulusBase = modulusBase.m_value;
}
void SetModulusBase (uint16_t modulusBase)
{
m_modulusBase = modulusBase;
}
// postfix ++
SequenceNumber10 operator++ (int)
{
SequenceNumber10 retval (m_value);
m_value = ((uint32_t)m_value + 1) % 1024;
retval.SetModulusBase (m_modulusBase);
return retval;
}
SequenceNumber10 operator + (uint16_t delta) const
{
SequenceNumber10 ret ((m_value + delta) % 1024);
ret.SetModulusBase (m_modulusBase);
return ret;
}
SequenceNumber10 operator - (uint16_t delta) const
{
SequenceNumber10 ret ((m_value - delta) % 1024);
ret.SetModulusBase (m_modulusBase);
return ret;
}
uint16_t operator - (const SequenceNumber10 &other) const
{
uint16_t diff = m_value - other.m_value;
return (diff);
}
bool operator > (const SequenceNumber10 &other) const
{
SequenceNumber10 v1 ((m_value - m_modulusBase) % 1024);
SequenceNumber10 v2 ((other.m_value - other.m_modulusBase) % 1024);
return ( v1.GetValue () > v2.GetValue () );
}
bool operator == (const SequenceNumber10 &other) const
{
return (m_value == other.m_value);
}
bool operator != (const SequenceNumber10 &other) const
{
return (m_value != other.m_value);
}
bool operator <= (const SequenceNumber10 &other) const
{
return (!this->operator> (other));
}
bool operator >= (const SequenceNumber10 &other) const
{
return (this->operator> (other) || this->operator== (other));
}
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;
uint16_t m_modulusBase;
};
} // namespace ns3
#endif // LTE_RLC_SEQUENCE_NUMBER_H
|