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 */
virtual uint8_t GetKind(void) const
Get the ‘kind’ (as in RFC 793) of this option.
friend std::ostream & operator<<(std::ostream &os, TcpOptionSack const &sackOption)
Output operator.
def start()
Definition: core.py:1844
std::list< SackBlock > SackList
SACK list definition.
void AddSackBlock(SackBlock s)
Add a SACK block.
iterator in a Buffer instance
Definition: buffer.h:98
uint32_t GetNumSackBlocks(void) const
Count the total number of SACK blocks.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
SackList m_sackList
the list of SACK blocks
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the Option from a buffer iterator.
Defines the TCP option of kind 5 (selective acknowledgment option) as in RFC 2018 ...
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
void ClearSackList(void)
Clear the SACK list.
virtual void Serialize(Buffer::Iterator start) const
Serialize the Option to a buffer iterator.
virtual uint32_t GetSerializedSize(void) const
Returns number of bytes required for Option serialization.
Base class for all kinds of TCP options.
Definition: tcp-option.h:36
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:58
virtual void Print(std::ostream &os) const
Print the Option contents.
SackList GetSackList(void) const
Get the SACK list.