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

Implements IEEE 802.11 Distributed Coordination Function. More...

#include <Dcf.h>

Inheritance diagram for inet::ieee80211::Dcf:
inet::ieee80211::ICoordinationFunction inet::ieee80211::IFrameSequenceHandler::ICallback inet::ieee80211::IChannelAccess::ICallback inet::ieee80211::ITx::ICallback inet::ieee80211::IProcedureCallback inet::ieee80211::ModeSetListener

Public Member Functions

virtual ~Dcf ()
 
virtual void processUpperFrame (Ieee80211DataOrMgmtFrame *frame) override
 
virtual void processLowerFrame (Ieee80211Frame *frame) override
 
virtual void corruptedFrameReceived () override
 
- Public Member Functions inherited from inet::ieee80211::ICoordinationFunction
virtual ~ICoordinationFunction ()
 
- Public Member Functions inherited from inet::ieee80211::IFrameSequenceHandler::ICallback
virtual ~ICallback ()
 
- Public Member Functions inherited from inet::ieee80211::IChannelAccess::ICallback
virtual ~ICallback ()
 
- Public Member Functions inherited from inet::ieee80211::ITx::ICallback
virtual ~ICallback ()
 
- Public Member Functions inherited from inet::ieee80211::IProcedureCallback
virtual ~IProcedureCallback ()
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void sendUp (const std::vector< Ieee80211Frame * > &completeFrames)
 
virtual bool hasFrameToTransmit ()
 
virtual bool isReceptionInProgress ()
 
virtual FrameSequenceContextbuildContext ()
 
virtual void recipientProcessReceivedFrame (Ieee80211Frame *frame)
 
virtual void recipientProcessControlFrame (Ieee80211Frame *frame)
 
virtual void recipientProcessTransmittedControlResponseFrame (Ieee80211Frame *frame)
 
virtual void channelGranted (IChannelAccess *channelAccess) override
 
virtual void transmitFrame (Ieee80211Frame *frame, simtime_t ifs) override
 
virtual void originatorProcessRtsProtectionFailed (Ieee80211DataOrMgmtFrame *protectedFrame) override
 
virtual void originatorProcessTransmittedFrame (Ieee80211Frame *transmittedFrame) override
 
virtual void originatorProcessReceivedFrame (Ieee80211Frame *frame, Ieee80211Frame *lastTransmittedFrame) override
 
virtual void originatorProcessFailedFrame (Ieee80211DataOrMgmtFrame *failedFrame) override
 
virtual void frameSequenceFinished () override
 
virtual void scheduleStartRxTimer (simtime_t timeout) override
 
virtual void transmissionComplete (Ieee80211Frame *frame) override
 
virtual void transmitControlResponseFrame (Ieee80211Frame *responseFrame, Ieee80211Frame *receivedFrame) override
 
virtual void processMgmtFrame (Ieee80211ManagementFrame *mgmtFrame) override
 
virtual bool isSentByUs (Ieee80211Frame *frame) const
 
virtual bool isForUs (Ieee80211Frame *frame) const
 
- Protected Member Functions inherited from inet::ieee80211::ModeSetListener
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 

Protected Attributes

Ieee80211Macmac = nullptr
 
IRateControldataAndMgmtRateControl = nullptr
 
cMessage * startRxTimer = nullptr
 
IRxrx = nullptr
 
ITxtx = nullptr
 
IRateSelectionrateSelection = nullptr
 
DcafdcfChannelAccess = nullptr
 
IOriginatorMacDataServiceoriginatorDataService = nullptr
 
IRecipientMacDataServicerecipientDataService = nullptr
 
AckHandlerackHandler = nullptr
 
IOriginatorAckPolicyoriginatorAckPolicy = nullptr
 
IRecipientAckProcedurerecipientAckProcedure = nullptr
 
IRecipientAckPolicyrecipientAckPolicy = nullptr
 
IRtsProcedurertsProcedure = nullptr
 
IRtsPolicyrtsPolicy = nullptr
 
ICtsProcedurectsProcedure = nullptr
 
ICtsPolicyctsPolicy = nullptr
 
NonQoSRecoveryProcedurerecoveryProcedure = nullptr
 
ITransmitLifetimeHandlertransmitLifetimeHandler = nullptr
 
DcfReceiveLifetimeHandlerreceiveLifetimeHandler = nullptr
 
OriginatorProtectionMechanismoriginatorProtectionMechanism = nullptr
 
PendingQueuependingQueue = nullptr
 
InProgressFramesinProgressFrames = nullptr
 
IFrameSequenceHandlerframeSequenceHandler = nullptr
 
StationRetryCountersstationRetryCounters = nullptr
 
- Protected Attributes inherited from inet::ieee80211::ModeSetListener
Ieee80211ModeSetmodeSet = nullptr
 

