INET Framework for OMNeT++/OMNEST
inet::tcp::TCPSACKRexmitQueue Class Reference

Retransmission data for SACK. More...

#include <TCPSACKRexmitQueue.h>

Classes

struct  Region
 

Public Types

typedef std::list< RegionRexmitQueue
 

Public Member Functions

 TCPSACKRexmitQueue ()
 Ctor. More...
 
virtual ~TCPSACKRexmitQueue ()
 Virtual dtor. More...
 
virtual void setConnection (TCPConnection *_conn)
 Set the connection that owns this queue. More...
 
virtual void init (uint32 seqNum)
 Initialize the object. More...
 
virtual std::string str () const
 Returns a string for debug purposes. More...
 
virtual void info () const
 Prints the current rexmitQueue status for debug purposes. More...
 
virtual uint32 getBufferStartSeq () const
 Returns the sequence number of the first byte stored in the buffer. More...
 
virtual uint32 getBufferEndSeq () const
 Returns the sequence number of the last byte stored in the buffer plus one. More...
 
virtual void discardUpTo (uint32 seqNum)
 Tells the queue that bytes up to (but NOT including) seqNum have been transmitted and ACKed, so they can be removed from the queue. More...
 
virtual void enqueueSentData (uint32 fromSeqNum, uint32 toSeqNum)
 Inserts sent data to the rexmit queue. More...
 
virtual void setSackedBit (uint32 fromSeqNum, uint32 toSeqNum)
 Called when data sender received selective acknowledgments. More...
 
virtual bool getSackedBit (uint32 seqNum) const
 Returns SackedBit value of seqNum. More...
 
virtual uint32 getQueueLength () const
 Returns the number of blocks currently buffered in queue. More...
 
virtual uint32 getHighestSackedSeqNum () const
 Returns the highest sequence number sacked by data receiver. More...
 
virtual uint32 getHighestRexmittedSeqNum () const
 Returns the highest sequence number rexmitted by data sender. More...
 
virtual uint32 checkRexmitQueueForSackedOrRexmittedSegments (uint32 fromSeq) const
 Checks rexmit queue for sacked of rexmitted segments and returns a certain offset (contiguous sacked or rexmitted region) to forward snd->nxt. More...
 
virtual void resetSackedBit ()
 Called when REXMIT timer expired. More...
 
virtual void resetRexmittedBit ()
 Called when REXMIT timer expired. More...
 
virtual uint32 getTotalAmountOfSackedBytes () const
 Returns total amount of sacked bytes. More...
 
virtual uint32 getAmountOfSackedBytes (uint32 seqNum) const
 Returns amount of sacked bytes above seqNum. More...
 
virtual uint32 getNumOfDiscontiguousSacks (uint32 seqNum) const
 Returns the number of discontiguous sacked regions (SACKed sequences) above seqNum. More...
 
virtual void checkSackBlock (uint32 seqNum, uint32 &length, bool &sacked, bool &rexmitted) const
 

Public Attributes

TCPConnectionconn
 
RexmitQueue rexmitQueue
 
uint32 begin
 
uint32 end
 

Protected Member Functions

bool checkQueue () const
 

Detailed Description

Retransmission data for SACK.

Member Typedef Documentation

Constructor & Destructor Documentation

inet::tcp::TCPSACKRexmitQueue::TCPSACKRexmitQueue ( )

Ctor.

26 {
27  conn = nullptr;
28  begin = end = 0;
29 }
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
TCPConnection * conn
Definition: TCPSACKRexmitQueue.h:36
inet::tcp::TCPSACKRexmitQueue::~TCPSACKRexmitQueue ( )
virtual

Virtual dtor.

