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

#include <PrimitiveFrameSequences.h>

Inheritance diagram for inet::ieee80211::RtsCtsFs:
inet::ieee80211::IFrameSequence

Public Member Functions

virtual void startSequence (FrameSequenceContext *context, int firstStep) override
 
virtual IFrameSequenceStepprepareStep (FrameSequenceContext *context) override
 
virtual bool completeStep (FrameSequenceContext *context) override
 
virtual std::string getHistory () override
 
- Public Member Functions inherited from inet::ieee80211::IFrameSequence
virtual ~IFrameSequence ()
 

Protected Attributes

int firstStep = -1
 
int step = -1
 

Member Function Documentation

bool inet::ieee80211::RtsCtsFs::completeStep ( FrameSequenceContext context)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

277 {
278  switch (step) {
279  case 0:
280  step++;
281  return true;
282  case 1: {
283  auto receiveStep = check_and_cast<IReceiveStep *>(context->getStep(firstStep + step));
284  step++;
285  auto receivedFrame = receiveStep->getReceivedFrame();
286  return context->isForUs(receivedFrame) && receivedFrame->getType() == ST_CTS;
287  }
288  default:
289  throw cRuntimeError("Unknown step");
290  }
291 }
Definition: IFrameSequence.h:59
int step
Definition: PrimitiveFrameSequences.h:97
virtual bool isForUs(Ieee80211Frame *frame) const
Definition: FrameSequenceContext.cc:49
virtual IFrameSequenceStep * getStep(int i) const
Definition: FrameSequenceContext.h:83
Definition: Ieee80211Frame_m.h:112
int firstStep
Definition: PrimitiveFrameSequences.h:96
virtual std::string inet::ieee80211::RtsCtsFs::getHistory ( )
inlineoverridevirtual

Implements inet::ieee80211::IFrameSequence.

104 { return std::string("RTS") + (step == 2 ? " CTS" : ""); } // TODO: completeStep = true?
int step
Definition: PrimitiveFrameSequences.h:97
IFrameSequenceStep * inet::ieee80211::RtsCtsFs::prepareStep ( FrameSequenceContext context)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

257 {
258  switch (step) {
259  case 0: {
260  auto dataOrMgmtFrame = check_and_cast<Ieee80211DataOrMgmtFrame *>(context->getInProgressFrames()->getFrameToTransmit());
261  auto rtsFrame = context->getRtsProcedure()->buildRtsFrame(dataOrMgmtFrame);
262  return new RtsTransmitStep(dataOrMgmtFrame, rtsFrame, context->getIfs());
263  }
264  case 1: {
265  auto txStep = check_and_cast<RtsTransmitStep *>(context->getLastStep());
266  auto rtsFrame = check_and_cast<Ieee80211RTSFrame*>(txStep->getFrameToTransmit());
267  return new ReceiveStep(context->getCtsTimeout(rtsFrame));
268  }
269  case 2:
270  return nullptr;
271  default:
272  throw cRuntimeError("Unknown step");
273  }
274 }
virtual IRtsProcedure * getRtsProcedure() const
Definition: FrameSequenceContext.h:88
virtual IFrameSequenceStep * getLastStep() const
Definition: FrameSequenceContext.h:84
int step
Definition: PrimitiveFrameSequences.h:97
Class generated from inet/linklayer/ieee80211/mac/Ieee80211Frame.msg:166 by nedtool.
Definition: Ieee80211Frame_m.h:438
virtual simtime_t getIfs() const
Definition: FrameSequenceContext.cc:34
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
Definition: FrameSequenceStep.h:60
Class generated from inet/linklayer/ieee80211/mac/Ieee80211Frame.msg:148 by nedtool.
Definition: Ieee80211Frame_m.h:358
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
virtual simtime_t getCtsTimeout(Ieee80211RTSFrame *rtsFrame) const
Definition: FrameSequenceContext.cc:44
Definition: FrameSequenceStep.h:46
virtual Ieee80211RTSFrame * buildRtsFrame(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame) const =0
void inet::ieee80211::RtsCtsFs::startSequence ( FrameSequenceContext context,
int  firstStep 
)
overridevirtual

Implements inet::ieee80211::IFrameSequence.

251 {
252  this->firstStep = firstStep;
253  step = 0;
254 }
int step
Definition: PrimitiveFrameSequences.h:97
int firstStep
Definition: PrimitiveFrameSequences.h:96

Member Data Documentation

int inet::ieee80211::RtsCtsFs::firstStep = -1
protected
int inet::ieee80211::RtsCtsFs::step = -1
protected

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