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