Detailed Description

Implements IEEE 802.11 Distributed Coordination Function.

Constructor & Destructor Documentation

inet::ieee80211::Dcf::~Dcf ( )
virtual
324 {
325  cancelAndDelete(startRxTimer);
326  delete rtsProcedure;
327  delete recipientAckProcedure;
328  delete ackHandler;
329  delete stationRetryCounters;
330  delete ctsProcedure;
331  delete frameSequenceHandler;
332  delete inProgressFrames;
333  delete pendingQueue;
334 }
IRecipientAckProcedure * recipientAckProcedure
Definition: Dcf.h:75
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
AckHandler * ackHandler
Definition: Dcf.h:73
cMessage * startRxTimer
Definition: Dcf.h:57
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
PendingQueue * pendingQueue
Definition: Dcf.h:91
ICtsProcedure * ctsProcedure
Definition: Dcf.h:79
IRtsProcedure * rtsProcedure
Definition: Dcf.h:77
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95

Member Function Documentation

FrameSequenceContext * inet::ieee80211::Dcf::buildContext ( )
protectedvirtual

Referenced by channelGranted().

206 {
207  auto nonQoSContext = new NonQoSContext(originatorAckPolicy);
208  return new FrameSequenceContext(mac->getAddress(), modeSet, inProgressFrames, rtsProcedure, rtsPolicy, nonQoSContext, nullptr);
209 }
IOriginatorAckPolicy * originatorAckPolicy
Definition: Dcf.h:74
Definition: FrameSequenceContext.h:53
virtual const MACAddress & getAddress() const
Definition: Ieee80211Mac.h:102
Ieee80211Mac * mac
Definition: Dcf.h:54
IRtsPolicy * rtsPolicy
Definition: Dcf.h:78
Ieee80211ModeSet * modeSet
Definition: ModeSetListener.h:31
Definition: FrameSequenceContext.h:63
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
IRtsProcedure * rtsProcedure
Definition: Dcf.h:77
void inet::ieee80211::Dcf::channelGranted ( IChannelAccess channelAccess)
overrideprotectedvirtual

Implements inet::ieee80211::IChannelAccess::ICallback.

71 {
72  ASSERT(dcfChannelAccess == channelAccess);
75 }
Definition: DcfFs.h:26
virtual void startFrameSequence(IFrameSequence *frameSequence, FrameSequenceContext *context, ICallback *callback)=0
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
virtual FrameSequenceContext * buildContext()
Definition: Dcf.cc:205
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
void inet::ieee80211::Dcf::corruptedFrameReceived ( )
overridevirtual

Implements inet::ieee80211::ICoordinationFunction.

Referenced by inet::ieee80211::Ieee80211Mac::handleLowerPacket().

316 {
318  if (!startRxTimer->isScheduled())
320  }
321 }
cMessage * startRxTimer
Definition: Dcf.h:57
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
void inet::ieee80211::Dcf::frameSequenceFinished ( )
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

164 {
166  if (hasFrameToTransmit())
168  mac->sendDownPendingRadioConfigMsg(); // TODO: review
169 }
virtual void sendDownPendingRadioConfigMsg()
Definition: Ieee80211Mac.cc:223
Ieee80211Mac * mac
Definition: Dcf.h:54
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
virtual void releaseChannel(IChannelAccess::ICallback *callback) override
Definition: Dcaf.cc:88
virtual bool hasFrameToTransmit()
Definition: Dcf.cc:220
virtual void requestChannel(IChannelAccess::ICallback *callback) override
Definition: Dcaf.cc:95
void inet::ieee80211::Dcf::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
61 {
62  if (msg == startRxTimer) {
63  if (!isReceptionInProgress())
65  }
66  else
67  throw cRuntimeError("Unknown msg type");
68 }
cMessage * startRxTimer
Definition: Dcf.h:57
virtual bool isReceptionInProgress()
Definition: Dcf.cc:171
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
bool inet::ieee80211::Dcf::hasFrameToTransmit ( )
protectedvirtual

Referenced by frameSequenceFinished().

221 {
222  return !pendingQueue->isEmpty() || inProgressFrames->hasInProgressFrames();
223 }
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
PendingQueue * pendingQueue
Definition: Dcf.h:91
virtual bool hasInProgressFrames()
Definition: InProgressFrames.h:56
void inet::ieee80211::Dcf::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

