OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2017 NITK Surathkal |
| 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 * Author: Shravya K.S. <shravya.ks0@gmail.com> |
| 19 * |
| 20 */ |
| 21 |
| 22 #ifndef TCP_DCTCP_H |
| 23 #define TCP_DCTCP_H |
| 24 |
| 25 #include "ns3/tcp-congestion-ops.h" |
| 26 |
| 27 namespace ns3 { |
| 28 |
| 29 /** |
| 30 * \ingroup congestionOps |
| 31 * |
| 32 * \brief An implementation of DCTCP. This model implements all the functionalit
ies mentioned |
| 33 * in the DCTCP SIGCOMM paper except dynamic buffer allocation in switches |
| 34 */ |
| 35 |
| 36 class TcpDctcp : public TcpNewReno |
| 37 { |
| 38 public: |
| 39 /** |
| 40 * \brief Get the type ID. |
| 41 * \return the object TypeId |
| 42 */ |
| 43 static TypeId GetTypeId (void); |
| 44 |
| 45 /** |
| 46 * Create an unbound tcp socket. |
| 47 */ |
| 48 TcpDctcp (); |
| 49 |
| 50 /** |
| 51 * \brief Copy constructor |
| 52 * \param sock the object to copy |
| 53 */ |
| 54 TcpDctcp (const TcpDctcp& sock); |
| 55 |
| 56 /** |
| 57 * \brief Destructor |
| 58 */ |
| 59 virtual ~TcpDctcp (void); |
| 60 |
| 61 /** |
| 62 * \brief Get the name of the TCP flavour |
| 63 * |
| 64 * \return The name of the TCP |
| 65 */ |
| 66 virtual std::string GetName () const; |
| 67 |
| 68 /** |
| 69 * \brief Set the associated TCP Socket Base |
| 70 * |
| 71 * \param tsb the TCP Socket Base |
| 72 */ |
| 73 virtual void SetSocketBase (Ptr<TcpSocketBase> tsb); |
| 74 virtual Ptr<TcpCongestionOps> Fork (); |
| 75 |
| 76 /** |
| 77 * \brief Reduce congestion window based on DCTCP algorithm |
| 78 * |
| 79 * \param tcb internal congestion state |
| 80 */ |
| 81 virtual void ReduceCwnd (Ptr<TcpSocketState> tcb); |
| 82 |
| 83 /** |
| 84 * \brief Get information from the acked packet |
| 85 * |
| 86 * \param tcb internal congestion state |
| 87 * \param segmentsAcked count of segments ACKed |
| 88 * \param rtt The estimated rtt |
| 89 */ |
| 90 virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, |
| 91 const Time &rtt); |
| 92 /** |
| 93 * \brief Trigger events/calculations on occurrence of congestion window event |
| 94 * |
| 95 * \param tcb internal state |
| 96 * \param event congestion window event which triggered this function |
| 97 */ |
| 98 virtual void CwndEvent (Ptr<TcpSocketState> tcb, |
| 99 const TcpSocketState::TcpCaEvent_t event); |
| 100 |
| 101 private: |
| 102 /** |
| 103 * \brief Changes state of m_ceState to true |
| 104 * |
| 105 * \param tcb internal congestion state |
| 106 */ |
| 107 void CeState0to1 (Ptr<TcpSocketState> tcb); |
| 108 |
| 109 /** |
| 110 * \brief Changes state of m_ceState to false |
| 111 * |
| 112 * \param tcb internal congestion state |
| 113 */ |
| 114 void CeState1to0 (Ptr<TcpSocketState> tcb); |
| 115 |
| 116 /** |
| 117 * \brief Updates the value of m_delayedAckReserved |
| 118 * |
| 119 * \param tcb internal congestion state |
| 120 * \param event the congestion window event |
| 121 */ |
| 122 void UpdateAckReserved (Ptr<TcpSocketState> tcb, |
| 123 const TcpSocketState::TcpCaEvent_t event); |
| 124 |
| 125 /** |
| 126 * \brief Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq |
| 127 * |
| 128 * \param tcb internal congestion state |
| 129 */ |
| 130 void Reset (Ptr<TcpSocketState> tcb); |
| 131 |
| 132 /** |
| 133 * \brief Sets the value of m_alpha |
| 134 * |
| 135 * \param alpha DCTCP alpha parameter |
| 136 */ |
| 137 void SetDctcpAlpha (double alpha); |
| 138 |
| 139 Ptr<TcpSocketBase> m_tsb; //!< TCP Socket Base state |
| 140 uint32_t m_ackedBytesEcn; //!< Number of acked bytes which are mar
ked |
| 141 uint32_t m_ackedBytesTotal; //!< Total number of acked bytes |
| 142 SequenceNumber32 m_priorRcvNxt; //!< Sequence number of the first missin
g byte in data |
| 143 bool m_priorRcvNxtFlag; //!< Variable used in setting the value
of m_priorRcvNxt for first time |
| 144 double m_alpha; //!< Parameter used to estimate fraction
of sent bytes that encountered congestion |
| 145 SequenceNumber32 m_nextSeq; //!< TCP sequence number threshold for b
eginning a new observation window |
| 146 bool m_nextSeqFlag; //!< Variable used in setting the value
of m_nextSeq for first time |
| 147 bool m_ceState; //!< DCTCP Congestion Experienced state |
| 148 bool m_delayedAckReserved; //!< Delayed Ack state |
| 149 double m_g; //!< Estimation gain |
| 150 }; |
| 151 |
| 152 } // namespace ns3 |
| 153 |
| 154 #endif /* TCP_DCTCP_H */ |
| 155 |
OLD | NEW |