A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
tcp-tx-item.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
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
*/
19
#include "
tcp-tx-item.h
"
20
21
namespace
ns3
{
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
() <<
"|"
28
<<
GetSeqSize
() <<
"]"
;
29
30
if
(
m_lost
)
31
{
32
os <<
"[lost]"
;
33
comma =
true
;
34
}
35
if
(
m_retrans
)
36
{
37
if
(comma)
38
{
39
os <<
","
;
40
}
41
42
os <<
"[retrans]"
;
43
comma =
true
;
44
}
45
if
(
m_sacked
)
46
{
47
if
(comma)
48
{
49
os <<
","
;
50
}
51
os <<
"[sacked]"
;
52
comma =
true
;
53
}
54
if
(comma)
55
{
56
os <<
","
;
57
}
58
os <<
"["
<<
m_lastSent
.
As
(unit) <<
"]"
;
59
}
60
61
uint32_t
62
TcpTxItem::GetSeqSize
(
void
)
const
63
{
64
return
m_packet
&&
m_packet
->
GetSize
() > 0 ?
m_packet
->
GetSize
() : 1;
65
}
66
67
bool
68
TcpTxItem::IsSacked
(
void
)
const
69
{
70
return
m_sacked
;
71
}
72
73
bool
74
TcpTxItem::IsRetrans
(
void
)
const
75
{
76
return
m_retrans
;
77
}
78
79
Ptr<Packet>
80
TcpTxItem::GetPacketCopy
(
void
)
const
81
{
82
return
m_packet
->
Copy
();
83
}
84
85
Ptr<const Packet>
86
TcpTxItem::GetPacket
(
void
)
const
87
{
88
return
m_packet
;
89
}
90
91
const
Time
&
92
TcpTxItem::GetLastSent
(
void
)
const
93
{
94
return
m_lastSent
;
95
}
96
97
TcpTxItem::RateInformation
&
98
TcpTxItem::GetRateInformation
(
void
)
99
{
100
return
m_rateInfo
;
101
}
102
103
104
}
// namespace ns3
ns3::TcpTxItem::m_rateInfo
RateInformation m_rateInfo
Rate information of the item.
Definition:
tcp-tx-item.h:115
ns3::TcpTxItem::GetSeqSize
uint32_t GetSeqSize(void) const
Get the size in the sequence number space.
Definition:
tcp-tx-item.cc:62
ns3::TcpTxItem::Print
void Print(std::ostream &os, Time::Unit unit=Time::S) const
Print the time.
Definition:
tcp-tx-item.cc:24
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition:
packet.h:852
ns3::TcpTxItem::GetRateInformation
RateInformation & GetRateInformation(void)
Get (to modify) the Rate Information of this item.
Definition:
tcp-tx-item.cc:98
ns3::TcpTxItem::GetLastSent
const Time & GetLastSent(void) const
Get a reference to the time the packet was sent for the last time.
Definition:
tcp-tx-item.cc:92
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpTxItem::IsRetrans
bool IsRetrans(void) const
Is the item retransmitted?
Definition:
tcp-tx-item.cc:74
ns3::TcpTxItem::m_retrans
bool m_retrans
Indicates if the segment is retransmitted.
Definition:
tcp-tx-item.h:102
ns3::TcpTxItem::m_startSeq
SequenceNumber32 m_startSeq
Sequence number of the item (if transmitted)
Definition:
tcp-tx-item.h:109
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition:
time.cc:429
ns3::TcpTxItem::IsSacked
bool IsSacked(void) const
Is the item sacked?
Definition:
tcp-tx-item.cc:68
ns3::Ptr< Packet >
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:112
ns3::TcpTxItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the Packet underlying this item.
Definition:
tcp-tx-item.cc:86
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:104
ns3::TcpTxItem::m_packet
Ptr< Packet > m_packet
Application packet (can be null)
Definition:
tcp-tx-item.h:110
tcp-tx-item.h
ns3::Packet::Copy
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition:
packet.cc:121
ns3::TcpTxItem::m_sacked
bool m_sacked
Indicates if the segment has been SACKed.
Definition:
tcp-tx-item.h:113
ns3::TcpTxItem::GetPacketCopy
Ptr< Packet > GetPacketCopy(void) const
Get a copy of the Packet underlying this item.
Definition:
tcp-tx-item.cc:80
ns3::TcpTxItem::RateInformation
Various rate-related information, can be accessed by TcpRateOps.
Definition:
tcp-tx-item.h:88
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition:
nstime.h:110
ns3::TcpTxItem::m_lost
bool m_lost
Indicates if the segment has been lost (RTO)
Definition:
tcp-tx-item.h:111
src
internet
model
tcp-tx-item.cc
Generated on Fri Oct 1 2021 17:03:10 for ns-3 by
1.8.20