31 {
33  if (stage == INITSTAGE_LINK_LAYER_2) {
34  startRxTimer = new cMessage("startRxTimeout");
35  mac = check_and_cast<Ieee80211Mac *>(getContainingNicModule(this)->getSubmodule("mac"));
36  dataAndMgmtRateControl = dynamic_cast<IRateControl *>(getSubmodule(("rateControl")));
37  tx = check_and_cast<ITx *>(getModuleByPath(par("txModule")));
38  rx = check_and_cast<IRx *>(getModuleByPath(par("rxModule")));
39  dcfChannelAccess = check_and_cast<Dcaf *>(getSubmodule("channelAccess"));
40  originatorDataService = check_and_cast<IOriginatorMacDataService *>(getSubmodule(("originatorMacDataService")));
41  recipientDataService = check_and_cast<IRecipientMacDataService*>(getSubmodule("recipientMacDataService"));
42  recoveryProcedure = check_and_cast<NonQoSRecoveryProcedure *>(getSubmodule("recoveryProcedure"));
43  rateSelection = check_and_cast<IRateSelection*>(getSubmodule("rateSelection"));
45  rtsProcedure = new RtsProcedure();
46  rtsPolicy = check_and_cast<IRtsPolicy *>(getSubmodule("rtsPolicy"));
48  recipientAckPolicy = check_and_cast<IRecipientAckPolicy *>(getSubmodule("recipientAckPolicy"));
49  originatorAckPolicy = check_and_cast<IOriginatorAckPolicy *>(getSubmodule("originatorAckPolicy"));
51  ackHandler = new AckHandler();
52  ctsProcedure = new CtsProcedure();
53  ctsPolicy = check_and_cast<ICtsPolicy *>(getSubmodule("ctsPolicy"));
55  inProgressFrames = new InProgressFrames(pendingQueue, originatorDataService, ackHandler);
56  originatorProtectionMechanism = check_and_cast<OriginatorProtectionMechanism*>(getSubmodule("originatorProtectionMechanism"));
57  }
58 }
Definition: IRtsPolicy.h:26
Definition: InProgressFrames.h:30
Definition: IOriginatorAckPolicy.h:26
IRecipientAckProcedure * recipientAckProcedure
Definition: Dcf.h:75
IOriginatorAckPolicy * originatorAckPolicy
Definition: Dcf.h:74
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
ITx * tx
Definition: Dcf.h:61
Definition: IRecipientAckPolicy.h:26
Abstract interface for unconditionally transmitting a frame immediately or after waiting for a specif...
Definition: ITx.h:33
IRx * rx
Definition: Dcf.h:60
Definition: IOriginatorMacDataService.h:26
Ieee80211Mac * mac
Definition: Dcf.h:54
IRtsPolicy * rtsPolicy
Definition: Dcf.h:78
IRecipientAckPolicy * recipientAckPolicy
Definition: Dcf.h:76
Abstract interface for Rx processes.
Definition: IRx.h:45
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
Abstract interface for rate selection.
Definition: IRateSelection.h:36
Definition: Ieee80211Queue.h:53
AckHandler * ackHandler
Definition: Dcf.h:73
IRateControl * dataAndMgmtRateControl
Definition: Dcf.h:55
Implements the IEEE 802.11 MAC.
Definition: Ieee80211Mac.h:47
cMessage * startRxTimer
Definition: Dcf.h:57
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
Definition: NonQoSRecoveryProcedure.h:35
Definition: ICtsPolicy.h:26
PendingQueue * pendingQueue
Definition: Dcf.h:91
OriginatorProtectionMechanism * originatorProtectionMechanism
Definition: Dcf.h:88
cModule * getContainingNicModule(cModule *from)
Find the nic module (inside the networkNode) containing the given module.
Definition: ModuleAccess.cc:96
virtual void initialize(int stage) override
Definition: ModeSetListener.cc:25
NonQoSRecoveryProcedure * recoveryProcedure
Definition: Dcf.h:81
IRateSelection * rateSelection
Definition: Dcf.h:63
Abstract interface for auto rate control algorithms.
Definition: IRateControl.h:35
Definition: RecipientAckProcedure.h:29
Definition: OriginatorProtectionMechanism.h:28
ICtsProcedure * ctsProcedure
Definition: Dcf.h:79
IOriginatorMacDataService * originatorDataService
Definition: Dcf.h:69
Definition: RtsProcedure.h:26
Definition: CtsProcedure.h:29
Definition: FrameSequenceHandler.h:28
Definition: StationRetryCounters.h:26
IRtsProcedure * rtsProcedure
Definition: Dcf.h:77
Additional link-layer initializations that depend on the previous stage.
Definition: InitStages.h:64
ICtsPolicy * ctsPolicy
Definition: Dcf.h:80
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
IRecipientMacDataService * recipientDataService
Definition: Dcf.h:70
Definition: IRecipientMacDataService.h:26
Definition: AckHandler.h:28
Definition: Dcaf.h:29
bool inet::ieee80211::Dcf::isForUs ( Ieee80211Frame frame) const
protectedvirtual

