A Discrete-Event Network Simulator
API
block-ack-window.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 Universita' degli Studi di Napoli Federico II
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: Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #ifndef BLOCK_ACK_WINDOW_H
22 #define BLOCK_ACK_WINDOW_H
23 
24 #include <vector>
25 
26 namespace ns3 {
27 
57 {
58 public:
62  BlockAckWindow ();
69  void Init (uint16_t winStart, uint16_t winSize);
76  void Reset (uint16_t winStart);
82  uint16_t GetWinStart (void) const;
88  uint16_t GetWinEnd (void) const;
94  std::size_t GetWinSize (void) const;
104  std::vector<bool>::reference At (std::size_t distance);
110  void Advance (std::size_t count);
111 
112 private:
113  uint16_t m_winStart;
114  std::vector<bool> m_window;
115  std::size_t m_head;
116 };
117 
118 } //namespace ns3
119 
120 #endif /* BLOCK_ACK_WINDOW_H */
void Advance(std::size_t count)
Advance the current winStart by the given number of positions.
void Init(uint16_t winStart, uint16_t winSize)
Initialize the window with the given starting sequence number and size.
uint16_t GetWinStart(void) const
Get the current winStart value.
Block ack window.
std::vector< bool > m_window
window
uint16_t m_winStart
window start (sequence number)
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.
std::size_t m_head
index of winStart in the vector
BlockAckWindow()
Constructor.
uint16_t GetWinEnd(void) const
Get the current winEnd value.
std::size_t GetWinSize(void) const
Get the window size.
void Reset(uint16_t winStart)
Reset the window by clearing all the elements and setting winStart to the given value.