satellite-arq-sequence-number.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_ARQ_SEQUENCE_NUMBER_H_
22 #define SATELLITE_ARQ_SEQUENCE_NUMBER_H_
23 
24 #include <ns3/simple-ref-count.h>
25 
26 #include <map>
27 
38 namespace ns3
39 {
40 
41 class SatArqSequenceNumber : public SimpleRefCount<SatArqSequenceNumber>
42 {
43  public:
48 
53  SatArqSequenceNumber(uint8_t windowSize);
54 
56  {
57  }
58 
64  bool SeqNoAvailable() const;
65 
70  uint8_t NextSequenceNumber();
71 
77  void Release(uint8_t seqNo);
78 
79  private:
83  void CleanUp();
84 
85  std::map<uint32_t, bool> m_seqNoMap;
87  uint32_t m_windowSize;
88  uint32_t m_maxSn;
89 };
90 
91 } // namespace ns3
92 
93 #endif /* SATELLITE_ARQ_SEQUENCE_NUMBER_H_ */
uint8_t NextSequenceNumber()
Returns the next free sequence number.
bool SeqNoAvailable() const
Check whether there are free (released) sequence numbers.
std::map< uint32_t, bool > m_seqNoMap
void CleanUp()
Clean ups the sequence number map.
void Release(uint8_t seqNo)
Release a sequence number if either ACK is received or maximum retransmissions have been reached.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.