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 #include <stdint.h>
28 
39 namespace ns3
40 {
41 
42 class SatArqSequenceNumber : public SimpleRefCount<SatArqSequenceNumber>
43 {
44  public:
49 
54  SatArqSequenceNumber(uint8_t windowSize);
55 
57  {
58  }
59 
65  bool SeqNoAvailable() const;
66 
71  uint8_t NextSequenceNumber();
72 
78  void Release(uint8_t seqNo);
79 
80  private:
84  void CleanUp();
85 
86  std::map<uint32_t, bool> m_seqNoMap;
88  uint32_t m_windowSize;
89  uint32_t m_maxSn;
90 };
91 
92 } // namespace ns3
93 
94 #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.