Referenced by processLowerFrame().

300 {
301  return frame->getReceiverAddress() == mac->getAddress() || (frame->getReceiverAddress().isMulticast() && !isSentByUs(frame));
302 }
virtual MACAddress & getReceiverAddress()
virtual const MACAddress & getAddress() const
Definition: Ieee80211Mac.h:102
Ieee80211Mac * mac
Definition: Dcf.h:54
bool isMulticast() const
Returns true if this is a multicast logical address (first byte&#39;s lsb is 1).
Definition: MACAddress.h:146
virtual bool isSentByUs(Ieee80211Frame *frame) const
Definition: Dcf.cc:304
bool inet::ieee80211::Dcf::isReceptionInProgress ( )
protectedvirtual

Referenced by handleMessage().

172 {
173  return rx->isReceptionInProgress();
174 }
IRx * rx
Definition: Dcf.h:60
virtual bool isReceptionInProgress() const =0
bool inet::ieee80211::Dcf::isSentByUs ( Ieee80211Frame frame) const
protectedvirtual

Referenced by isForUs().

305 {
306  // FIXME:
307  // Check the roles of the Addr3 field when aggregation is applied
308  // Table 8-19—Address field contents
309  if (auto dataOrMgmtFrame = dynamic_cast<Ieee80211DataOrMgmtFrame *>(frame))
310  return dataOrMgmtFrame->getAddress3() == mac->getAddress();
311  else
312  return false;
313 }
virtual const MACAddress & getAddress() const
Definition: Ieee80211Mac.h:102
Ieee80211Mac * mac
Definition: Dcf.h:54
virtual int inet::ieee80211::Dcf::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

102 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::Dcf::originatorProcessFailedFrame ( Ieee80211DataOrMgmtFrame failedFrame)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

278 {
279  ASSERT(failedFrame->getType() != ST_DATA_WITH_QOS);
281  EV_INFO << "Data/Mgmt frame transmission failed\n";
283  bool retryLimitReached = recoveryProcedure->isRetryLimitReached(failedFrame);
285  int retryCount = recoveryProcedure->getRetryCount(failedFrame);
286  dataAndMgmtRateControl->frameTransmitted(failedFrame, retryCount, false, retryLimitReached);
287  }
288  ackHandler->processFailedFrame(failedFrame);
289  if (retryLimitReached) {
290  emit(NF_LINK_BREAK, failedFrame);
291  recoveryProcedure->retryLimitReached(failedFrame);
292  inProgressFrames->dropFrame(failedFrame);
293  emit(NF_PACKET_DROP, failedFrame);
294  }
295  else
296  failedFrame->setRetry(true);
297 }
virtual bool isRetryLimitReached(Ieee80211DataOrMgmtFrame *failedFrame)
Definition: NonQoSRecoveryProcedure.cc:186
virtual void dropFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: InProgressFrames.cc:89
simsignal_t NF_LINK_BREAK
Definition: NotifierConsts.cc:43
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
virtual int getRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:195
virtual short getType() const
virtual void retryLimitReached(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:135
Definition: Ieee80211Frame_m.h:117
virtual void dataOrMgmtFrameTransmissionFailed(Ieee80211DataOrMgmtFrame *failedFrame, StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:159
virtual void processFailedFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: AckHandler.cc:89
AckHandler * ackHandler
Definition: Dcf.h:73
virtual void frameTransmitted(const Ieee80211Frame *frame, int retryCount, bool isSuccessful, bool isGivenUp)=0
IRateControl * dataAndMgmtRateControl
Definition: Dcf.h:55
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
simsignal_t NF_PACKET_DROP
Definition: NotifierConsts.cc:33
NonQoSRecoveryProcedure * recoveryProcedure
Definition: Dcf.h:81
virtual Status & getAckStatus(SequenceControlField id)
Definition: AckHandler.cc:23
virtual void setRetry(bool retry)
void inet::ieee80211::Dcf::originatorProcessReceivedFrame ( Ieee80211Frame frame,
Ieee80211Frame lastTransmittedFrame 
)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

258 {
259  if (frame->getType() == ST_ACK) {
260  auto lastTransmittedDataOrMgmtFrame = check_and_cast<Ieee80211DataOrMgmtFrame*>(lastTransmittedFrame);
262  int retryCount = lastTransmittedFrame->getRetry() ? recoveryProcedure->getRetryCount(lastTransmittedDataOrMgmtFrame) : 0;
263  dataAndMgmtRateControl->frameTransmitted(frame, retryCount, true, false);
264  }
265  recoveryProcedure->ackFrameReceived(lastTransmittedDataOrMgmtFrame, stationRetryCounters);
266  ackHandler->processReceivedAck(check_and_cast<Ieee80211ACKFrame *>(frame), lastTransmittedDataOrMgmtFrame);
267  inProgressFrames->dropFrame(lastTransmittedDataOrMgmtFrame);
268  }
269  else if (frame->getType() == ST_RTS)
270  ; // void
271  else if (frame->getType() == ST_CTS)
273  else
274  throw cRuntimeError("Unknown frame type");
275 }
virtual void dropFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: InProgressFrames.cc:89
virtual bool getRetry() const
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
virtual int getRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:195
virtual short getType() const
Class generated from inet/linklayer/ieee80211/mac/Ieee80211Frame.msg:166 by nedtool.
Definition: Ieee80211Frame_m.h:438
virtual void ackFrameReceived(Ieee80211DataOrMgmtFrame *ackedFrame, StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:108
Definition: Ieee80211Frame_m.h:113
AckHandler * ackHandler
Definition: Dcf.h:73
virtual void frameTransmitted(const Ieee80211Frame *frame, int retryCount, bool isSuccessful, bool isGivenUp)=0
IRateControl * dataAndMgmtRateControl
Definition: Dcf.h:55
virtual void ctsFrameReceived(StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:96
Definition: Ieee80211Frame_m.h:112
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
Definition: Ieee80211Frame_m.h:111
NonQoSRecoveryProcedure * recoveryProcedure
Definition: Dcf.h:81
virtual void processReceivedAck(Ieee80211ACKFrame *ack, Ieee80211DataOrMgmtFrame *ackedFrame)
Definition: AckHandler.cc:44
void inet::ieee80211::Dcf::originatorProcessRtsProtectionFailed ( Ieee80211DataOrMgmtFrame protectedFrame)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

226 {
227  EV_INFO << "RTS frame transmission failed\n";
229  EV_INFO << "For the current frame exchange, we have CW = " << dcfChannelAccess->getCw() << " SRC = " << recoveryProcedure->getShortRetryCount(protectedFrame) << " LRC = " << recoveryProcedure->getLongRetryCount(protectedFrame) << " SSRC = " << stationRetryCounters->getStationShortRetryCount() << " and SLRC = " << stationRetryCounters->getStationLongRetryCount() << std::endl;
230  if (recoveryProcedure->isRtsFrameRetryLimitReached(protectedFrame)) {
231  emit(NF_LINK_BREAK, protectedFrame);
232  recoveryProcedure->retryLimitReached(protectedFrame);
233  inProgressFrames->dropFrame(protectedFrame);
234  emit(NF_PACKET_DROP, protectedFrame);
235  }
236 }
virtual void dropFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: InProgressFrames.cc:89
virtual void rtsFrameTransmissionFailed(Ieee80211DataOrMgmtFrame *protectedFrame, StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:174
simsignal_t NF_LINK_BREAK
Definition: NotifierConsts.cc:43
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
int getStationLongRetryCount() const
Definition: StationRetryCounters.h:33
virtual void retryLimitReached(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:135
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
virtual int getLongRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:209
virtual bool isRtsFrameRetryLimitReached(Ieee80211DataOrMgmtFrame *protectedFrame)
Definition: NonQoSRecoveryProcedure.cc:219
virtual int getCw()
Definition: Dcaf.h:68
int getStationShortRetryCount() const
Definition: StationRetryCounters.h:34
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
simsignal_t NF_PACKET_DROP
Definition: NotifierConsts.cc:33
NonQoSRecoveryProcedure * recoveryProcedure
Definition: Dcf.h:81
virtual int getShortRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:204
void inet::ieee80211::Dcf::originatorProcessTransmittedFrame ( Ieee80211Frame transmittedFrame)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

239 {
240  if (auto dataOrMgmtFrame = dynamic_cast<Ieee80211DataOrMgmtFrame *>(transmittedFrame)) {
241  EV_INFO << "For the current frame exchange, we have CW = " << dcfChannelAccess->getCw() << " SRC = " << recoveryProcedure->getShortRetryCount(dataOrMgmtFrame) << " LRC = " << recoveryProcedure->getLongRetryCount(dataOrMgmtFrame) << " SSRC = " << stationRetryCounters->getStationShortRetryCount() << " and SLRC = " << stationRetryCounters->getStationLongRetryCount() << std::endl;
242  if (originatorAckPolicy->isAckNeeded(dataOrMgmtFrame)) {
244  }
245  else if (dataOrMgmtFrame->getReceiverAddress().isMulticast()) {
247  inProgressFrames->dropFrame(dataOrMgmtFrame);
248  }
249  }
250  else if (auto rtsFrame = dynamic_cast<Ieee80211RTSFrame *>(transmittedFrame)) {
251  auto protectedFrame = inProgressFrames->getFrameToTransmit(); // TODO: kludge
252  EV_INFO << "For the current frame exchange, we have CW = " << dcfChannelAccess->getCw() << " SRC = " << recoveryProcedure->getShortRetryCount(protectedFrame) << " LRC = " << recoveryProcedure->getLongRetryCount(protectedFrame) << " SSRC = " << stationRetryCounters->getStationShortRetryCount() << " and SLRC = " << stationRetryCounters->getStationLongRetryCount() << std::endl;
254  }
255 }
virtual void dropFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: InProgressFrames.cc:89
IOriginatorAckPolicy * originatorAckPolicy
Definition: Dcf.h:74
StationRetryCounters * stationRetryCounters
Definition: Dcf.h:98
int getStationLongRetryCount() const
Definition: StationRetryCounters.h:33
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
virtual bool isAckNeeded(Ieee80211DataOrMgmtFrame *frame) const =0
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
virtual int getLongRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:209
AckHandler * ackHandler
Definition: Dcf.h:73
virtual int getCw()
Definition: Dcaf.h:68
int getStationShortRetryCount() const
Definition: StationRetryCounters.h:34
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
NonQoSRecoveryProcedure * recoveryProcedure
Definition: Dcf.h:81
virtual void multicastFrameTransmitted(StationRetryCounters *stationCounters)
Definition: NonQoSRecoveryProcedure.cc:80
virtual int getShortRetryCount(Ieee80211DataOrMgmtFrame *frame)
Definition: NonQoSRecoveryProcedure.cc:204
IRtsProcedure * rtsProcedure
Definition: Dcf.h:77
virtual void processTransmittedRts(Ieee80211RTSFrame *rtsFrame)=0
virtual void processTransmittedDataOrMgmtFrame(Ieee80211DataOrMgmtFrame *frame)
Definition: AckHandler.cc:53
void inet::ieee80211::Dcf::processLowerFrame ( Ieee80211Frame frame)
overridevirtual

Implements inet::ieee80211::ICoordinationFunction.

Referenced by inet::ieee80211::Ieee80211Mac::processLowerFrame().

129 {
130  Enter_Method_Silent();
132  // TODO: always call processResponses
133  if ((!isForUs(frame) && !startRxTimer->isScheduled()) || isForUs(frame)) {
135  }
136  else {
137  EV_INFO << "This frame is not for us" << std::endl;
138  delete frame;
139  }
140  cancelEvent(startRxTimer);
141  }
142  else if (isForUs(frame))
144  else {
145  EV_INFO << "This frame is not for us" << std::endl;
146  delete frame;
147  }
148 }
virtual bool isForUs(Ieee80211Frame *frame) const
Definition: Dcf.cc:299
cMessage * startRxTimer
Definition: Dcf.h:57
virtual void recipientProcessReceivedFrame(Ieee80211Frame *frame)
Definition: Dcf.cc:176
virtual void processResponse(Ieee80211Frame *frame)=0
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
void inet::ieee80211::Dcf::processMgmtFrame ( Ieee80211ManagementFrame mgmtFrame)
overrideprotectedvirtual

Implements inet::ieee80211::IProcedureCallback.

108 {
109  throw cRuntimeError("Unknown management frame");
110 }
void inet::ieee80211::Dcf::processUpperFrame ( Ieee80211DataOrMgmtFrame frame)
overridevirtual

Implements inet::ieee80211::ICoordinationFunction.

Referenced by inet::ieee80211::Ieee80211Mac::processUpperFrame().

78 {
79  Enter_Method("processUpperFrame(%s)", frame->getName());
80  EV_INFO << "Processing upper frame: " << frame->getName() << endl;
81  if (pendingQueue->insert(frame)) {
82  EV_INFO << "Frame " << frame->getName() << " has been inserted into the PendingQueue." << endl;
83  EV_DETAIL << "Requesting channel" << endl;
85  }
86  else {
87  EV_INFO << "Frame " << frame->getName() << " has been dropped because the PendingQueue is full." << endl;
88  emit(NF_PACKET_DROP, frame);
89  delete frame;
90  }
91 }
Dcaf * dcfChannelAccess
Definition: Dcf.h:66
PendingQueue * pendingQueue
Definition: Dcf.h:91
simsignal_t NF_PACKET_DROP
Definition: NotifierConsts.cc:33
virtual void requestChannel(IChannelAccess::ICallback *callback) override
Definition: Dcaf.cc:95
virtual bool insert(Ieee80211DataOrMgmtFrame *frame)
Definition: Ieee80211Queue.cc:29
void inet::ieee80211::Dcf::recipientProcessControlFrame ( Ieee80211Frame frame)
protectedvirtual

Referenced by recipientProcessReceivedFrame().

198 {
199  if (auto rtsFrame = dynamic_cast<Ieee80211RTSFrame *>(frame))
200  ctsProcedure->processReceivedRts(rtsFrame, ctsPolicy, this);
201  else
202  throw cRuntimeError("Unknown control frame");
203 }
virtual void processReceivedRts(Ieee80211RTSFrame *rtsFrame, ICtsPolicy *ctsPolicy, IProcedureCallback *callback)=0
ICtsProcedure * ctsProcedure
Definition: Dcf.h:79
ICtsPolicy * ctsPolicy
Definition: Dcf.h:80
void inet::ieee80211::Dcf::recipientProcessReceivedFrame ( Ieee80211Frame frame)
protectedvirtual

Referenced by processLowerFrame().

177 {
178  if (auto dataOrMgmtFrame = dynamic_cast<Ieee80211DataOrMgmtFrame *>(frame))
180  if (auto dataFrame = dynamic_cast<Ieee80211DataFrame*>(frame))
182  else if (auto mgmtFrame = dynamic_cast<Ieee80211ManagementFrame*>(frame))
184  else { // TODO: else if (auto ctrlFrame = dynamic_cast<Ieee80211ControlFrame*>(frame))
187  delete frame;
188  }
189 }
virtual std::vector< Ieee80211Frame * > controlFrameReceived(Ieee80211Frame *controlFrame)=0
IRecipientAckProcedure * recipientAckProcedure
Definition: Dcf.h:75
virtual void recipientProcessControlFrame(Ieee80211Frame *frame)
Definition: Dcf.cc:197
IRecipientAckPolicy * recipientAckPolicy
Definition: Dcf.h:76
virtual std::vector< Ieee80211Frame * > dataFrameReceived(Ieee80211DataFrame *dataFrame)=0
virtual void sendUp(const std::vector< Ieee80211Frame * > &completeFrames)
Definition: Dcf.cc:191
virtual void processReceivedFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame, IRecipientAckPolicy *ackPolicy, IProcedureCallback *callback)=0
IRecipientMacDataService * recipientDataService
Definition: Dcf.h:70
virtual std::vector< Ieee80211Frame * > managementFrameReceived(Ieee80211ManagementFrame *mgmtFrame)=0
void inet::ieee80211::Dcf::recipientProcessTransmittedControlResponseFrame ( Ieee80211Frame frame)
protectedvirtual

Referenced by transmissionComplete().

113 {
114  if (auto ctsFrame = dynamic_cast<Ieee80211CTSFrame*>(frame))
116  else if (auto ackFrame = dynamic_cast<Ieee80211ACKFrame*>(frame))
118  else
119  throw cRuntimeError("Unknown control response frame");
120 }
IRecipientAckProcedure * recipientAckProcedure
Definition: Dcf.h:75
ICtsProcedure * ctsProcedure
Definition: Dcf.h:79
virtual void processTransmittedCts(Ieee80211CTSFrame *ctsFrame)=0
virtual void processTransmittedAck(Ieee80211ACKFrame *ack)=0
void inet::ieee80211::Dcf::scheduleStartRxTimer ( simtime_t  timeout)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

123 {
124  Enter_Method_Silent();
125  scheduleAt(simTime() + timeout, startRxTimer);
126 }
cMessage * startRxTimer
Definition: Dcf.h:57
void inet::ieee80211::Dcf::sendUp ( const std::vector< Ieee80211Frame * > &  completeFrames)
protectedvirtual

Referenced by recipientProcessReceivedFrame().

192 {
193  for (auto frame : completeFrames)
194  mac->sendUp(frame);
195 }
virtual void sendUp(cMessage *message) override
Definition: Ieee80211Mac.cc:208
Ieee80211Mac * mac
Definition: Dcf.h:54
void inet::ieee80211::Dcf::transmissionComplete ( Ieee80211Frame frame)
overrideprotectedvirtual

Implements inet::ieee80211::ITx::ICallback.

212 {
215  else
217  delete frame;
218 }
virtual void recipientProcessTransmittedControlResponseFrame(Ieee80211Frame *frame)
Definition: Dcf.cc:112
IFrameSequenceHandler * frameSequenceHandler
Definition: Dcf.h:95
void inet::ieee80211::Dcf::transmitControlResponseFrame ( Ieee80211Frame responseFrame,
Ieee80211Frame receivedFrame 
)
overrideprotectedvirtual

Implements inet::ieee80211::IProcedureCallback.

94 {
95  const IIeee80211Mode *responseMode = nullptr;
96  if (auto rtsFrame = dynamic_cast<Ieee80211RTSFrame*>(receivedFrame))
97  responseMode = rateSelection->computeResponseCtsFrameMode(rtsFrame);
98  else if (auto dataOrMgmtFrame = dynamic_cast<Ieee80211DataOrMgmtFrame*>(receivedFrame))
99  responseMode = rateSelection->computeResponseAckFrameMode(dataOrMgmtFrame);
100  else
101  throw cRuntimeError("Unknown received frame type");
102  RateSelection::setFrameMode(responseFrame, responseMode);
103  tx->transmitFrame(responseFrame, modeSet->getSifsTime(), this);
104  delete responseFrame;
105 }
ITx * tx
Definition: Dcf.h:61
virtual const IIeee80211Mode * computeResponseCtsFrameMode(Ieee80211RTSFrame *rtsFrame)=0
virtual void transmitFrame(Ieee80211Frame *frame, ITx::ICallback *txCallback)=0
static void setFrameMode(Ieee80211Frame *frame, const IIeee80211Mode *mode)
Definition: RateSelection.cc:169
Ieee80211ModeSet * modeSet
Definition: ModeSetListener.h:31
simtime_t getSifsTime() const
Definition: Ieee80211ModeSet.h:77
IRateSelection * rateSelection
Definition: Dcf.h:63
Definition: IIeee80211Mode.h:54
virtual const IIeee80211Mode * computeResponseAckFrameMode(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)=0
void inet::ieee80211::Dcf::transmitFrame ( Ieee80211Frame frame,
simtime_t  ifs 
)
overrideprotectedvirtual

Implements inet::ieee80211::IFrameSequenceHandler::ICallback.

151 {
154  tx->transmitFrame(frame, ifs, this);
155 }
ITx * tx
Definition: Dcf.h:61
virtual const IIeee80211Mode * computeMode(Ieee80211Frame *frame)=0
virtual void transmitFrame(Ieee80211Frame *frame, ITx::ICallback *txCallback)=0
static void setFrameMode(Ieee80211Frame *frame, const IIeee80211Mode *mode)
Definition: RateSelection.cc:169
virtual simtime_t computeDurationField(Ieee80211Frame *frame, Ieee80211DataOrMgmtFrame *pendingFrame)
Definition: OriginatorProtectionMechanism.cc:102
virtual Ieee80211DataOrMgmtFrame * getPendingFrameFor(Ieee80211Frame *frame)
Definition: InProgressFrames.cc:62
InProgressFrames * inProgressFrames
Definition: Dcf.h:92
OriginatorProtectionMechanism * originatorProtectionMechanism
Definition: Dcf.h:88
IRateSelection * rateSelection
Definition: Dcf.h:63
virtual void setDuration(::omnetpp::simtime_t duration)

Member Data Documentation

AckHandler* inet::ieee80211::Dcf::ackHandler = nullptr
protected
ICtsPolicy* inet::ieee80211::Dcf::ctsPolicy = nullptr
protected
ICtsProcedure* inet::ieee80211::Dcf::ctsProcedure = nullptr
protected
IRateControl* inet::ieee80211::Dcf::dataAndMgmtRateControl = nullptr
protected
IFrameSequenceHandler* inet::ieee80211::Dcf::frameSequenceHandler = nullptr
protected
Ieee80211Mac* inet::ieee80211::Dcf::mac = nullptr
protected
IOriginatorAckPolicy* inet::ieee80211::Dcf::originatorAckPolicy = nullptr
protected
IOriginatorMacDataService* inet::ieee80211::Dcf::originatorDataService = nullptr
protected

Referenced by initialize().

OriginatorProtectionMechanism* inet::ieee80211::Dcf::originatorProtectionMechanism = nullptr
protected

Referenced by initialize(), and transmitFrame().

PendingQueue* inet::ieee80211::Dcf::pendingQueue = nullptr
protected
IRateSelection* inet::ieee80211::Dcf::rateSelection = nullptr
protected
DcfReceiveLifetimeHandler* inet::ieee80211::Dcf::receiveLifetimeHandler = nullptr
protected
IRecipientAckPolicy* inet::ieee80211::Dcf::recipientAckPolicy = nullptr
protected
IRecipientAckProcedure* inet::ieee80211::Dcf::recipientAckProcedure = nullptr
protected
IRecipientMacDataService* inet::ieee80211::Dcf::recipientDataService = nullptr
protected
IRtsPolicy* inet::ieee80211::Dcf::rtsPolicy = nullptr
protected

Referenced by buildContext(), and initialize().

IRtsProcedure* inet::ieee80211::Dcf::rtsProcedure = nullptr
protected
IRx* inet::ieee80211::Dcf::rx = nullptr
protected
cMessage* inet::ieee80211::Dcf::startRxTimer = nullptr
protected
ITransmitLifetimeHandler* inet::ieee80211::Dcf::transmitLifetimeHandler = nullptr
protected
ITx* inet::ieee80211::Dcf::tx = nullptr
protected

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