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 "ns3/sequence-number.h"
29 #include "ns3/tcp-option.h"
30 
31 namespace ns3
32 {
33 
49 class TcpOptionSack : public TcpOption
50 {
51  public:
56  static TypeId GetTypeId();
57  TypeId GetInstanceTypeId() const override;
58 
59  typedef std::pair<SequenceNumber32, SequenceNumber32> SackBlock;
60  typedef std::list<SackBlock> SackList;
61 
62  TcpOptionSack();
63  ~TcpOptionSack() override;
64 
65  void Print(std::ostream& os) const override;
66  void Serialize(Buffer::Iterator start) const override;
67  uint32_t Deserialize(Buffer::Iterator start) override;
68 
69  uint8_t GetKind() const override;
70  uint32_t GetSerializedSize() const override;
71 
76  void AddSackBlock(SackBlock s);
77 
82  uint32_t GetNumSackBlocks() const;
83 
87  void ClearSackList();
88 
93  SackList GetSackList() const;
94 
95  friend std::ostream& operator<<(std::ostream& os, const TcpOptionSack& sackOption);
96 
97  protected:
99 };
100 
107 std::ostream& operator<<(std::ostream& os, const TcpOptionSack& sackOption);
108 
115 std::ostream& operator<<(std::ostream& os, const TcpOptionSack::SackBlock& sackBlock);
116 
117 } // namespace ns3
118 
119 #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:60
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:129