A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
tcp-tx-item.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
*/
18
#include "
tcp-tx-item.h
"
19
20
namespace
ns3
21
{
22
23
void
24
TcpTxItem::Print
(std::ostream& os,
Time::Unit
unit
/* = Time::S */
)
const
25
{
26
bool
comma =
false
;
27
os <<
"["
<<
m_startSeq
<<
";"
<<
m_startSeq
+
GetSeqSize
() <<
"|"
<<
GetSeqSize
() <<
"]"
;
28
29
if
(
m_lost
)
30
{
31
os <<
"[lost]"
;
32
comma =
true
;
33
}
34
if
(
m_retrans
)
35
{
36
if
(comma)
37
{
38
os <<
","
;
39
}
40
41
os <<
"[retrans]"
;
42
comma =
true
;
43
}
44
if
(
m_sacked
)
45
{
46
if
(comma)
47
{
48
os <<
","
;
49
}
50
os <<
"[sacked]"
;
51
comma =
true
;
52
}
53
if
(comma)
54
{
55
os <<
","
;
56
}
57
os <<
"["
<<
m_lastSent
.
As
(unit) <<
"]"
;
58
}
59
60
uint32_t
61
TcpTxItem::GetSeqSize
()
const
62
{
63
return
m_packet
&&
m_packet
->
GetSize
() > 0 ?
m_packet
->
GetSize
() : 1;
64
}
65
66
bool
67
TcpTxItem::IsSacked
()
const
68
{
69
return
m_sacked
;
70
}
71
72
bool
73
TcpTxItem::IsRetrans
()
const
74
{
75
return
m_retrans
;
76
}
77
78
Ptr<Packet>
79
TcpTxItem::GetPacketCopy
()
const
80
{
81
return
m_packet
->
Copy
();
82
}
83
84
Ptr<const Packet>
85
TcpTxItem::GetPacket
()
const
86
{
87
return
m_packet
;
88
}
89
90
const
Time
&
91
TcpTxItem::GetLastSent
()
const
92
{
93
return
m_lastSent
;
94
}
95
96
TcpTxItem::RateInformation
&
97
TcpTxItem::GetRateInformation
()
98
{
99
return
m_rateInfo
;
100
}
101
102
}
// namespace ns3
ns3::Packet::GetSize
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition:
packet.h:861
ns3::Packet::Copy
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Definition:
packet.cc:131
ns3::Ptr< Packet >
ns3::TcpTxItem::m_sacked
bool m_sacked
Indicates if the segment has been SACKed.
Definition:
tcp-tx-item.h:116
ns3::TcpTxItem::m_retrans
bool m_retrans
Indicates if the segment is retransmitted.
Definition:
tcp-tx-item.h:104
ns3::TcpTxItem::m_startSeq
SequenceNumber32 m_startSeq
Sequence number of the item (if transmitted)
Definition:
tcp-tx-item.h:111
ns3::TcpTxItem::IsSacked
bool IsSacked() const
Is the item sacked?
Definition:
tcp-tx-item.cc:67
ns3::TcpTxItem::m_lastSent
Time m_lastSent
Timestamp of the time at which the segment has been sent last time.
Definition:
tcp-tx-item.h:114
ns3::TcpTxItem::m_rateInfo
RateInformation m_rateInfo
Rate information of the item.
Definition:
tcp-tx-item.h:118
ns3::TcpTxItem::GetPacket
Ptr< const Packet > GetPacket() const
Get the Packet underlying this item.
Definition:
tcp-tx-item.cc:85
ns3::TcpTxItem::GetSeqSize
uint32_t GetSeqSize() const
Get the size in the sequence number space.
Definition:
tcp-tx-item.cc:61
ns3::TcpTxItem::GetPacketCopy
Ptr< Packet > GetPacketCopy() const
Get a copy of the Packet underlying this item.
Definition:
tcp-tx-item.cc:79
ns3::TcpTxItem::GetLastSent
const Time & GetLastSent() const
Get a reference to the time the packet was sent for the last time.
Definition:
tcp-tx-item.cc:91
ns3::TcpTxItem::GetRateInformation
RateInformation & GetRateInformation()
Get (to modify) the Rate Information of this item.
Definition:
tcp-tx-item.cc:97
ns3::TcpTxItem::m_lost
bool m_lost
Indicates if the segment has been lost (RTO)
Definition:
tcp-tx-item.h:113
ns3::TcpTxItem::m_packet
Ptr< Packet > m_packet
Application packet (can be null)
Definition:
tcp-tx-item.h:112
ns3::TcpTxItem::IsRetrans
bool IsRetrans() const
Is the item retransmitted?
Definition:
tcp-tx-item.cc:73
ns3::TcpTxItem::Print
void Print(std::ostream &os, Time::Unit unit=Time::S) const
Print the time.
Definition:
tcp-tx-item.cc:24
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::Time::As
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition:
time.cc:415
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition:
nstime.h:111
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpTxItem::RateInformation
Various rate-related information, can be accessed by TcpRateOps.
Definition:
tcp-tx-item.h:88
tcp-tx-item.h
src
internet
model
tcp-tx-item.cc
Generated on Sun Mar 3 2024 17:10:59 for ns-3 by
1.9.1