A Discrete-Event Network Simulator
API
tcp-option-sack.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Adrian Sai-wah Tam
4  * Copyright (c) 2015 ResiliNets, ITTC, University of Kansas
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Original Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
20  * Documentation, test cases: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
21  * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
22  * The University of Kansas
23  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
24  */
25 
26 #ifndef TCP_OPTION_SACK_H
27 #define TCP_OPTION_SACK_H
28 
29 #include "ns3/tcp-option.h"
30 #include "ns3/sequence-number.h"
31 
32 namespace ns3 {
33 
49 class TcpOptionSack : public TcpOption
50 {
51 public:
56  static TypeId GetTypeId (void);
57  virtual TypeId GetInstanceTypeId (void) const;
58 
59  typedef std::pair<SequenceNumber32, SequenceNumber32> SackBlock;
60  typedef std::list<SackBlock> SackList;
61 
62  TcpOptionSack ();
63  virtual ~TcpOptionSack ();
64 
65  virtual void Print (std::ostream &os) const;
66  virtual void Serialize (Buffer::Iterator start) const;
67  virtual uint32_t Deserialize (Buffer::Iterator start);
68 
69  virtual uint8_t GetKind (void) const;
70  virtual uint32_t GetSerializedSize (void) const;
71 
76  void AddSackBlock (SackBlock s);
77 
82  uint32_t GetNumSackBlocks (void) const;
83 
87  void ClearSackList (void);
88 
93  SackList GetSackList (void) const;
94 
95  friend std::ostream & operator<< (std::ostream & os, TcpOptionSack const & sackOption);
96 
97 protected:
99 };
100 
107 std::ostream & operator<< (std::ostream & os,
108  TcpOptionSack const & sackOption);
109 
116 std::ostream & operator<< (std::ostream & os,
117  TcpOptionSack::SackBlock const & sackBlock);
118 
119 } // namespace ns3
120 
121 #endif /* TCP_OPTION_SACK */
ns3::TcpOptionSack::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization.
Definition: tcp-option-sack.cc:72
ns3::TcpOptionSack::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the Option to a buffer iterator.
Definition: tcp-option-sack.cc:80
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpOptionSack::AddSackBlock
void AddSackBlock(SackBlock s)
Add a SACK block.
Definition: tcp-option-sack.cc:132
ns3::TcpOption
Base class for all kinds of TCP options.
Definition: tcp-option.h:37
ns3::TcpOptionSack::GetSackList
SackList GetSackList(void) const
Get the SACK list.
Definition: tcp-option-sack.cc:153
ns3::TcpOptionSack::GetKind
virtual uint8_t GetKind(void) const
Get the ‘kind’ (as in RFC 793) of this option.
Definition: tcp-option-sack.cc:126
visualizer.core.start
def start()
Definition: core.py:1855
ns3::TcpOptionSack::m_sackList
SackList m_sackList
the list of SACK blocks
Definition: tcp-option-sack.h:98
ns3::TcpOptionSack
Defines the TCP option of kind 5 (selective acknowledgment option) as in RFC 2018
Definition: tcp-option-sack.h:50
ns3::TcpOptionSack::GetNumSackBlocks
uint32_t GetNumSackBlocks(void) const
Count the total number of SACK blocks.
Definition: tcp-option-sack.cc:139
ns3::TcpOptionSack::SackBlock
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Definition: tcp-option-sack.h:59
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition: buffer.h:99
ns3::TcpOptionSack::~TcpOptionSack
virtual ~TcpOptionSack()
Definition: tcp-option-sack.cc:40
ns3::TcpOptionSack::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the Option from a buffer iterator.
Definition: tcp-option-sack.cc:98
ns3::TcpOptionSack::ClearSackList
void ClearSackList(void)
Clear the SACK list.
Definition: tcp-option-sack.cc:147
ns3::TcpOptionSack::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: tcp-option-sack.cc:56
ns3::TcpOptionSack::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-option-sack.cc:45
ns3::TcpOptionSack::TcpOptionSack
TcpOptionSack()
Definition: tcp-option-sack.cc:35
ns3::TcpOptionSack::operator<<
friend std::ostream & operator<<(std::ostream &os, TcpOptionSack const &sackOption)
Output operator.
Definition: tcp-option-sack.cc:160
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
ns3::TcpOptionSack::Print
virtual void Print(std::ostream &os) const
Print the Option contents.
Definition: tcp-option-sack.cc:62
ns3::TcpOptionSack::SackList
std::list< SackBlock > SackList
SACK list definition.
Definition: tcp-option-sack.h:60