A Discrete-Event Network Simulator
API
block-ack-window.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Universita' degli Studi di Napoli Federico II
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Stefano Avallone <stavallo@unina.it>
18  */
19 
20 #ifndef BLOCK_ACK_WINDOW_H
21 #define BLOCK_ACK_WINDOW_H
22 
23 #include <cstdint>
24 #include <vector>
25 
26 namespace ns3
27 {
28 
58 {
59  public:
70  void Init(uint16_t winStart, uint16_t winSize);
77  void Reset(uint16_t winStart);
83  uint16_t GetWinStart() const;
89  uint16_t GetWinEnd() const;
95  std::size_t GetWinSize() const;
105  std::vector<bool>::reference At(std::size_t distance);
115  std::vector<bool>::const_reference At(std::size_t distance) const;
121  void Advance(std::size_t count);
122 
123  private:
124  uint16_t m_winStart;
125  std::vector<bool> m_window;
126  std::size_t m_head;
127 };
128 
129 } // namespace ns3
130 
131 #endif /* BLOCK_ACK_WINDOW_H */
Block ack window.
void Reset(uint16_t winStart)
Reset the window by clearing all the elements and setting winStart to the given value.
BlockAckWindow()
Constructor.
std::size_t GetWinSize() const
Get the window size.
void Advance(std::size_t count)
Advance the current winStart by the given number of positions.
uint16_t GetWinStart() const
Get the current winStart value.
uint16_t GetWinEnd() const
Get the current winEnd value.
uint16_t m_winStart
window start (sequence number)
std::size_t m_head
index of winStart in the vector
void Init(uint16_t winStart, uint16_t winSize)
Initialize the window with the given starting sequence number and size.
std::vector< bool > m_window
window
std::vector< bool >::reference At(std::size_t distance)
Get a reference to the element in the window having the given distance from the current winStart.
Every class exported by the ns3 library is enclosed in the ns3 namespace.