79 |
79 |
80 TcpNewReno::~TcpNewReno (void) |
80 TcpNewReno::~TcpNewReno (void) |
81 { |
81 { |
82 } |
82 } |
83 |
83 |
84 /** We initialize m_cWnd from this function, after attributes initialized */ |
84 /* We initialize m_cWnd from this function, after attributes initialized */ |
85 int |
85 int |
86 TcpNewReno::Listen (void) |
86 TcpNewReno::Listen (void) |
87 { |
87 { |
88 NS_LOG_FUNCTION (this); |
88 NS_LOG_FUNCTION (this); |
89 InitializeCwnd (); |
89 InitializeCwnd (); |
90 return TcpSocketBase::Listen (); |
90 return TcpSocketBase::Listen (); |
91 } |
91 } |
92 |
92 |
93 /** We initialize m_cWnd from this function, after attributes initialized */ |
93 /* We initialize m_cWnd from this function, after attributes initialized */ |
94 int |
94 int |
95 TcpNewReno::Connect (const Address & address) |
95 TcpNewReno::Connect (const Address & address) |
96 { |
96 { |
97 NS_LOG_FUNCTION (this << address); |
97 NS_LOG_FUNCTION (this << address); |
98 InitializeCwnd (); |
98 InitializeCwnd (); |
99 return TcpSocketBase::Connect (address); |
99 return TcpSocketBase::Connect (address); |
100 } |
100 } |
101 |
101 |
102 /** Limit the size of in-flight data by cwnd and receiver's rxwin */ |
102 /* Limit the size of in-flight data by cwnd and receiver's rxwin */ |
103 uint32_t |
103 uint32_t |
104 TcpNewReno::Window (void) |
104 TcpNewReno::Window (void) |
105 { |
105 { |
106 NS_LOG_FUNCTION (this); |
106 NS_LOG_FUNCTION (this); |
107 return std::min (m_rWnd.Get (), m_cWnd.Get ()); |
107 return std::min (m_rWnd.Get (), m_cWnd.Get ()); |
111 TcpNewReno::Fork (void) |
111 TcpNewReno::Fork (void) |
112 { |
112 { |
113 return CopyObject<TcpNewReno> (this); |
113 return CopyObject<TcpNewReno> (this); |
114 } |
114 } |
115 |
115 |
116 /** New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */ |
116 /* New ACK (up to seqnum seq) received. Increase cwnd and call TcpSocketBase::NewAck() */ |
117 void |
117 void |
118 TcpNewReno::NewAck (const SequenceNumber32& seq) |
118 TcpNewReno::NewAck (const SequenceNumber32& seq) |
119 { |
119 { |
120 NS_LOG_FUNCTION (this << seq); |
120 NS_LOG_FUNCTION (this << seq); |
121 NS_LOG_LOGIC ("TcpNewReno receieved ACK for seq " << seq << |
121 NS_LOG_LOGIC ("TcpNewReno receieved ACK for seq " << seq << |
156 |
156 |
157 // Complete newAck processing |
157 // Complete newAck processing |
158 TcpSocketBase::NewAck (seq); |
158 TcpSocketBase::NewAck (seq); |
159 } |
159 } |
160 |
160 |
161 /** Cut cwnd and enter fast recovery mode upon triple dupack */ |
161 /* Cut cwnd and enter fast recovery mode upon triple dupack */ |
162 void |
162 void |
163 TcpNewReno::DupAck (const TcpHeader& t, uint32_t count) |
163 TcpNewReno::DupAck (const TcpHeader& t, uint32_t count) |
164 { |
164 { |
165 NS_LOG_FUNCTION (this << count); |
165 NS_LOG_FUNCTION (this << count); |
166 if (count == m_retxThresh && !m_inFastRec) |
166 if (count == m_retxThresh && !m_inFastRec) |
185 uint32_t sz = SendDataPacket (m_nextTxSequence, m_segmentSize, true); |
185 uint32_t sz = SendDataPacket (m_nextTxSequence, m_segmentSize, true); |
186 m_nextTxSequence += sz; // Advance next tx sequence |
186 m_nextTxSequence += sz; // Advance next tx sequence |
187 }; |
187 }; |
188 } |
188 } |
189 |
189 |
190 /** Retransmit timeout */ |
190 /* Retransmit timeout */ |
191 void |
191 void |
192 TcpNewReno::Retransmit (void) |
192 TcpNewReno::Retransmit (void) |
193 { |
193 { |
194 NS_LOG_FUNCTION (this); |
194 NS_LOG_FUNCTION (this); |
195 NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ()); |
195 NS_LOG_LOGIC (this << " ReTxTimeout Expired at time " << Simulator::Now ().GetSeconds ()); |