32 {
33  while (!rexmitQueue.empty())
34  rexmitQueue.pop_front();
35 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47

Member Function Documentation

bool inet::tcp::TCPSACKRexmitQueue::checkQueue ( ) const
protected

Referenced by discardUpTo(), enqueueSentData(), and setSackedBit().

168 {
169  uint32 b = begin;
170  bool f = true;
171 
172  for (const auto & elem : rexmitQueue) {
173  f = f && (b == elem.beginSeqNum);
174  f = f && seqLess(elem.beginSeqNum, elem.endSeqNum);
175  b = elem.endSeqNum;
176  }
177 
178  f = f && (b == end);
179 
180  if (!f) {
181  EV_DEBUG << "Invalid Queue\nThe Queue is:\n";
182  info();
183  }
184 
185  return f;
186 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
uint32_t uint32
Definition: Compat.h:30
value< double, units::m > b
Definition: Units.h:1054
virtual void info() const
Prints the current rexmitQueue status for debug purposes.
Definition: TCPSACKRexmitQueue.cc:51
uint32 inet::tcp::TCPSACKRexmitQueue::checkRexmitQueueForSackedOrRexmittedSegments ( uint32  fromSeq) const
virtual

Checks rexmit queue for sacked of rexmitted segments and returns a certain offset (contiguous sacked or rexmitted region) to forward snd->nxt.

It is called before retransmitting data.

Referenced by inet::tcp::TCPConnection::sendSegment().

278 {
279  ASSERT(seqLE(begin, fromSeqNum) && seqLE(fromSeqNum, end));
280 
281  if (rexmitQueue.empty() || (end == fromSeqNum))
282  return 0;
283 
284  RexmitQueue::const_iterator i = rexmitQueue.begin();
285  uint32 bytes = 0;
286 
287  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, fromSeqNum))
288  i++;
289 
290  while (i != rexmitQueue.end() && ((i->sacked || i->rexmitted))) {
291  ASSERT(seqLE(i->beginSeqNum, fromSeqNum) && seqLess(fromSeqNum, i->endSeqNum));
292 
293  bytes += (i->endSeqNum - fromSeqNum);
294  fromSeqNum = i->endSeqNum;
295  i++;
296  }
297 
298  return bytes;
299 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
uint32_t uint32
Definition: Compat.h:30
void inet::tcp::TCPSACKRexmitQueue::checkSackBlock ( uint32  seqNum,
uint32 length,
bool &  sacked,
bool &  rexmitted 
) const
virtual

Referenced by inet::tcp::TCPConnection::nextSeg(), and inet::tcp::TCPConnection::setPipe().

374 {
375  ASSERT(seqLE(begin, fromSeqNum) && seqLess(fromSeqNum, end));
376 
377  RexmitQueue::const_iterator i = rexmitQueue.begin();
378 
379  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, fromSeqNum)) // search for seqNum
380  i++;
381 
382  ASSERT(i != rexmitQueue.end());
383  ASSERT(seqLE(i->beginSeqNum, fromSeqNum) && seqLess(fromSeqNum, i->endSeqNum));
384 
385  length = (i->endSeqNum - fromSeqNum);
386  sacked = i->sacked;
387  rexmitted = i->rexmitted;
388 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
void inet::tcp::TCPSACKRexmitQueue::discardUpTo ( uint32  seqNum)
virtual

Tells the queue that bytes up to (but NOT including) seqNum have been transmitted and ACKed, so they can be removed from the queue.

Referenced by inet::tcp::TCPConnection::processAckInEstabEtc(), inet::tcp::TCPConnection::processRstInSynReceived(), and inet::tcp::TCPConnection::processSegmentInSynSent().

