A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-tx-item.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7#include "tcp-tx-item.h"
8
9namespace ns3
10{
11
12void
13TcpTxItem::Print(std::ostream& os, Time::Unit unit /* = Time::S */) const
14{
15 bool comma = false;
16 os << "[" << m_startSeq << ";" << m_startSeq + GetSeqSize() << "|" << GetSeqSize() << "]";
17
18 if (m_lost)
19 {
20 os << "[lost]";
21 comma = true;
22 }
23 if (m_retrans)
24 {
25 if (comma)
26 {
27 os << ",";
28 }
29
30 os << "[retrans]";
31 comma = true;
32 }
33 if (m_sacked)
34 {
35 if (comma)
36 {
37 os << ",";
38 }
39 os << "[sacked]";
40 comma = true;
41 }
42 if (comma)
43 {
44 os << ",";
45 }
46 os << "[" << m_lastSent.As(unit) << "]";
47}
48
51{
52 return m_packet && m_packet->GetSize() > 0 ? m_packet->GetSize() : 1;
53}
54
55bool
57{
58 return m_sacked;
59}
60
61bool
63{
64 return m_retrans;
65}
66
69{
70 return m_packet->Copy();
71}
72
75{
76 return m_packet;
77}
78
79const Time&
81{
82 return m_lastSent;
83}
84
90
91} // namespace ns3
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition packet.h:850
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Definition packet.cc:120
Smart pointer class similar to boost::intrusive_ptr.
bool m_sacked
Indicates if the segment has been SACKed.
bool m_retrans
Indicates if the segment is retransmitted.
Definition tcp-tx-item.h:93
SequenceNumber32 m_startSeq
Sequence number of the item (if transmitted)
bool IsSacked() const
Is the item sacked?
Time m_lastSent
Timestamp of the time at which the segment has been sent last time.
RateInformation m_rateInfo
Rate information of the item.
Ptr< const Packet > GetPacket() const
Get the Packet underlying this item.
uint32_t GetSeqSize() const
Get the size in the sequence number space.
Ptr< Packet > GetPacketCopy() const
Get a copy of the Packet underlying this item.
const Time & GetLastSent() const
Get a reference to the time the packet was sent for the last time.
RateInformation & GetRateInformation()
Get (to modify) the Rate Information of this item.
bool m_lost
Indicates if the segment has been lost (RTO)
Ptr< Packet > m_packet
Application packet (can be null)
bool IsRetrans() const
Is the item retransmitted?
void Print(std::ostream &os, Time::Unit unit=Time::S) const
Print the time.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
Unit
The unit to use to interpret a number representing time.
Definition nstime.h:100
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Various rate-related information, can be accessed by TcpRateOps.
Definition tcp-tx-item.h:77