INET Framework for OMNeT++/OMNEST
inet::ieee80211::ReceiveBuffer Class Reference

#include <ReceiveBuffer.h>

Public Types

typedef std::vector< Ieee80211DataFrame * > Fragments
 
typedef std::map< SequenceNumber, FragmentsReorderBuffer
 

Public Member Functions

 ReceiveBuffer (int bufferSize, int nextExpectedSequenceNumber)
 
virtual ~ReceiveBuffer ()
 
bool insertFrame (Ieee80211DataFrame *dataFrame)
 
void remove (int sequenceNumber)
 
const ReorderBuffergetBuffer ()
 
int getLength ()
 
int getBufferSize ()
 
SequenceNumber getNextExpectedSequenceNumber ()
 
void setNextExpectedSequenceNumber (SequenceNumber nextExpectedSequenceNumber)
 
bool isFull ()
 

Protected Attributes

ReorderBuffer buffer
 
int bufferSize = -1
 
int length = 0
 
SequenceNumber nextExpectedSequenceNumber = -1
 

Member Typedef Documentation

Constructor & Destructor Documentation

inet::ieee80211::ReceiveBuffer::ReceiveBuffer ( int  bufferSize,
int  nextExpectedSequenceNumber 
)
23  :
26 {
27 }
int bufferSize
Definition: ReceiveBuffer.h:38
SequenceNumber nextExpectedSequenceNumber
Definition: ReceiveBuffer.h:40
inet::ieee80211::ReceiveBuffer::~ReceiveBuffer ( )
virtual
69 {
70  for (auto fragments : buffer) {
71  for (auto fragment : fragments.second)
72  delete fragment;
73  }
74 }
ReorderBuffer buffer
Definition: ReceiveBuffer.h:34

Member Function Documentation

int inet::ieee80211::ReceiveBuffer::getLength ( )
inline
50 { return length; }
int length
Definition: ReceiveBuffer.h:39
bool inet::ieee80211::ReceiveBuffer::insertFrame ( Ieee80211DataFrame dataFrame)

Referenced by inet::ieee80211::BlockAckReordering::processReceivedQoSFrame().

36 {
37  int sequenceNumber = dataFrame->getSequenceNumber();
38  // The total number of MPDUs in these MSDUs may not
39  // exceed the reorder buffer size in the receiver.
40  if (length < bufferSize && !isSequenceNumberTooOld(sequenceNumber, nextExpectedSequenceNumber, bufferSize)) {
41  auto it = buffer.find(sequenceNumber);
42  if (it != buffer.end()) {
43  auto &fragments = it->second;
44  fragments.push_back(dataFrame);
45  }
46  else {
47  buffer[sequenceNumber].push_back(dataFrame);
48  }
49  // The total number of frames that can be sent depends on the total
50  // number of MPDUs in all the outstanding MSDUs.
51  length++;
52  return true;
53  }
54  return false;
55 }
ReorderBuffer buffer
Definition: ReceiveBuffer.h:34
int length
Definition: ReceiveBuffer.h:39
int bufferSize
Definition: ReceiveBuffer.h:38
SequenceNumber nextExpectedSequenceNumber
Definition: ReceiveBuffer.h:40
bool inet::ieee80211::ReceiveBuffer::isFull ( )
inline

Referenced by inet::ieee80211::BlockAckReordering::processReceivedQoSFrame().

54 { ASSERT(length <= bufferSize); return length == bufferSize; }
int length
Definition: ReceiveBuffer.h:39
int bufferSize
Definition: ReceiveBuffer.h:38
void inet::ieee80211::ReceiveBuffer::remove ( int  sequenceNumber)

Referenced by inet::ieee80211::BlockAckReordering::passedUp().

58 {
59  auto it = buffer.find(sequenceNumber);
60  if (it != buffer.end()) {
61  length -= it->second.size();
62  buffer.erase(sequenceNumber);
63  }
64  else
65  throw cRuntimeError("Unknown sequence number = %d", sequenceNumber);
66 }
ReorderBuffer buffer
Definition: ReceiveBuffer.h:34
int length
Definition: ReceiveBuffer.h:39
void inet::ieee80211::ReceiveBuffer::setNextExpectedSequenceNumber ( SequenceNumber  nextExpectedSequenceNumber)
inline

Member Data Documentation

ReorderBuffer inet::ieee80211::ReceiveBuffer::buffer
protected

Referenced by insertFrame(), remove(), and ~ReceiveBuffer().

int inet::ieee80211::ReceiveBuffer::bufferSize = -1
protected

Referenced by insertFrame().

int inet::ieee80211::ReceiveBuffer::length = 0
protected

Referenced by insertFrame(), and remove().

SequenceNumber inet::ieee80211::ReceiveBuffer::nextExpectedSequenceNumber = -1
protected

Referenced by insertFrame().


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