66 {
67  ASSERT(seqLE(begin, seqNum) && seqLE(seqNum, end));
68 
69  if (!rexmitQueue.empty()) {
70  auto i = rexmitQueue.begin();
71 
72  while ((i != rexmitQueue.end()) && seqLE(i->endSeqNum, seqNum)) // discard/delete regions from rexmit queue, which have been acked
73  i = rexmitQueue.erase(i);
74 
75  if (i != rexmitQueue.end()) {
76  ASSERT(seqLE(i->beginSeqNum, seqNum) && seqLess(seqNum, i->endSeqNum));
77  i->beginSeqNum = seqNum;
78  }
79  }
80 
81  begin = seqNum;
82 
83  // TESTING queue:
84  ASSERT(checkQueue());
85 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
bool checkQueue() const
Definition: TCPSACKRexmitQueue.cc:167
void inet::tcp::TCPSACKRexmitQueue::enqueueSentData ( uint32  fromSeqNum,
uint32  toSeqNum 
)
virtual

Inserts sent data to the rexmit queue.

Referenced by inet::tcp::TCPConnection::sendSegment().

88 {
89  ASSERT(seqLE(begin, fromSeqNum) && seqLE(fromSeqNum, end));
90 
91  bool found = false;
92  Region region;
93 
94  EV_INFO << "rexmitQ: " << str() << " enqueueSentData [" << fromSeqNum << ".." << toSeqNum << ")\n";
95 
96  ASSERT(seqLess(fromSeqNum, toSeqNum));
97 
98  if (rexmitQueue.empty() || (end == fromSeqNum)) {
99  region.beginSeqNum = fromSeqNum;
100  region.endSeqNum = toSeqNum;
101  region.sacked = false;
102  region.rexmitted = false;
103  rexmitQueue.push_back(region);
104  found = true;
105  fromSeqNum = toSeqNum;
106  }
107  else {
108  auto i = rexmitQueue.begin();
109 
110  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, fromSeqNum))
111  i++;
112 
113  ASSERT(i != rexmitQueue.end());
114  ASSERT(seqLE(i->beginSeqNum, fromSeqNum) && seqLess(fromSeqNum, i->endSeqNum));
115 
116  if (i->beginSeqNum != fromSeqNum) {
117  // chunk item
118  region = *i;
119  region.endSeqNum = fromSeqNum;
120  rexmitQueue.insert(i, region);
121  i->beginSeqNum = fromSeqNum;
122  }
123 
124  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, toSeqNum)) {
125  i->rexmitted = true;
126  fromSeqNum = i->endSeqNum;
127  found = true;
128  i++;
129  }
130 
131  if (fromSeqNum != toSeqNum) {
132  bool beforeEnd = (i != rexmitQueue.end());
133 
134  ASSERT(i == rexmitQueue.end() || seqLess(i->beginSeqNum, toSeqNum));
135 
136  region.beginSeqNum = fromSeqNum;
137  region.endSeqNum = toSeqNum;
138  region.sacked = beforeEnd ? i->sacked : false;
139  region.rexmitted = beforeEnd;
140  rexmitQueue.insert(i, region);
141  found = true;
142  fromSeqNum = toSeqNum;
143 
144  if (beforeEnd)
145  i->beginSeqNum = toSeqNum;
146  }
147  }
148 
149  ASSERT(fromSeqNum == toSeqNum);
150 
151  if (!found) {
152  EV_DEBUG << "Not found enqueueSentData(" << fromSeqNum << ", " << toSeqNum << ")\nThe Queue is:\n";
153  info();
154  }
155 
156  ASSERT(found);
157 
158  begin = rexmitQueue.front().beginSeqNum;
159  end = rexmitQueue.back().endSeqNum;
160 
161  // TESTING queue:
162  ASSERT(checkQueue());
163 
164  // tcpEV << "rexmitQ: rexmitQLength=" << getQueueLength() << "\n";
165 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
virtual std::string str() const
Returns a string for debug purposes.
Definition: TCPSACKRexmitQueue.cc:43
bool checkQueue() const
Definition: TCPSACKRexmitQueue.cc:167
virtual void info() const
Prints the current rexmitQueue status for debug purposes.
Definition: TCPSACKRexmitQueue.cc:51
uint32 inet::tcp::TCPSACKRexmitQueue::getAmountOfSackedBytes ( uint32  seqNum) const
virtual

Returns amount of sacked bytes above seqNum.

Referenced by inet::tcp::TCPConnection::isLost().

