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

#include <QoSRecoveryProcedure.h>

Inheritance diagram for inet::ieee80211::QoSRecoveryProcedure:
inet::ieee80211::IRecoveryProcedure

Public Member Functions

virtual void multicastFrameTransmitted ()
 
virtual void ctsFrameReceived ()
 
virtual void ackFrameReceived (Ieee80211DataFrame *ackedFrame)
 
virtual void blockAckFrameReceived ()
 
virtual void rtsFrameTransmissionFailed (Ieee80211DataFrame *protectedFrame)
 
virtual void dataFrameTransmissionFailed (Ieee80211DataFrame *failedFrame)
 
virtual bool isRetryLimitReached (Ieee80211DataFrame *failedFrame)
 
virtual int getRetryCount (Ieee80211DataFrame *frame)
 
virtual bool isRtsFrameRetryLimitReached (Ieee80211DataFrame *protectedFrame)
 
virtual void retryLimitReached (Ieee80211DataFrame *frame)
 
virtual int getLongRetryLimit ()
 
virtual int getShortRetryLimit ()
 
- Public Member Functions inherited from inet::ieee80211::IRecoveryProcedure
virtual ~IRecoveryProcedure ()
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
void incrementCounter (Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
 
void incrementStationSrc ()
 
void incrementStationLrc ()
 
void resetStationSrc ()
 
void resetStationLrc ()
 
void resetContentionWindow ()
 
int doubleCw (int cw)
 
int getRc (Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
 
bool isMulticastFrame (Ieee80211Frame *frame)
 

Protected Attributes

ICwCalculatorcwCalculator = nullptr
 
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
 
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
 
int stationLongRetryCounter = 0
 
int stationShortRetryCounter = 0
 
int shortRetryLimit = -1
 
int longRetryLimit = -1
 
int rtsThreshold = -1
 

Member Function Documentation

void inet::ieee80211::QoSRecoveryProcedure::ackFrameReceived ( Ieee80211DataFrame ackedFrame)
virtual
114 {
115  auto id = std::make_pair(ackedFrame->getTid(), SequenceControlField(ackedFrame->getSequenceNumber(), ackedFrame->getFragmentNumber()));
116  if (ackedFrame->getByteLength() >= rtsThreshold) {
117  resetStationLrc();
118  auto it = longRetryCounter.find(id);
119  if (it != longRetryCounter.end())
120  longRetryCounter.erase(it);
121  }
122  else {
123  auto it = shortRetryCounter.find(id);
124  resetStationSrc();
125  if (it != shortRetryCounter.end())
126  shortRetryCounter.erase(it);
127  }
128 //
129 // The CW shall be reset to aCWmin after every successful attempt to transmit a frame containing
130 // all or part of an MSDU or MMPDU
131 //
133 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
void resetStationSrc()
Definition: QoSRecoveryProcedure.h:60
void resetContentionWindow()
Definition: QoSRecoveryProcedure.cc:206
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
Definition: QoSRecoveryProcedure.h:44
void resetStationLrc()
Definition: QoSRecoveryProcedure.h:61
void inet::ieee80211::QoSRecoveryProcedure::blockAckFrameReceived ( )
virtual
102 {
103  resetStationSrc();
104 }
void resetStationSrc()
Definition: QoSRecoveryProcedure.h:60
void inet::ieee80211::QoSRecoveryProcedure::ctsFrameReceived ( )
virtual
97 {
99 }
void resetStationSrc()
Definition: QoSRecoveryProcedure.h:60
void inet::ieee80211::QoSRecoveryProcedure::dataFrameTransmissionFailed ( Ieee80211DataFrame failedFrame)
virtual
164 {
165  if (failedFrame->getByteLength() >= rtsThreshold) {
167  incrementCounter(failedFrame, longRetryCounter);
168  }
169  else {
171  incrementCounter(failedFrame, shortRetryCounter);
172  }
173 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
void incrementStationLrc()
Definition: QoSRecoveryProcedure.cc:57
void incrementCounter(Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
Definition: QoSRecoveryProcedure.cc:66
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
Definition: QoSRecoveryProcedure.h:44
void incrementStationSrc()
Definition: QoSRecoveryProcedure.cc:48
int inet::ieee80211::QoSRecoveryProcedure::doubleCw ( int  cw)
protected
virtual int inet::ieee80211::QoSRecoveryProcedure::getLongRetryLimit ( )
inlinevirtual
83 { return longRetryLimit; }
int longRetryLimit
Definition: QoSRecoveryProcedure.h:50
int inet::ieee80211::QoSRecoveryProcedure::getRc ( Ieee80211DataFrame frame,
std::map< std::pair< Tid, SequenceControlField >, int > &  retryCounter 
)
protected

Referenced by getRetryCount(), isRetryLimitReached(), and isRtsFrameRetryLimitReached().

217 {
218  auto id = std::make_pair(frame->getTid(), SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber()));
219  auto it = retryCounter.find(id);
220  if (it != retryCounter.end())
221  return it->second;
222  else
223  throw cRuntimeError("The retry counter entry doesn't exist for message id: %d", frame->getId());
224 }
int inet::ieee80211::QoSRecoveryProcedure::getRetryCount ( Ieee80211DataFrame frame)
virtual
199 {
200  if (frame->getByteLength() >= rtsThreshold)
201  return getRc(frame, longRetryCounter);
202  else
203  return getRc(frame, shortRetryCounter);
204 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
int getRc(Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
Definition: QoSRecoveryProcedure.cc:216
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
Definition: QoSRecoveryProcedure.h:44
virtual int inet::ieee80211::QoSRecoveryProcedure::getShortRetryLimit ( )
inlinevirtual
84 { return shortRetryLimit; }
int shortRetryLimit
Definition: QoSRecoveryProcedure.h:49
void inet::ieee80211::QoSRecoveryProcedure::incrementCounter ( Ieee80211DataFrame frame,
std::map< std::pair< Tid, SequenceControlField >, int > &  retryCounter 
)
protected

Referenced by dataFrameTransmissionFailed(), and rtsFrameTransmissionFailed().

67 {
68  auto id = std::make_pair(frame->getTid(), SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber()));
69  if (retryCounter.find(id) != retryCounter.end())
70  retryCounter[id]++;
71  else
72  retryCounter[id] = 1;
73 }
uint16_t id
Definition: TCP_NSC.cc:85
void inet::ieee80211::QoSRecoveryProcedure::incrementStationLrc ( )
protected

Referenced by dataFrameTransmissionFailed().

58 {
60  if (stationLongRetryCounter == longRetryLimit) // 9.3.3 Random backoff time
62  else
64 }
void resetContentionWindow()
Definition: QoSRecoveryProcedure.cc:206
ICwCalculator * cwCalculator
Definition: QoSRecoveryProcedure.h:41
int stationLongRetryCounter
Definition: QoSRecoveryProcedure.h:46
int longRetryLimit
Definition: QoSRecoveryProcedure.h:50
void inet::ieee80211::QoSRecoveryProcedure::incrementStationSrc ( )
protected

Referenced by dataFrameTransmissionFailed(), and rtsFrameTransmissionFailed().

49 {
51  if (stationShortRetryCounter == shortRetryLimit) // 9.3.3 Random backoff time
53  else
55 }
int stationShortRetryCounter
Definition: QoSRecoveryProcedure.h:47
void resetContentionWindow()
Definition: QoSRecoveryProcedure.cc:206
int shortRetryLimit
Definition: QoSRecoveryProcedure.h:49
ICwCalculator * cwCalculator
Definition: QoSRecoveryProcedure.h:41
void inet::ieee80211::QoSRecoveryProcedure::initialize ( int  stage)
overrideprotectedvirtual
38 {
39  if (stage == INITSTAGE_LAST) {
40  auto rtsPolicy = check_and_cast<IRtsPolicy *>(getModuleByPath(par("rtsPolicyModule")));
41  cwCalculator = check_and_cast<ICwCalculator *>(getModuleByPath(par("cwCalculatorModule")));
42  rtsThreshold = rtsPolicy->getRtsThreshold();
43  shortRetryLimit = par("shortRetryLimit");
44  longRetryLimit = par("longRetryLimit");
45  }
46 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
Operations that no other initializations can depend on, e.g.
Definition: InitStages.h:111
int shortRetryLimit
Definition: QoSRecoveryProcedure.h:49
ICwCalculator * cwCalculator
Definition: QoSRecoveryProcedure.h:41
int longRetryLimit
Definition: QoSRecoveryProcedure.h:50
bool inet::ieee80211::QoSRecoveryProcedure::isMulticastFrame ( Ieee80211Frame frame)
protected
227 {
228  if (Ieee80211OneAddressFrame *oneAddressFrame = dynamic_cast<Ieee80211OneAddressFrame*>(frame)) {
229  return oneAddressFrame->getReceiverAddress().isMulticast();
230  }
231  return false;
232 }
bool inet::ieee80211::QoSRecoveryProcedure::isRetryLimitReached ( Ieee80211DataFrame failedFrame)
virtual
191 {
192  if (failedFrame->getByteLength() >= rtsThreshold)
193  return getRc(failedFrame, longRetryCounter) >= longRetryLimit;
194  else
195  return getRc(failedFrame, shortRetryCounter) >= shortRetryLimit;
196 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
int shortRetryLimit
Definition: QoSRecoveryProcedure.h:49
int getRc(Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
Definition: QoSRecoveryProcedure.cc:216
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
Definition: QoSRecoveryProcedure.h:44
int longRetryLimit
Definition: QoSRecoveryProcedure.h:50
bool inet::ieee80211::QoSRecoveryProcedure::isRtsFrameRetryLimitReached ( Ieee80211DataFrame protectedFrame)
virtual
212 {
213  return getRc(protectedFrame, shortRetryCounter) >= shortRetryLimit;
214 }
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
int shortRetryLimit
Definition: QoSRecoveryProcedure.h:49
int getRc(Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
Definition: QoSRecoveryProcedure.cc:216
void inet::ieee80211::QoSRecoveryProcedure::multicastFrameTransmitted ( )
virtual
81 {
84 }
void resetStationSrc()
Definition: QoSRecoveryProcedure.h:60
void resetStationLrc()
Definition: QoSRecoveryProcedure.h:61
virtual int inet::ieee80211::QoSRecoveryProcedure::numInitStages ( ) const
inlineoverrideprotectedvirtual
54 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::QoSRecoveryProcedure::resetContentionWindow ( )
protected

Referenced by ackFrameReceived(), incrementStationLrc(), and incrementStationSrc().

207 {
209 }
ICwCalculator * cwCalculator
Definition: QoSRecoveryProcedure.h:41
void inet::ieee80211::QoSRecoveryProcedure::resetStationLrc ( )
inlineprotected

Referenced by ackFrameReceived(), and multicastFrameTransmitted().

int stationLongRetryCounter
Definition: QoSRecoveryProcedure.h:46
void inet::ieee80211::QoSRecoveryProcedure::resetStationSrc ( )
inlineprotected
void inet::ieee80211::QoSRecoveryProcedure::retryLimitReached ( Ieee80211DataFrame frame)
virtual
140 {
141  auto id = std::make_pair(frame->getTid(), SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber()));
142  if (frame->getByteLength() >= rtsThreshold) {
143  auto it = longRetryCounter.find(id);
144  if (it != longRetryCounter.end())
145  longRetryCounter.erase(it);
146  }
147  else {
148  auto it = shortRetryCounter.find(id);
149  if (it != shortRetryCounter.end())
150  shortRetryCounter.erase(it);
151  }
152 }
int rtsThreshold
Definition: QoSRecoveryProcedure.h:51
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
std::map< std::pair< Tid, SequenceControlField >, int > longRetryCounter
Definition: QoSRecoveryProcedure.h:44
void inet::ieee80211::QoSRecoveryProcedure::rtsFrameTransmissionFailed ( Ieee80211DataFrame protectedFrame)
virtual
179 {
181  incrementCounter(protectedFrame, shortRetryCounter);
182 }
std::map< std::pair< Tid, SequenceControlField >, int > shortRetryCounter
Definition: QoSRecoveryProcedure.h:43
void incrementCounter(Ieee80211DataFrame *frame, std::map< std::pair< Tid, SequenceControlField >, int > &retryCounter)
Definition: QoSRecoveryProcedure.cc:66
void incrementStationSrc()
Definition: QoSRecoveryProcedure.cc:48

Member Data Documentation

ICwCalculator* inet::ieee80211::QoSRecoveryProcedure::cwCalculator = nullptr
protected
std::map<std::pair<Tid, SequenceControlField>, int> inet::ieee80211::QoSRecoveryProcedure::longRetryCounter
protected
int inet::ieee80211::QoSRecoveryProcedure::longRetryLimit = -1
protected
int inet::ieee80211::QoSRecoveryProcedure::rtsThreshold = -1
protected
std::map<std::pair<Tid, SequenceControlField>, int> inet::ieee80211::QoSRecoveryProcedure::shortRetryCounter
protected
int inet::ieee80211::QoSRecoveryProcedure::shortRetryLimit = -1
protected
int inet::ieee80211::QoSRecoveryProcedure::stationLongRetryCounter = 0
protected

Referenced by incrementStationLrc().

int inet::ieee80211::QoSRecoveryProcedure::stationShortRetryCounter = 0
protected

Referenced by incrementStationSrc().


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