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

#include <Dcaf.h>

Inheritance diagram for inet::ieee80211::Dcaf:
inet::ieee80211::IChannelAccess inet::ieee80211::IContention::ICallback inet::ieee80211::IRecoveryProcedure::ICwCalculator inet::ieee80211::ModeSetListener

Public Member Functions

virtual void requestChannel (IChannelAccess::ICallback *callback) override
 
virtual void releaseChannel (IChannelAccess::ICallback *callback) override
 
virtual void channelAccessGranted () override
 
virtual void expectedChannelAccess (simtime_t time) override
 
virtual void incrementCw () override
 
virtual void resetCw () override
 
virtual int getCw ()
 
- Public Member Functions inherited from inet::ieee80211::IChannelAccess
virtual ~IChannelAccess ()
 
- Public Member Functions inherited from inet::ieee80211::IContention::ICallback
 ~ICallback ()
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void calculateTimingParameters ()
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 

Protected Attributes

Ieee80211ModeSetmodeSet = nullptr
 
IContentioncontention = nullptr
 
IChannelAccess::ICallbackcallback = nullptr
 
bool owning = false
 
bool contentionInProgress = false
 
simtime_t slotTime = -1
 
simtime_t sifs = -1
 
simtime_t ifs = -1
 
simtime_t eifs = -1
 
int cw = -1
 
int cwMin = -1
 
int cwMax = -1
 
- Protected Attributes inherited from inet::ieee80211::ModeSetListener
Ieee80211ModeSetmodeSet = nullptr
 

Member Function Documentation

void inet::ieee80211::Dcaf::calculateTimingParameters ( )
protectedvirtual

Referenced by initialize(), and receiveSignal().

44 {
47  int difs = par("difsTime");
48  // The PIFS and DIFS are derived by the Equation (9-2) and Equation (9-3), as illustrated in Figure 9-14.
49  // PIFS = aSIFSTime + aSlotTime (9-2)
50  // DIFS = aSIFSTime + 2 × aSlotTime (9-3)
51  ifs = difs == -1 ? sifs + 2 * slotTime : difs;
52  // The EIFS is derived from the SIFS and the DIFS and the length of time it takes to transmit an ACK frame at the
53  // lowest PHY mandatory rate by Equation (9-4).
54  // EIFS = aSIFSTime + DIFS + ACKTxTime
56  ASSERT(ifs > sifs);
57  cwMin = par("cwMin");
58  cwMax = par("cwMax");
59  if (cwMin == -1)
60  cwMin = modeSet->getCwMin();
61  if (cwMax == -1)
62  cwMax = modeSet->getCwMax();
63  cw = cwMin;
64 }
simtime_t getSlotTime() const
Definition: Ieee80211ModeSet.h:78
int cwMax
Definition: Dcaf.h:46
Ieee80211ModeSet * modeSet
Definition: Dcaf.h:32
const unsigned int LENGTH_ACK
Definition: Ieee80211Frame_m.h:43
virtual const simtime_t getDuration(int dataBitLength) const =0
int getCwMin() const
Definition: Ieee80211ModeSet.h:80
simtime_t ifs
Definition: Dcaf.h:41
simtime_t slotTime
Definition: Dcaf.h:39
simtime_t getSifsTime() const
Definition: Ieee80211ModeSet.h:77
simtime_t sifs
Definition: Dcaf.h:40
simtime_t eifs
Definition: Dcaf.h:42
int cw
Definition: Dcaf.h:44
const IIeee80211Mode * getSlowestMandatoryMode() const
Definition: Ieee80211ModeSet.cc:239
int getCwMax() const
Definition: Ieee80211ModeSet.h:81
int cwMin
Definition: Dcaf.h:45
void inet::ieee80211::Dcaf::channelAccessGranted ( )
overridevirtual

Implements inet::ieee80211::IContention::ICallback.

81 {
82  ASSERT(callback != nullptr);
83  owning = true;
84  contentionInProgress = false;
85  callback->channelGranted(this);
86 }
IChannelAccess::ICallback * callback
Definition: Dcaf.h:34
virtual void channelGranted(IChannelAccess *channelAccess)=0
bool contentionInProgress
Definition: Dcaf.h:37
bool owning
Definition: Dcaf.h:36
void inet::ieee80211::Dcaf::expectedChannelAccess ( simtime_t  time)
overridevirtual

Implements inet::ieee80211::IContention::ICallback.

108 {
109  // don't care
110 }
virtual int inet::ieee80211::Dcaf::getCw ( )
inlinevirtual
void inet::ieee80211::Dcaf::incrementCw ( )
overridevirtual

Implements inet::ieee80211::IRecoveryProcedure::ICwCalculator.

67 {
68  int newCw = 2 * cw + 1;
69  if (newCw > cwMax)
70  cw = cwMax;
71  else
72  cw = newCw;
73 }
int cwMax
Definition: Dcaf.h:46
int cw
Definition: Dcaf.h:44
void inet::ieee80211::Dcaf::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

29 {
30  if (stage == INITSTAGE_LOCAL) {
31  getContainingNicModule(this)->subscribe(NF_MODESET_CHANGED, this);
32  }
33  else if (stage == INITSTAGE_LINK_LAYER_2) {
34  // TODO: calculateTimingParameters()
35  contention = check_and_cast<IContention *>(getSubmodule("contention"));
36  auto rx = check_and_cast<IRx *>(getModuleByPath(par("rxModule")));
39  }
40 }
virtual void calculateTimingParameters()
Definition: Dcaf.cc:43
Abstract interface for Rx processes.
Definition: IRx.h:45
Local initializations.
Definition: InitStages.h:35
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
IContention * contention
Definition: Dcaf.h:33
virtual void registerContention(IContention *contention)=0
Additional link-layer initializations that depend on the previous stage.
Definition: InitStages.h:64
Abstract interface for processes that implement contention-based channel access.
Definition: IContention.h:39
virtual int inet::ieee80211::Dcaf::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

49 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::Dcaf::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

113 {
114  Enter_Method("receiveModeSetChangeNotification");
115  if (signalID == NF_MODESET_CHANGED) {
116  modeSet = check_and_cast<Ieee80211ModeSet*>(obj);
118  }
119 }
virtual void calculateTimingParameters()
Definition: Dcaf.cc:43
Ieee80211ModeSet * modeSet
Definition: Dcaf.h:32
Definition: Ieee80211ModeSet.h:28
simsignal_t NF_MODESET_CHANGED
Definition: NotifierConsts.cc:46
void inet::ieee80211::Dcaf::releaseChannel ( IChannelAccess::ICallback callback)
overridevirtual

Implements inet::ieee80211::IChannelAccess.

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

89 {
90  owning = false;
91  contentionInProgress = false;
92  this->callback = nullptr;
93 }
bool contentionInProgress
Definition: Dcaf.h:37
bool owning
Definition: Dcaf.h:36
void inet::ieee80211::Dcaf::requestChannel ( IChannelAccess::ICallback callback)
overridevirtual

Implements inet::ieee80211::IChannelAccess.

Referenced by inet::ieee80211::Dcf::frameSequenceFinished(), and inet::ieee80211::Dcf::processUpperFrame().

96 {
97  this->callback = callback;
98  if (owning)
99  callback->channelGranted(this);
100  else if (!contentionInProgress) {
101  contentionInProgress = true;
103  }
104  else ;
105 }
IChannelAccess::ICallback * callback
Definition: Dcaf.h:34
virtual void channelGranted(IChannelAccess *channelAccess)=0
bool contentionInProgress
Definition: Dcaf.h:37
simtime_t ifs
Definition: Dcaf.h:41
simtime_t slotTime
Definition: Dcaf.h:39
virtual void startContention(int cw, simtime_t ifs, simtime_t eifs, simtime_t slotTime, ICallback *callback)=0
IContention * contention
Definition: Dcaf.h:33
bool owning
Definition: Dcaf.h:36
simtime_t eifs
Definition: Dcaf.h:42
int cw
Definition: Dcaf.h:44
void inet::ieee80211::Dcaf::resetCw ( )
overridevirtual

Implements inet::ieee80211::IRecoveryProcedure::ICwCalculator.

76 {
77  cw = cwMin;
78 }
int cw
Definition: Dcaf.h:44
int cwMin
Definition: Dcaf.h:45

Member Data Documentation

IChannelAccess::ICallback* inet::ieee80211::Dcaf::callback = nullptr
protected
IContention* inet::ieee80211::Dcaf::contention = nullptr
protected

Referenced by initialize(), and requestChannel().

bool inet::ieee80211::Dcaf::contentionInProgress = false
protected
int inet::ieee80211::Dcaf::cw = -1
protected
int inet::ieee80211::Dcaf::cwMax = -1
protected
int inet::ieee80211::Dcaf::cwMin = -1
protected
simtime_t inet::ieee80211::Dcaf::eifs = -1
protected
simtime_t inet::ieee80211::Dcaf::ifs = -1
protected
Ieee80211ModeSet* inet::ieee80211::Dcaf::modeSet = nullptr
protected
bool inet::ieee80211::Dcaf::owning = false
protected
simtime_t inet::ieee80211::Dcaf::sifs = -1
protected
simtime_t inet::ieee80211::Dcaf::slotTime = -1
protected

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