A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
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
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Original Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
8
* Documentation, test cases: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
9
* ResiliNets Research Group https://resilinets.org/
10
* The University of Kansas
11
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
12
*/
13
14
#ifndef TCP_OPTION_SACK_H
15
#define TCP_OPTION_SACK_H
16
17
#include "
tcp-option.h
"
18
19
#include "ns3/sequence-number.h"
20
21
namespace
ns3
22
{
23
24
/**
25
* @brief Defines the TCP option of kind 5 (selective acknowledgment option) as
26
* in \RFC{2018}
27
*
28
* TCP SACK Option is used by a receiver to report non-contiguous blocks of data
29
* that have been received and queued in the receiving buffer. Using the
30
* information conveyed in SACK option sender retransmits only the segments that
31
* have actually been lost, allowing the recovery of multiple packet losses per
32
* sending window.
33
*
34
* Each SACK block is defined by two 32-bit unsigned integers specifying the
35
* left and the right edge of the block. It means that with the 40-byte TCP
36
* option limitation in addition to the presence of TCP Timestamp Option, the
37
* maximum number of SACK blocks that can be appended to each segment is 3.
38
*/
39
class
TcpOptionSack
:
public
TcpOption
40
{
41
public
:
42
/**
43
* @brief Get the type ID.
44
* @return the object TypeId
45
*/
46
static
TypeId
GetTypeId
();
47
TypeId
GetInstanceTypeId
()
const override
;
48
49
typedef
std::pair<SequenceNumber32, SequenceNumber32>
SackBlock
;
//!< SACK block definition
50
typedef
std::list<SackBlock>
SackList
;
//!< SACK list definition
51
52
TcpOptionSack
();
53
~TcpOptionSack
()
override
;
54
55
void
Print
(std::ostream& os)
const override
;
56
void
Serialize
(
Buffer::Iterator
start)
const override
;
57
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
58
59
uint8_t
GetKind
()
const override
;
60
uint32_t
GetSerializedSize
()
const override
;
61
62
/**
63
* @brief Add a SACK block
64
* @param s the SACK block to be added
65
*/
66
void
AddSackBlock
(
SackBlock
s);
67
68
/**
69
* @brief Count the total number of SACK blocks
70
* @return the total number of SACK blocks
71
*/
72
uint32_t
GetNumSackBlocks
()
const
;
73
74
/**
75
* @brief Clear the SACK list
76
*/
77
void
ClearSackList
();
78
79
/**
80
* @brief Get the SACK list
81
* @return the SACK list
82
*/
83
SackList
GetSackList
()
const
;
84
85
friend
std::ostream&
operator<<
(std::ostream& os,
const
TcpOptionSack
& sackOption);
86
87
protected
:
88
SackList
m_sackList
;
//!< the list of SACK blocks
89
};
90
91
/**
92
* @brief Output operator.
93
* @param os The output stream.
94
* @param sackOption the option to print.
95
* @returns The output stream.
96
*/
97
std::ostream&
operator<<
(std::ostream& os,
const
TcpOptionSack
& sackOption);
98
99
/**
100
* @brief Output operator.
101
* @param os The output stream.
102
* @param sackBlock the block to print.
103
* @returns The output stream.
104
*/
105
std::ostream&
operator<<
(std::ostream& os,
const
TcpOptionSack::SackBlock
& sackBlock);
106
107
}
// namespace ns3
108
109
#endif
/* TCP_OPTION_SACK */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::TcpOption
Base class for all kinds of TCP options.
Definition
tcp-option.h:27
ns3::TcpOptionSack
Defines the TCP option of kind 5 (selective acknowledgment option) as in RFC 2018
Definition
tcp-option-sack.h:40
ns3::TcpOptionSack::operator<<
friend std::ostream & operator<<(std::ostream &os, const TcpOptionSack &sackOption)
Output operator.
Definition
tcp-option-sack.cc:149
ns3::TcpOptionSack::ClearSackList
void ClearSackList()
Clear the SACK list.
Definition
tcp-option-sack.cc:136
ns3::TcpOptionSack::SackList
std::list< SackBlock > SackList
SACK list definition.
Definition
tcp-option-sack.h:50
ns3::TcpOptionSack::GetNumSackBlocks
uint32_t GetNumSackBlocks() const
Count the total number of SACK blocks.
Definition
tcp-option-sack.cc:128
ns3::TcpOptionSack::GetKind
uint8_t GetKind() const override
Get the ‘kind’ (as in RFC 793 ) of this option.
Definition
tcp-option-sack.cc:115
ns3::TcpOptionSack::Print
void Print(std::ostream &os) const override
Print the Option contents.
Definition
tcp-option-sack.cc:51
ns3::TcpOptionSack::TcpOptionSack
TcpOptionSack()
Definition
tcp-option-sack.cc:25
ns3::TcpOptionSack::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the Option to a buffer iterator.
Definition
tcp-option-sack.cc:69
ns3::TcpOptionSack::SackBlock
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Definition
tcp-option-sack.h:49
ns3::TcpOptionSack::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
tcp-option-sack.cc:45
ns3::TcpOptionSack::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
tcp-option-sack.cc:35
ns3::TcpOptionSack::AddSackBlock
void AddSackBlock(SackBlock s)
Add a SACK block.
Definition
tcp-option-sack.cc:121
ns3::TcpOptionSack::~TcpOptionSack
~TcpOptionSack() override
Definition
tcp-option-sack.cc:30
ns3::TcpOptionSack::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the Option from a buffer iterator.
Definition
tcp-option-sack.cc:87
ns3::TcpOptionSack::GetSerializedSize
uint32_t GetSerializedSize() const override
Returns number of bytes required for Option serialization.
Definition
tcp-option-sack.cc:61
ns3::TcpOptionSack::m_sackList
SackList m_sackList
the list of SACK blocks
Definition
tcp-option-sack.h:88
ns3::TcpOptionSack::GetSackList
SackList GetSackList() const
Get the SACK list.
Definition
tcp-option-sack.cc:142
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
tcp-option.h
src
internet
model
tcp-option-sack.h
Generated on Wed Dec 11 2024 09:20:49 for ns-3 by
1.11.0