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

#include <RateSelection.h>

Inheritance diagram for inet::ieee80211::RateSelection:
inet::ieee80211::IRateSelection

Public Member Functions

virtual const IIeee80211ModecomputeResponseCtsFrameMode (Ieee80211RTSFrame *rtsFrame) override
 
virtual const IIeee80211ModecomputeResponseAckFrameMode (Ieee80211DataOrMgmtFrame *dataOrMgmtFrame) override
 
virtual const IIeee80211ModecomputeMode (Ieee80211Frame *frame) override
 
virtual void frameTransmitted (Ieee80211Frame *frame)
 
- Public Member Functions inherited from inet::ieee80211::IRateSelection
virtual ~IRateSelection ()
 

Static Public Member Functions

static void setFrameMode (Ieee80211Frame *frame, const IIeee80211Mode *mode)
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 
virtual const IIeee80211ModegetMode (Ieee80211Frame *frame)
 
virtual const IIeee80211ModecomputeControlFrameMode (Ieee80211Frame *frame)
 
virtual const IIeee80211ModecomputeDataOrMgmtFrameMode (Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
 

Protected Attributes

IRateControldataOrMgmtRateControl = nullptr
 
const IIeee80211ModefastestMandatoryMode = nullptr
 
const Ieee80211ModeSetmodeSet = nullptr
 
std::map< MACAddress, const IIeee80211Mode * > lastTransmittedFrameMode
 
const IIeee80211ModemulticastFrameMode = nullptr
 
const IIeee80211ModedataFrameMode = nullptr
 
const IIeee80211ModemgmtFrameMode = nullptr
 
const IIeee80211ModecontrolFrameMode = nullptr
 
const IIeee80211ModeresponseAckFrameMode = nullptr
 
const IIeee80211ModeresponseCtsFrameMode = nullptr
 

Member Function Documentation

const IIeee80211Mode * inet::ieee80211::RateSelection::computeControlFrameMode ( Ieee80211Frame frame)
protectedvirtual

Referenced by computeMode().

141 {
142  // TODO: BSSBasicRateSet
143  return fastestMandatoryMode;
144 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
const IIeee80211Mode * inet::ieee80211::RateSelection::computeDataOrMgmtFrameMode ( Ieee80211DataOrMgmtFrame dataOrMgmtFrame)
protectedvirtual

Referenced by computeMode().

121 {
122  if (dataOrMgmtFrame->getReceiverAddress().isMulticast() && multicastFrameMode)
123  return multicastFrameMode;
124  if (dynamic_cast<Ieee80211DataFrame*>(dataOrMgmtFrame) && dataFrameMode)
125  return dataFrameMode;
126  if (dynamic_cast<Ieee80211ManagementFrame*>(dataOrMgmtFrame) && mgmtFrameMode)
127  return mgmtFrameMode;
129  return dataOrMgmtRateControl->getRate();
130  else
131  return fastestMandatoryMode;
132 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
virtual MACAddress & getReceiverAddress()
IRateControl * dataOrMgmtRateControl
Definition: RateSelection.h:44
const IIeee80211Mode * multicastFrameMode
Definition: RateSelection.h:51
const IIeee80211Mode * dataFrameMode
Definition: RateSelection.h:53
virtual const IIeee80211Mode * getRate()=0
bool isMulticast() const
Returns true if this is a multicast logical address (first byte&#39;s lsb is 1).
Definition: MACAddress.h:146
const IIeee80211Mode * mgmtFrameMode
Definition: RateSelection.h:54
const IIeee80211Mode * inet::ieee80211::RateSelection::computeMode ( Ieee80211Frame frame)
overridevirtual

Implements inet::ieee80211::IRateSelection.

147 {
148  if (auto dataOrMgmtFrame = dynamic_cast<Ieee80211DataOrMgmtFrame*>(frame))
149  return computeDataOrMgmtFrameMode(dataOrMgmtFrame);
150  else
151  return computeControlFrameMode(frame);
152 }
virtual const IIeee80211Mode * computeDataOrMgmtFrameMode(Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
Definition: RateSelection.cc:120
virtual const IIeee80211Mode * computeControlFrameMode(Ieee80211Frame *frame)
Definition: RateSelection.cc:140
const IIeee80211Mode * inet::ieee80211::RateSelection::computeResponseAckFrameMode ( Ieee80211DataOrMgmtFrame dataOrMgmtFrame)
overridevirtual

Implements inet::ieee80211::IRateSelection.

86 {
88  return responseAckFrameMode;
89  else {
90  auto mode = getMode(dataOrMgmtFrame);
91  ASSERT(modeSet->containsMode(mode));
92  return modeSet->getIsMandatory(mode) ? mode : fastestMandatoryMode; // TODO: BSSBasicRateSet
93  }
94 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
bool getIsMandatory(const IIeee80211Mode *mode) const
Definition: Ieee80211ModeSet.cc:187
const Ieee80211ModeSet * modeSet
Definition: RateSelection.h:47
bool containsMode(const IIeee80211Mode *mode) const
Definition: Ieee80211ModeSet.h:60
virtual const IIeee80211Mode * getMode(Ieee80211Frame *frame)
Definition: RateSelection.cc:68
const IIeee80211Mode * responseAckFrameMode
Definition: RateSelection.h:57
const IIeee80211Mode * inet::ieee80211::RateSelection::computeResponseCtsFrameMode ( Ieee80211RTSFrame rtsFrame)
overridevirtual

Implements inet::ieee80211::IRateSelection.

97 {
99  return responseCtsFrameMode;
100  else {
101  auto mode = getMode(rtsFrame);
102  ASSERT(modeSet->containsMode(mode));
103  return modeSet->getIsMandatory(mode) ? mode : fastestMandatoryMode; // TODO: BSSBasicRateSet
104  }
105 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
bool getIsMandatory(const IIeee80211Mode *mode) const
Definition: Ieee80211ModeSet.cc:187
const Ieee80211ModeSet * modeSet
Definition: RateSelection.h:47
const IIeee80211Mode * responseCtsFrameMode
Definition: RateSelection.h:58
bool containsMode(const IIeee80211Mode *mode) const
Definition: Ieee80211ModeSet.h:60
virtual const IIeee80211Mode * getMode(Ieee80211Frame *frame)
Definition: RateSelection.cc:68
void inet::ieee80211::RateSelection::frameTransmitted ( Ieee80211Frame frame)
virtual
164 {
165  auto receiverAddr = frame->getReceiverAddress();
166  lastTransmittedFrameMode[receiverAddr] = getMode(frame);
167 }
virtual MACAddress & getReceiverAddress()
std::map< MACAddress, const IIeee80211Mode * > lastTransmittedFrameMode
Definition: RateSelection.h:48
virtual const IIeee80211Mode * getMode(Ieee80211Frame *frame)
Definition: RateSelection.cc:68
const IIeee80211Mode * inet::ieee80211::RateSelection::getMode ( Ieee80211Frame frame)
protectedvirtual

Referenced by computeResponseAckFrameMode(), computeResponseCtsFrameMode(), and frameTransmitted().

69 {
70  auto txReq = dynamic_cast<Ieee80211TransmissionRequest*>(frame->getControlInfo());
71  if (txReq)
72  return txReq->getMode();
73  auto rxInd = dynamic_cast<Ieee80211ReceptionIndication*>(frame->getControlInfo());
74  if (rxInd)
75  return rxInd->getMode();
76  throw cRuntimeError("Missing mode");
77 }
Class generated from inet/physicallayer/ieee80211/packetlevel/Ieee80211ControlInfo.msg:146 by nedtool.
Definition: Ieee80211ControlInfo_m.h:135
Class generated from inet/physicallayer/ieee80211/packetlevel/Ieee80211ControlInfo.msg:157 by nedtool.
Definition: Ieee80211ControlInfo_m.h:194
void inet::ieee80211::RateSelection::initialize ( int  stage)
overrideprotectedvirtual
31 {
32  if (stage == INITSTAGE_LOCAL) {
33  getContainingNicModule(this)->subscribe(NF_MODESET_CHANGED, this);
34  }
35  else if (stage == INITSTAGE_LINK_LAYER_2) {
36  dataOrMgmtRateControl = dynamic_cast<IRateControl*>(getModuleByPath(par("rateControlModule")));
37  double multicastFrameBitrate = par("multicastFrameBitrate");
38  multicastFrameMode = (multicastFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(multicastFrameBitrate));
39  double dataFrameBitrate = par("dataFrameBitrate");
40  dataFrameMode = (dataFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(dataFrameBitrate));
41  double mgmtFrameBitrate = par("mgmtFrameBitrate");
42  mgmtFrameMode = (mgmtFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(mgmtFrameBitrate));
43  double controlFrameBitrate = par("controlFrameBitrate");
44  controlFrameMode = (controlFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(controlFrameBitrate));
45  double responseAckFrameBitrate = par("responseAckFrameBitrate");
46  responseAckFrameMode = (responseAckFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(responseAckFrameBitrate));
47  double responseCtsFrameBitrate = par("responseCtsFrameBitrate");
48  responseCtsFrameMode = (responseCtsFrameBitrate == -1) ? nullptr : modeSet->getMode(bps(responseCtsFrameBitrate));
50  //WATCH_PTR(dataOrMgmtRateControl);
51 
52 // WATCH_PTR(*((cObject**)&fastestMandatoryMode));
53 // WATCH_PTR(*((cObject**)&modeSet));
54  WATCH_MAP(lastTransmittedFrameMode);
55 // WATCH_PTR(*((cObject**)&multicastFrameMode));
56 // WATCH_PTR(*((cObject**)&dataFrameMode));
57 // WATCH_PTR(*((cObject**)&mgmtFrameMode));
58 // WATCH_PTR(*((cObject**)&controlFrameMode));
59 // WATCH_PTR(*((cObject**)&responseAckFrameMode));
60 // WATCH_PTR(*((cObject**)&responseCtsFrameMode));
61 // WATCH_PTR();
62 // WATCH_PTR();
63 // WATCH_PTR();
64 // WATCH_PTR();
65  }
66 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
IRateControl * dataOrMgmtRateControl
Definition: RateSelection.h:44
std::map< MACAddress, const IIeee80211Mode * > lastTransmittedFrameMode
Definition: RateSelection.h:48
const IIeee80211Mode * multicastFrameMode
Definition: RateSelection.h:51
const IIeee80211Mode * controlFrameMode
Definition: RateSelection.h:55
const Ieee80211ModeSet * modeSet
Definition: RateSelection.h:47
const IIeee80211Mode * responseCtsFrameMode
Definition: RateSelection.h:58
const IIeee80211Mode * dataFrameMode
Definition: RateSelection.h:53
Local initializations.
Definition: InitStages.h:35
const IIeee80211Mode * getMode(bps bitrate) const
Definition: Ieee80211ModeSet.cc:202
cModule * getContainingNicModule(cModule *from)
Find the nic module (inside the networkNode) containing the given module.
Definition: ModuleAccess.cc:96
simsignal_t NF_MODESET_CHANGED
Definition: NotifierConsts.cc:46
Abstract interface for auto rate control algorithms.
Definition: IRateControl.h:35
const IIeee80211Mode * mgmtFrameMode
Definition: RateSelection.h:54
const IIeee80211Mode * getFastestMandatoryMode() const
Definition: Ieee80211ModeSet.cc:247
Definition: Units.h:69
Additional link-layer initializations that depend on the previous stage.
Definition: InitStages.h:64
const IIeee80211Mode * responseAckFrameMode
Definition: RateSelection.h:57
virtual int inet::ieee80211::RateSelection::numInitStages ( ) const
inlineoverrideprotectedvirtual
61 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::RateSelection::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual
155 {
156  Enter_Method("receiveModeSetChangeNotification");
157  if (signalID == NF_MODESET_CHANGED) {
158  modeSet = check_and_cast<Ieee80211ModeSet*>(obj);
160  }
161 }
const IIeee80211Mode * fastestMandatoryMode
Definition: RateSelection.h:45
Definition: Ieee80211ModeSet.h:28
const Ieee80211ModeSet * modeSet
Definition: RateSelection.h:47
simsignal_t NF_MODESET_CHANGED
Definition: NotifierConsts.cc:46
const IIeee80211Mode * getFastestMandatoryMode() const
Definition: Ieee80211ModeSet.cc:247
void inet::ieee80211::RateSelection::setFrameMode ( Ieee80211Frame frame,
const IIeee80211Mode mode 
)
static

Referenced by inet::ieee80211::OriginatorProtectionMechanism::computeDataFrameDurationField(), inet::ieee80211::SingleProtectionMechanism::computeDataOrMgmtFrameDurationField(), inet::ieee80211::OriginatorProtectionMechanism::computeRtsDurationField(), inet::ieee80211::SingleProtectionMechanism::computeRtsDurationField(), inet::ieee80211::Dcf::transmitControlResponseFrame(), and inet::ieee80211::Dcf::transmitFrame().

170 {
171  ASSERT(mode != nullptr);
172  delete frame->removeControlInfo();
174  ctrl->setMode(mode);
175  frame->setControlInfo(ctrl);
176 }
Class generated from inet/physicallayer/ieee80211/packetlevel/Ieee80211ControlInfo.msg:146 by nedtool.
Definition: Ieee80211ControlInfo_m.h:135
virtual void setMode(const IIeee80211ModePtr &mode)

Member Data Documentation

const IIeee80211Mode* inet::ieee80211::RateSelection::controlFrameMode = nullptr
protected

Referenced by initialize().

const IIeee80211Mode* inet::ieee80211::RateSelection::dataFrameMode = nullptr
protected
IRateControl* inet::ieee80211::RateSelection::dataOrMgmtRateControl = nullptr
protected
const IIeee80211Mode* inet::ieee80211::RateSelection::fastestMandatoryMode = nullptr
protected
std::map<MACAddress, const IIeee80211Mode *> inet::ieee80211::RateSelection::lastTransmittedFrameMode
protected

Referenced by frameTransmitted(), and initialize().

const IIeee80211Mode* inet::ieee80211::RateSelection::mgmtFrameMode = nullptr
protected
const Ieee80211ModeSet* inet::ieee80211::RateSelection::modeSet = nullptr
protected
const IIeee80211Mode* inet::ieee80211::RateSelection::multicastFrameMode = nullptr
protected
const IIeee80211Mode* inet::ieee80211::RateSelection::responseAckFrameMode = nullptr
protected
const IIeee80211Mode* inet::ieee80211::RateSelection::responseCtsFrameMode = nullptr
protected

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