A Discrete-Event Network Simulator
API
tcp-option-sack.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Adrian Sai-wah Tam
3  * Copyright (c) 2015 ResiliNets, ITTC, University of Kansas
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  * Original Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
19  * Documentation, test cases: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
20  * ResiliNets Research Group https://resilinets.org/
21  * The University of Kansas
22  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
23  */
24 
25 #ifndef TCP_OPTION_SACK_H
26 #define TCP_OPTION_SACK_H
27 
28 #include "tcp-option.h"
29 
30 #include "ns3/sequence-number.h"
31 
32 namespace ns3
33 {
34 
50 class TcpOptionSack : public TcpOption
51 {
52  public:
57  static TypeId GetTypeId();
58  TypeId GetInstanceTypeId() const override;
59 
60  typedef std::pair<SequenceNumber32, SequenceNumber32> SackBlock;
61  typedef std::list<SackBlock> SackList;
62 
63  TcpOptionSack();
64  ~TcpOptionSack() override;
65 
66  void Print(std::ostream& os) const override;
67  void Serialize(Buffer::Iterator start) const override;
68  uint32_t Deserialize(Buffer::Iterator start) override;
69 
70  uint8_t GetKind() const override;
71  uint32_t GetSerializedSize() const override;
72 
77  void AddSackBlock(SackBlock s);
78 
83  uint32_t GetNumSackBlocks() const;
84 
88  void ClearSackList();
89 
94  SackList GetSackList() const;
95 
96  friend std::ostream& operator<<(std::ostream& os, const TcpOptionSack& sackOption);
97 
98  protected:
100 };
101 
108 std::ostream& operator<<(std::ostream& os, const TcpOptionSack& sackOption);
109 
116 std::ostream& operator<<(std::ostream& os, const TcpOptionSack::SackBlock& sackBlock);
117 
118 } // namespace ns3
119 
120 #endif /* TCP_OPTION_SACK */
iterator in a Buffer instance
Definition: buffer.h:100
Base class for all kinds of TCP options.
Definition: tcp-option.h:38
Defines the TCP option of kind 5 (selective acknowledgment option) as in RFC 2018
void ClearSackList()
Clear the SACK list.
std::list< SackBlock > SackList
SACK list definition.
uint32_t GetNumSackBlocks() const
Count the total number of SACK blocks.
uint8_t GetKind() const override
Get the ‘kind’ (as in RFC 793) of this option.
friend std::ostream & operator<<(std::ostream &os, const TcpOptionSack &sackOption)
Output operator.
void Print(std::ostream &os) const override
Print the Option contents.
void Serialize(Buffer::Iterator start) const override
Serialize the Option to a buffer iterator.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
static TypeId GetTypeId()
Get the type ID.
void AddSackBlock(SackBlock s)
Add a SACK block.
~TcpOptionSack() override
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the Option from a buffer iterator.
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
SackList m_sackList
the list of SACK blocks
SackList GetSackList() const
Get the SACK list.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159