A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-tx-item.h
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#ifndef TCP_TX_ITEM_H
19#define TCP_TX_ITEM_H
20
21#include "ns3/nstime.h"
22#include "ns3/packet.h"
23#include "ns3/sequence-number.h"
24
25namespace ns3
26{
27/**
28 * \ingroup tcp
29 *
30 * \brief Item that encloses the application packet and some flags for it
31 */
33{
34 public:
35 // Default constructor, copy-constructor, destructor
36
37 /**
38 * \brief Print the time
39 * \param os ostream
40 * \param unit Time::Unit
41 */
42 void Print(std::ostream& os, Time::Unit unit = Time::S) const;
43
44 /**
45 * \brief Get the size in the sequence number space
46 *
47 * \return 1 if the packet size is 0 or there's no packet, otherwise the size of the packet
48 */
49 uint32_t GetSeqSize() const;
50
51 /**
52 * \brief Is the item sacked?
53 * \return true if the item is sacked, false otherwise
54 */
55 bool IsSacked() const;
56
57 /**
58 * \brief Is the item retransmitted?
59 * \return true if the item have been retransmitted
60 */
61 bool IsRetrans() const;
62
63 /**
64 * \brief Get a copy of the Packet underlying this item
65 * \return a copy of the Packet
66 */
68
69 /**
70 * \brief Get the Packet underlying this item
71 * \return a pointer to a const Packet
72 */
74
75 /**
76 * \brief Get a reference to the time the packet was sent for the last time
77 * \return a reference to the last sent time
78 */
79 const Time& GetLastSent() const;
80
81 /**
82 * \brief Various rate-related information, can be accessed by TcpRateOps.
83 *
84 * Note: This is not enforced through C++, but you developer must honour
85 * this description.
86 */
88 {
89 uint64_t m_delivered{0}; //!< Connection's delivered data at the time the packet was sent
91 Time::Max()}; //!< Connection's delivered time at the time the packet was sent
93 Time::Max()}; //!< Connection's first sent time at the time the packet was sent
94 bool m_isAppLimited{false}; //!< Connection's app limited at the time the packet was sent
95 };
96
97 /**
98 * \brief Get (to modify) the Rate Information of this item
99 *
100 * \return A reference to the rate information.
101 */
102 RateInformation& GetRateInformation();
103
104 bool m_retrans{false}; //!< Indicates if the segment is retransmitted
105
106 private:
107 // Only TcpTxBuffer is allowed to touch this part of the TcpTxItem, to manage
108 // its internal lists and counters
109 friend class TcpTxBuffer;
110
111 SequenceNumber32 m_startSeq{0}; //!< Sequence number of the item (if transmitted)
112 Ptr<Packet> m_packet{nullptr}; //!< Application packet (can be null)
113 bool m_lost{false}; //!< Indicates if the segment has been lost (RTO)
115 Time::Max()}; //!< Timestamp of the time at which the segment has been sent last time
116 bool m_sacked{false}; //!< Indicates if the segment has been SACKed
117
118 RateInformation m_rateInfo; //!< Rate information of the item
119};
120
121} // namespace ns3
122
123#endif /* TCP_TX_ITEM_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Tcp sender buffer.
Item that encloses the application packet and some flags for it.
Definition: tcp-tx-item.h:33
bool m_sacked
Indicates if the segment has been SACKed.
Definition: tcp-tx-item.h:116
bool m_retrans
Indicates if the segment is retransmitted.
Definition: tcp-tx-item.h:104
SequenceNumber32 m_startSeq
Sequence number of the item (if transmitted)
Definition: tcp-tx-item.h:111
bool IsSacked() const
Is the item sacked?
Definition: tcp-tx-item.cc:67
Time m_lastSent
Timestamp of the time at which the segment has been sent last time.
Definition: tcp-tx-item.h:114
RateInformation m_rateInfo
Rate information of the item.
Definition: tcp-tx-item.h:118
Ptr< const Packet > GetPacket() const
Get the Packet underlying this item.
Definition: tcp-tx-item.cc:85
uint32_t GetSeqSize() const
Get the size in the sequence number space.
Definition: tcp-tx-item.cc:61
Ptr< Packet > GetPacketCopy() const
Get a copy of the Packet underlying this item.
Definition: tcp-tx-item.cc:79
const Time & GetLastSent() const
Get a reference to the time the packet was sent for the last time.
Definition: tcp-tx-item.cc:91
RateInformation & GetRateInformation()
Get (to modify) the Rate Information of this item.
Definition: tcp-tx-item.cc:97
bool m_lost
Indicates if the segment has been lost (RTO)
Definition: tcp-tx-item.h:113
Ptr< Packet > m_packet
Application packet (can be null)
Definition: tcp-tx-item.h:112
bool IsRetrans() const
Is the item retransmitted?
Definition: tcp-tx-item.cc:73
void Print(std::ostream &os, Time::Unit unit=Time::S) const
Print the time.
Definition: tcp-tx-item.cc:24
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:111
@ S
second
Definition: nstime.h:116
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
Definition: nstime.h:297
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:88
bool m_isAppLimited
Connection's app limited at the time the packet was sent.
Definition: tcp-tx-item.h:94
uint64_t m_delivered
Connection's delivered data at the time the packet was sent.
Definition: tcp-tx-item.h:89
Time m_deliveredTime
Connection's delivered time at the time the packet was sent.
Definition: tcp-tx-item.h:90
Time m_firstSent
Connection's first sent time at the time the packet was sent.
Definition: tcp-tx-item.h:92