326 {
327  ASSERT(seqLE(begin, fromSeqNum) && seqLE(fromSeqNum, end));
328 
329  uint32 bytes = 0;
330  RexmitQueue::const_reverse_iterator i = rexmitQueue.rbegin();
331 
332  for ( ; i != rexmitQueue.rend() && seqLE(fromSeqNum, i->beginSeqNum); i++) {
333  if (i->sacked)
334  bytes += (i->endSeqNum - i->beginSeqNum);
335  }
336 
337  if (i != rexmitQueue.rend()
338  && seqLess(i->beginSeqNum, fromSeqNum) && seqLess(fromSeqNum, i->endSeqNum) && i->sacked)
339  {
340  bytes += (i->endSeqNum - fromSeqNum);
341  }
342 
343  return bytes;
344 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
uint32_t uint32
Definition: Compat.h:30
virtual uint32 inet::tcp::TCPSACKRexmitQueue::getBufferEndSeq ( ) const
inlinevirtual

Returns the sequence number of the last byte stored in the buffer plus one.

(The first byte of the next send operation would get this sequence number.)

Referenced by inet::tcp::TCPConnection::processRstInSynReceived().

97 { return end; }
uint32 end
Definition: TCPSACKRexmitQueue.h:50
virtual uint32 inet::tcp::TCPSACKRexmitQueue::getBufferStartSeq ( ) const
inlinevirtual

Returns the sequence number of the first byte stored in the buffer.

91 { return begin; }
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 inet::tcp::TCPSACKRexmitQueue::getHighestRexmittedSeqNum ( ) const
virtual

Returns the highest sequence number rexmitted by data sender.

Referenced by inet::tcp::TCPConnection::nextSeg(), inet::tcp::TCPConnection::retransmitOneSegment(), inet::tcp::TCPConnection::sendData(), inet::tcp::TCPConnection::sendSegmentDuringLossRecoveryPhase(), and inet::tcp::TCPConnection::setPipe().

268 {
269  for (RexmitQueue::const_reverse_iterator i = rexmitQueue.rbegin(); i != rexmitQueue.rend(); i++) {
270  if (i->rexmitted)
271  return i->endSeqNum;
272  }
273 
274  return begin;
275 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 inet::tcp::TCPSACKRexmitQueue::getHighestSackedSeqNum ( ) const
virtual

Returns the highest sequence number sacked by data receiver.

Referenced by inet::tcp::TCPConnection::nextSeg().

258 {
259  for (RexmitQueue::const_reverse_iterator i = rexmitQueue.rbegin(); i != rexmitQueue.rend(); i++) {
260  if (i->sacked)
261  return i->endSeqNum;
262  }
263 
264  return begin;
265 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 inet::tcp::TCPSACKRexmitQueue::getNumOfDiscontiguousSacks ( uint32  seqNum) const
virtual

Returns the number of discontiguous sacked regions (SACKed sequences) above seqNum.

Referenced by inet::tcp::TCPConnection::isLost().

347 {
348  ASSERT(seqLE(begin, fromSeqNum) && seqLE(fromSeqNum, end));
349 
350  if (rexmitQueue.empty() || (fromSeqNum == end))
351  return 0;
352 
353  RexmitQueue::const_iterator i = rexmitQueue.begin();
354  uint32 counter = 0;
355 
356  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, fromSeqNum)) // search for seqNum
357  i++;
358 
359  // search for discontiguous sacked regions
360  bool prevSacked = false;
361 
362  while (i != rexmitQueue.end()) {
363  if (i->sacked && !prevSacked)
364  counter++;
365 
366  prevSacked = i->sacked;
367  i++;
368  }
369 
370  return counter;
371 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
uint32_t uint32
Definition: Compat.h:30
virtual uint32 inet::tcp::TCPSACKRexmitQueue::getQueueLength ( ) const
inlinevirtual

Returns the number of blocks currently buffered in queue.

126 { return rexmitQueue.size(); }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
bool inet::tcp::TCPSACKRexmitQueue::getSackedBit ( uint32  seqNum) const
virtual

Returns SackedBit value of seqNum.

241 {
242  ASSERT(seqLE(begin, seqNum) && seqLE(seqNum, end));
243 
244  RexmitQueue::const_iterator i = rexmitQueue.begin();
245 
246  if (end == seqNum)
247  return false;
248 
249  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, seqNum))
250  i++;
251 
252  ASSERT((i != rexmitQueue.end()) && seqLE(i->beginSeqNum, seqNum) && seqLess(seqNum, i->endSeqNum));
253 
254  return i->sacked;
255 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
uint32 inet::tcp::TCPSACKRexmitQueue::getTotalAmountOfSackedBytes ( ) const
virtual

Returns total amount of sacked bytes.

Corresponds to update() function from RFC 3517.

Referenced by inet::tcp::TCPConnection::processSACKOption().

314 {
315  uint32 bytes = 0;
316 
317  for (const auto & elem : rexmitQueue) {
318  if (elem.sacked)
319  bytes += (elem.endSeqNum - elem.beginSeqNum);
320  }
321 
322  return bytes;
323 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32_t uint32
Definition: Compat.h:30
void inet::tcp::TCPSACKRexmitQueue::info ( ) const
virtual

Prints the current rexmitQueue status for debug purposes.

Referenced by checkQueue(), enqueueSentData(), and inet::tcp::TCPConnection::sendSegment().

52 {
53  EV_DETAIL << str() << endl;
54 
55  uint j = 1;
56 
57  for (const auto & elem : rexmitQueue) {
58  EV_DETAIL << j << ". region: [" << elem.beginSeqNum << ".." << elem.endSeqNum
59  << ") \t sacked=" << elem.sacked << "\t rexmitted=" << elem.rexmitted
60  << endl;
61  j++;
62  }
63 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
unsigned int uint
Definition: INETDefs.h:63
virtual std::string str() const
Returns a string for debug purposes.
Definition: TCPSACKRexmitQueue.cc:43
void inet::tcp::TCPSACKRexmitQueue::init ( uint32  seqNum)
virtual

Initialize the object.

The startSeq parameter tells what sequence number the first byte of app data should get. This is usually ISS + 1 because SYN consumes one byte in the sequence number space.

init() may be called more than once; every call flushes the existing contents of the queue.

Referenced by inet::tcp::TCPConnection::selectInitialSeqNum().

38 {
39  begin = seqNum;
40  end = seqNum;
41 }
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
void inet::tcp::TCPSACKRexmitQueue::resetRexmittedBit ( )
virtual

Called when REXMIT timer expired.

Resets rexmitted bit of all segments in rexmit queue.

Referenced by inet::tcp::TCPBaseAlg::processRexmitTimer().

308 {
309  for (auto & elem : rexmitQueue)
310  elem.rexmitted = false; // reset rexmitted bit
311 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
void inet::tcp::TCPSACKRexmitQueue::resetSackedBit ( )
virtual

Called when REXMIT timer expired.

Resets sacked bit of all segments in rexmit queue.

Referenced by inet::tcp::TCPBaseAlg::processRexmitTimer().

302 {
303  for (auto & elem : rexmitQueue)
304  elem.sacked = false; // reset sacked bit
305 }
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
virtual void inet::tcp::TCPSACKRexmitQueue::setConnection ( TCPConnection _conn)
inlinevirtual

Set the connection that owns this queue.

Referenced by inet::tcp::TCPConnection::cloneListeningConnection(), and inet::tcp::TCPConnection::initConnection().

66 { conn = _conn; }
TCPConnection * conn
Definition: TCPSACKRexmitQueue.h:36
void inet::tcp::TCPSACKRexmitQueue::setSackedBit ( uint32  fromSeqNum,
uint32  toSeqNum 
)
virtual

Called when data sender received selective acknowledgments.

Tells the queue which bytes have been transmitted and SACKed, so they can be skipped if retransmitting segments as long as REXMIT timer did not expired.

Referenced by inet::tcp::TCPConnection::processSACKOption().

189 {
190  if (seqLess(fromSeqNum, begin))
191  fromSeqNum = begin;
192 
193  ASSERT(seqLess(fromSeqNum, end));
194  ASSERT(seqLess(begin, toSeqNum) && seqLE(toSeqNum, end));
195  ASSERT(seqLess(fromSeqNum, toSeqNum));
196 
197  bool found = false;
198 
199  if (!rexmitQueue.empty()) {
200  auto i = rexmitQueue.begin();
201 
202  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, fromSeqNum))
203  i++;
204 
205  ASSERT(i != rexmitQueue.end() && seqLE(i->beginSeqNum, fromSeqNum) && seqLess(fromSeqNum, i->endSeqNum));
206 
207  if (i->beginSeqNum != fromSeqNum) {
208  Region region = *i;
209 
210  region.endSeqNum = fromSeqNum;
211  rexmitQueue.insert(i, region);
212  i->beginSeqNum = fromSeqNum;
213  }
214 
215  while (i != rexmitQueue.end() && seqLE(i->endSeqNum, toSeqNum)) {
216  if (seqGE(i->beginSeqNum, fromSeqNum)) { // Search region in queue!
217  found = true;
218  i->sacked = true; // set sacked bit
219  }
220 
221  i++;
222  }
223 
224  if (i != rexmitQueue.end() && seqLess(i->beginSeqNum, toSeqNum) && seqLess(toSeqNum, i->endSeqNum)) {
225  Region region = *i;
226 
227  region.endSeqNum = toSeqNum;
228  region.sacked = true;
229  rexmitQueue.insert(i, region);
230  i->beginSeqNum = toSeqNum;
231  }
232  }
233 
234  if (!found)
235  EV_DETAIL << "FAILED to set sacked bit for region: [" << fromSeqNum << ".." << toSeqNum << "). Not found in retransmission queue.\n";
236 
237  ASSERT(checkQueue());
238 }
bool seqGE(uint32 a, uint32 b)
Definition: TCPSegment.h:35
RexmitQueue rexmitQueue
Definition: TCPSACKRexmitQueue.h:47
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50
bool seqLess(uint32 a, uint32 b)
Definition: TCPSegment.h:32
bool seqLE(uint32 a, uint32 b)
Definition: TCPSegment.h:33
bool checkQueue() const
Definition: TCPSACKRexmitQueue.cc:167
std::string inet::tcp::TCPSACKRexmitQueue::str ( ) const
virtual

Returns a string for debug purposes.

Referenced by enqueueSentData(), and info().

44 {
45  std::stringstream out;
46 
47  out << "[" << begin << ".." << end << ")";
48  return out.str();
49 }
uint32 begin
Definition: TCPSACKRexmitQueue.h:49
uint32 end
Definition: TCPSACKRexmitQueue.h:50

Member Data Documentation

TCPConnection* inet::tcp::TCPSACKRexmitQueue::conn

Referenced by TCPSACKRexmitQueue().


The documentation for this class was generated from the following files: