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

#include <NonQoSRecoveryProcedure.h>

Inheritance diagram for inet::ieee80211::NonQoSRecoveryProcedure:
inet::ieee80211::IRecoveryProcedure

Public Member Functions

virtual void multicastFrameTransmitted (StationRetryCounters *stationCounters)
 
virtual void ctsFrameReceived (StationRetryCounters *stationCounters)
 
virtual void ackFrameReceived (Ieee80211DataOrMgmtFrame *ackedFrame, StationRetryCounters *stationCounters)
 
virtual void rtsFrameTransmissionFailed (Ieee80211DataOrMgmtFrame *protectedFrame, StationRetryCounters *stationCounters)
 
virtual void dataOrMgmtFrameTransmissionFailed (Ieee80211DataOrMgmtFrame *failedFrame, StationRetryCounters *stationCounters)
 
virtual int getRetryCount (Ieee80211DataOrMgmtFrame *frame)
 
virtual int getShortRetryCount (Ieee80211DataOrMgmtFrame *frame)
 
virtual int getLongRetryCount (Ieee80211DataOrMgmtFrame *frame)
 
virtual bool isRetryLimitReached (Ieee80211DataOrMgmtFrame *failedFrame)
 
virtual bool isRtsFrameRetryLimitReached (Ieee80211DataOrMgmtFrame *protectedFrame)
 
virtual void retryLimitReached (Ieee80211DataOrMgmtFrame *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
 
virtual void incrementCounter (Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
 
virtual void resetContentionWindow ()
 
virtual int getRc (Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
 
virtual bool isMulticastFrame (Ieee80211Frame *frame)
 
virtual void incrementStationSrc (StationRetryCounters *stationCounters)
 
virtual void incrementStationLrc (StationRetryCounters *stationCounters)
 

Protected Attributes

ICwCalculatorcwCalculator = nullptr
 
std::map< SequenceControlField, int > shortRetryCounter
 
std::map< SequenceControlField, int > longRetryCounter
 
int shortRetryLimit = -1
 
int longRetryLimit = -1
 
int rtsThreshold = -1
 

Member Function Documentation

void inet::ieee80211::NonQoSRecoveryProcedure::ackFrameReceived ( Ieee80211DataOrMgmtFrame ackedFrame,
StationRetryCounters stationCounters 
)
virtual

Referenced by inet::ieee80211::Hcf::originatorProcessReceivedControlFrame(), and inet::ieee80211::Dcf::originatorProcessReceivedFrame().

109 {
110  auto id = SequenceControlField(ackedFrame->getSequenceNumber(), ackedFrame->getFragmentNumber());
111  if (ackedFrame->getByteLength() >= rtsThreshold) {
112  stationCounters->resetStationLongRetryCount();
113  auto it = longRetryCounter.find(id);
114  if (it != longRetryCounter.end())
115  longRetryCounter.erase(it);
116  }
117  else {
118  stationCounters->resetStationShortRetryCount();
119  auto it = shortRetryCounter.find(id);
120  if (it != shortRetryCounter.end())
121  shortRetryCounter.erase(it);
122  }
123 
124 //
125 // The CW shall be reset to aCWmin after every successful attempt to transmit a frame containing
126 // all or part of an MSDU or MMPDU
127 //
129 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual void resetContentionWindow()
Definition: NonQoSRecoveryProcedure.cc:214
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
void inet::ieee80211::NonQoSRecoveryProcedure::ctsFrameReceived ( StationRetryCounters stationCounters)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessReceivedFrame().

97 {
98  stationCounters->resetStationShortRetryCount();
99 }
void inet::ieee80211::NonQoSRecoveryProcedure::dataOrMgmtFrameTransmissionFailed ( Ieee80211DataOrMgmtFrame failedFrame,
StationRetryCounters stationCounters 
)
virtual

Referenced by inet::ieee80211::Hcf::handleInternalCollision(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), and inet::ieee80211::Hcf::originatorProcessFailedFrame().

160 {
161  if (failedFrame->getByteLength() >= rtsThreshold) {
162  incrementStationLrc(stationCounters);
163  incrementCounter(failedFrame, longRetryCounter);
164  }
165  else {
166  incrementStationSrc(stationCounters);
167  incrementCounter(failedFrame, shortRetryCounter);
168  }
169 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual void incrementCounter(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:66
virtual void incrementStationSrc(StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:48
virtual void incrementStationLrc(StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:57
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
int inet::ieee80211::NonQoSRecoveryProcedure::getLongRetryCount ( Ieee80211DataOrMgmtFrame frame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), and inet::ieee80211::Dcf::originatorProcessTransmittedFrame().

210 {
211  return getRc(frame, longRetryCounter);
212 }
virtual int getRc(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:224
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
virtual int inet::ieee80211::NonQoSRecoveryProcedure::getLongRetryLimit ( )
inlinevirtual
76 { return longRetryLimit; }
int longRetryLimit
Definition: NonQoSRecoveryProcedure.h:45
int inet::ieee80211::NonQoSRecoveryProcedure::getRc ( Ieee80211DataOrMgmtFrame frame,
std::map< SequenceControlField, int > &  retryCounter 
)
protectedvirtual

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

225 {
226  auto count = retryCounter.find(SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber()));
227  if (count != retryCounter.end())
228  return count->second;
229  else
230  return 0;
231 }
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
int inet::ieee80211::NonQoSRecoveryProcedure::getRetryCount ( Ieee80211DataOrMgmtFrame frame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessReceivedControlFrame(), and inet::ieee80211::Dcf::originatorProcessReceivedFrame().

196 {
197  if (frame->getByteLength() >= rtsThreshold)
198  return getRc(frame, longRetryCounter);
199  else
200  return getRc(frame, shortRetryCounter);
201 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual int getRc(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:224
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
int inet::ieee80211::NonQoSRecoveryProcedure::getShortRetryCount ( Ieee80211DataOrMgmtFrame frame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), and inet::ieee80211::Dcf::originatorProcessTransmittedFrame().

205 {
206  return getRc(frame, shortRetryCounter);
207 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual int getRc(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:224
virtual int inet::ieee80211::NonQoSRecoveryProcedure::getShortRetryLimit ( )
inlinevirtual
77 { return shortRetryLimit; }
int shortRetryLimit
Definition: NonQoSRecoveryProcedure.h:44
void inet::ieee80211::NonQoSRecoveryProcedure::incrementCounter ( Ieee80211DataOrMgmtFrame frame,
std::map< SequenceControlField, int > &  retryCounter 
)
protectedvirtual

Referenced by dataOrMgmtFrameTransmissionFailed(), and rtsFrameTransmissionFailed().

67 {
68  auto id = SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber());
69  if (retryCounter.find(id) != retryCounter.end())
70  retryCounter[id]++;
71  else
72  retryCounter.insert(std::make_pair(id, 1));
73 }
void inet::ieee80211::NonQoSRecoveryProcedure::incrementStationLrc ( StationRetryCounters stationCounters)
protectedvirtual

Referenced by dataOrMgmtFrameTransmissionFailed().

58 {
59  stationCounters->incrementStationLongRetryCount();
60  if (stationCounters->getStationLongRetryCount() == longRetryLimit) // 9.3.3 Random backoff time
62  else
64 }
int longRetryLimit
Definition: NonQoSRecoveryProcedure.h:45
virtual void resetContentionWindow()
Definition: NonQoSRecoveryProcedure.cc:214
ICwCalculator * cwCalculator
Definition: NonQoSRecoveryProcedure.h:39
void inet::ieee80211::NonQoSRecoveryProcedure::incrementStationSrc ( StationRetryCounters stationCounters)
protectedvirtual

Referenced by dataOrMgmtFrameTransmissionFailed(), and rtsFrameTransmissionFailed().

49 {
50  stationCounters->incrementStationShortRetryCount();
51  if (stationCounters->getStationShortRetryCount() == shortRetryLimit) // 9.3.3 Random backoff time
53  else
55 }
int shortRetryLimit
Definition: NonQoSRecoveryProcedure.h:44
virtual void resetContentionWindow()
Definition: NonQoSRecoveryProcedure.cc:214
ICwCalculator * cwCalculator
Definition: NonQoSRecoveryProcedure.h:39
void inet::ieee80211::NonQoSRecoveryProcedure::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 }
Operations that no other initializations can depend on, e.g.
Definition: InitStages.h:111
int shortRetryLimit
Definition: NonQoSRecoveryProcedure.h:44
int longRetryLimit
Definition: NonQoSRecoveryProcedure.h:45
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
ICwCalculator * cwCalculator
Definition: NonQoSRecoveryProcedure.h:39
bool inet::ieee80211::NonQoSRecoveryProcedure::isMulticastFrame ( Ieee80211Frame frame)
protectedvirtual
234 {
235  if (Ieee80211OneAddressFrame *oneAddressFrame = dynamic_cast<Ieee80211OneAddressFrame*>(frame)) {
236  return oneAddressFrame->getReceiverAddress().isMulticast();
237  }
238  return false;
239 }
bool inet::ieee80211::NonQoSRecoveryProcedure::isRetryLimitReached ( Ieee80211DataOrMgmtFrame failedFrame)
virtual

Referenced by inet::ieee80211::Hcf::handleInternalCollision(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), and inet::ieee80211::Hcf::originatorProcessFailedFrame().

187 {
188  if (failedFrame->getByteLength() >= rtsThreshold)
189  return getRc(failedFrame, longRetryCounter) >= longRetryLimit;
190  else
191  return getRc(failedFrame, shortRetryCounter) >= shortRetryLimit;
192 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual int getRc(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:224
int shortRetryLimit
Definition: NonQoSRecoveryProcedure.h:44
int longRetryLimit
Definition: NonQoSRecoveryProcedure.h:45
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
bool inet::ieee80211::NonQoSRecoveryProcedure::isRtsFrameRetryLimitReached ( Ieee80211DataOrMgmtFrame protectedFrame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), and inet::ieee80211::Hcf::originatorProcessRtsProtectionFailed().

220 {
221  return getRc(protectedFrame, shortRetryCounter) >= shortRetryLimit;
222 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual int getRc(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:224
int shortRetryLimit
Definition: NonQoSRecoveryProcedure.h:44
void inet::ieee80211::NonQoSRecoveryProcedure::multicastFrameTransmitted ( StationRetryCounters stationCounters)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessTransmittedFrame().

81 {
82  stationCounters->resetStationShortRetryCount();
83  stationCounters->resetStationLongRetryCount();
84 }
virtual int inet::ieee80211::NonQoSRecoveryProcedure::numInitStages ( ) const
inlineoverrideprotectedvirtual
49 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::NonQoSRecoveryProcedure::resetContentionWindow ( )
protectedvirtual

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

215 {
217 }
ICwCalculator * cwCalculator
Definition: NonQoSRecoveryProcedure.h:39
void inet::ieee80211::NonQoSRecoveryProcedure::retryLimitReached ( Ieee80211DataOrMgmtFrame frame)
virtual

Referenced by inet::ieee80211::Hcf::handleInternalCollision(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), inet::ieee80211::Hcf::originatorProcessFailedFrame(), inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), and inet::ieee80211::Hcf::originatorProcessRtsProtectionFailed().

136 {
137  auto id = SequenceControlField(frame->getSequenceNumber(), frame->getFragmentNumber());
138  if (frame->getByteLength() >= rtsThreshold) {
139  auto it = longRetryCounter.find(id);
140  if (it != longRetryCounter.end())
141  longRetryCounter.erase(it);
142  }
143  else {
144  auto it = shortRetryCounter.find(id);
145  if (it != shortRetryCounter.end())
146  shortRetryCounter.erase(it);
147  }
148 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
int rtsThreshold
Definition: NonQoSRecoveryProcedure.h:46
std::map< SequenceControlField, int > longRetryCounter
Definition: NonQoSRecoveryProcedure.h:42
void inet::ieee80211::NonQoSRecoveryProcedure::rtsFrameTransmissionFailed ( Ieee80211DataOrMgmtFrame protectedFrame,
StationRetryCounters stationCounters 
)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed(), and inet::ieee80211::Hcf::originatorProcessRtsProtectionFailed().

175 {
176  incrementStationSrc(stationCounters);
177  incrementCounter(protectedFrame, shortRetryCounter);
178 }
std::map< SequenceControlField, int > shortRetryCounter
Definition: NonQoSRecoveryProcedure.h:41
virtual void incrementCounter(Ieee80211DataOrMgmtFrame *frame, std::map< SequenceControlField, int > &retryCounter)
Definition: NonQoSRecoveryProcedure.cc:66
virtual void incrementStationSrc(StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:48

Member Data Documentation

ICwCalculator* inet::ieee80211::NonQoSRecoveryProcedure::cwCalculator = nullptr
protected
std::map<SequenceControlField, int> inet::ieee80211::NonQoSRecoveryProcedure::longRetryCounter
protected
int inet::ieee80211::NonQoSRecoveryProcedure::longRetryLimit = -1
protected
int inet::ieee80211::NonQoSRecoveryProcedure::rtsThreshold = -1
protected
int inet::ieee80211::NonQoSRecoveryProcedure::shortRetryLimit = -1
protected

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