OLD | NEW |
(Empty) | |
| 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 #pragma once |
| 20 |
| 21 #include "ns3/packet.h" |
| 22 #include "ns3/nstime.h" |
| 23 #include "ns3/sequence-number.h" |
| 24 |
| 25 namespace ns3 { |
| 26 /** |
| 27 * \ingroup tcp |
| 28 * |
| 29 * \brief Item that encloses the application packet and some flags for it |
| 30 */ |
| 31 class TcpTxItem |
| 32 { |
| 33 public: |
| 34 // Default constructor, copy-constructor, destructor |
| 35 |
| 36 /** |
| 37 * \brief Print the time |
| 38 * \param os ostream |
| 39 */ |
| 40 void Print (std::ostream &os) const; |
| 41 |
| 42 /** |
| 43 * \brief Get the size in the sequence number space |
| 44 * |
| 45 * \return 1 if the packet size is 0 or there's no packet, otherwise the size
of the packet |
| 46 */ |
| 47 uint32_t GetSeqSize (void) const { return m_packet && m_packet->GetSize () > 0
? m_packet->GetSize () : 1; } |
| 48 |
| 49 /** |
| 50 * \brief Is the item sacked? |
| 51 * \return true if the item is sacked, false otherwise |
| 52 */ |
| 53 bool IsSacked (void) const { return m_sacked; } |
| 54 |
| 55 /** |
| 56 * \brief Is the item retransmitted? |
| 57 * \return true if the item have been retransmitted |
| 58 */ |
| 59 bool IsRetrans (void) const { return m_retrans; } |
| 60 |
| 61 /** |
| 62 * \brief Get a copy of the Packet underlying this item |
| 63 * \return a copy of the Packet |
| 64 */ |
| 65 Ptr<Packet> GetPacketCopy (void) const { return m_packet->Copy (); } |
| 66 |
| 67 /** |
| 68 * \brief Get the Packet underlying this item |
| 69 * \return a pointer to a const Packet |
| 70 */ |
| 71 Ptr<const Packet> GetPacket (void) const { return m_packet; } |
| 72 |
| 73 /** |
| 74 * \brief Get a reference to the time the packet was sent for the last time |
| 75 * \return a reference to the last sent time |
| 76 */ |
| 77 const Time & GetLastSent (void) const { return m_lastSent; } |
| 78 |
| 79 /** |
| 80 * \brief Various rate-related information, can be accessed by TcpRateOps. |
| 81 * |
| 82 * Note: This is not enforced through C++, but you developer must honour |
| 83 * this description. |
| 84 */ |
| 85 struct RateInformation |
| 86 { |
| 87 uint64_t m_delivered {0}; //!< Connection's delivered data at the t
ime the packet was sent |
| 88 Time m_deliveredTime {Time::Max ()};//!< Connection's delivered time at the
time the packet was sent |
| 89 Time m_firstSent {Time::Max ()};//!< Connection's first sent time at the
time the packet was sent |
| 90 bool m_isAppLimited {false}; //!< Connection's app limited at the time
the packet was sent |
| 91 }; |
| 92 |
| 93 /** |
| 94 * \brief Get (to modify) the Rate Information of this item |
| 95 * |
| 96 * \return A reference to the rate information. |
| 97 */ |
| 98 RateInformation & GetRateInformation (void) { return m_rateInfo; } |
| 99 |
| 100 private: |
| 101 // Only TcpTxBuffer is allower to touch this part of the TcpTxItem, to manage |
| 102 // its internal lists and counters |
| 103 friend class TcpTxBuffer; |
| 104 |
| 105 SequenceNumber32 m_startSeq {0}; //!< Sequence number of the item (if transm
itted) |
| 106 Ptr<Packet> m_packet {nullptr}; //!< Application packet (can be null) |
| 107 bool m_lost {false}; //!< Indicates if the segment has been lost
(RTO) |
| 108 bool m_retrans {false}; //!< Indicates if the segment is retransmit
ted |
| 109 Time m_lastSent {Time::Max ()};//!< Timestamp of the time at which the se
gment has been sent last time |
| 110 bool m_sacked {false}; //!< Indicates if the segment has been SACK
ed |
| 111 |
| 112 RateInformation m_rateInfo; //!< Rate information of the item |
| 113 }; |
| 114 |
| 115 } //namespace ns3 |
OLD | NEW |