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

#include <TxopProcedure.h>

Inheritance diagram for inet::ieee80211::TxopProcedure:
inet::ieee80211::ModeSetListener

Public Types

enum  ProtectionMechanism { ProtectionMechanism::SINGLE_PROTECTION, ProtectionMechanism::MULTIPLE_PROTECTION, ProtectionMechanism::UNDEFINED_PROTECTION }
 

Public Member Functions

virtual void startTxop (AccessCategory ac)
 
virtual void stopTxop ()
 
virtual simtime_t getStart () const
 
virtual simtime_t getLimit () const
 
virtual simtime_t getRemaining () const
 
virtual bool isFinalFragment (Ieee80211Frame *frame) const
 
virtual bool isTxopInitiator (Ieee80211Frame *frame) const
 
virtual bool isTxopTerminator (Ieee80211Frame *frame) const
 
virtual ProtectionMechanism getProtectionMechanism () const
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual s getTxopLimit (const IIeee80211Mode *mode, AccessCategory ac)
 
virtual ProtectionMechanism selectProtectionMechanism (AccessCategory ac) const
 
- Protected Member Functions inherited from inet::ieee80211::ModeSetListener
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 

Protected Attributes

simtime_t start = -1
 
simtime_t limit = -1
 
ProtectionMechanism protectionMechanism = ProtectionMechanism::UNDEFINED_PROTECTION
 
- Protected Attributes inherited from inet::ieee80211::ModeSetListener
Ieee80211ModeSetmodeSet = nullptr
 

Member Enumeration Documentation

Enumerator
SINGLE_PROTECTION 
MULTIPLE_PROTECTION 
UNDEFINED_PROTECTION 
33  {
34  SINGLE_PROTECTION,
35  MULTIPLE_PROTECTION,
36  UNDEFINED_PROTECTION
37  };

Member Function Documentation

simtime_t inet::ieee80211::TxopProcedure::getLimit ( ) const
virtual
68 {
69  return limit;
70 }
simtime_t limit
Definition: TxopProcedure.h:41
virtual ProtectionMechanism inet::ieee80211::TxopProcedure::getProtectionMechanism ( ) const
inlinevirtual
63 { return protectionMechanism; }
ProtectionMechanism protectionMechanism
Definition: TxopProcedure.h:42
simtime_t inet::ieee80211::TxopProcedure::getRemaining ( ) const
virtual

Referenced by inet::ieee80211::HcfFs::hasMoreTxOps().

94 {
95  if (start == -1)
96  throw cRuntimeError("Txop has not started yet");
97  auto now = simTime();
98  return now > start + limit ? 0 : now - start;
99 }
simtime_t limit
Definition: TxopProcedure.h:41
simtime_t start
Definition: TxopProcedure.h:40
simtime_t inet::ieee80211::TxopProcedure::getStart ( ) const
virtual
63 {
64  return start;
65 }
simtime_t start
Definition: TxopProcedure.h:40
s inet::ieee80211::TxopProcedure::getTxopLimit ( const IIeee80211Mode mode,
AccessCategory  ac 
)
protectedvirtual

Referenced by startTxop().

39 {
40  switch (ac)
41  {
42  case AC_BK: return s(0);
43  case AC_BE: return s(0);
44  case AC_VI:
45  if (dynamic_cast<const Ieee80211DsssMode*>(mode) || dynamic_cast<const Ieee80211HrDsssMode*>(mode)) return ms(6.016);
46  else if (dynamic_cast<const Ieee80211HTMode*>(mode) || dynamic_cast<const Ieee80211OFDMMode*>(mode)) return ms(3.008);
47  else return s(0);
48  case AC_VO:
49  if (dynamic_cast<const Ieee80211DsssMode*>(mode) || dynamic_cast<const Ieee80211HrDsssMode*>(mode)) return ms(3.264);
50  else if (dynamic_cast<const Ieee80211HTMode*>(mode) || dynamic_cast<const Ieee80211OFDMMode*>(mode)) return ms(1.504);
51  else return s(0);
52  default: throw cRuntimeError("Unknown access category = %d", ac);
53  }
54 }
milli< s >::type ms
Definition: Units.h:902
Definition: AccessCategory.h:31
Definition: AccessCategory.h:33
value< double, units::s > s
Definition: Units.h:1049
Definition: AccessCategory.h:34
Definition: AccessCategory.h:32
void inet::ieee80211::TxopProcedure::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

31 {
33  if (stage == INITSTAGE_LOCAL) {
34  limit = par("txopLimit");
35  }
36 }
simtime_t limit
Definition: TxopProcedure.h:41
Local initializations.
Definition: InitStages.h:35
virtual void initialize(int stage) override
Definition: ModeSetListener.cc:25
bool inet::ieee80211::TxopProcedure::isFinalFragment ( Ieee80211Frame frame) const
virtual
bool inet::ieee80211::TxopProcedure::isTxopInitiator ( Ieee80211Frame frame) const
virtual
bool inet::ieee80211::TxopProcedure::isTxopTerminator ( Ieee80211Frame frame) const
virtual

Referenced by inet::ieee80211::QoSRateSelection::computeControlFrameMode().

115 {
116  return false;
117 }
virtual int inet::ieee80211::TxopProcedure::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::ModeSetListener.

45 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
TxopProcedure::ProtectionMechanism inet::ieee80211::TxopProcedure::selectProtectionMechanism ( AccessCategory  ac) const
protectedvirtual
void inet::ieee80211::TxopProcedure::startTxop ( AccessCategory  ac)
virtual
73 {
74  if (start != -1)
75  throw cRuntimeError("Txop is already running");
76  if (limit == -1) {
77  auto referenceMode = modeSet->getSlowestMandatoryMode();
78  limit = getTxopLimit(referenceMode, ac).get();
79  }
80  // The STA selects between single and multiple protection when it transmits the first frame of a TXOP.
81  // All subsequent frames transmitted by the STA in the same TXOP use the same class of duration settings.
83  start = simTime();
84 }
const value_type & get() const
Definition: Units.h:89
Ieee80211ModeSet * modeSet
Definition: ModeSetListener.h:31
simtime_t limit
Definition: TxopProcedure.h:41
virtual s getTxopLimit(const IIeee80211Mode *mode, AccessCategory ac)
Definition: TxopProcedure.cc:38
const IIeee80211Mode * getSlowestMandatoryMode() const
Definition: Ieee80211ModeSet.cc:239
simtime_t start
Definition: TxopProcedure.h:40
virtual ProtectionMechanism selectProtectionMechanism(AccessCategory ac) const
Definition: TxopProcedure.cc:56
ProtectionMechanism protectionMechanism
Definition: TxopProcedure.h:42
void inet::ieee80211::TxopProcedure::stopTxop ( )
virtual
88 {
89  start = -1;
91 }
simtime_t start
Definition: TxopProcedure.h:40
ProtectionMechanism protectionMechanism
Definition: TxopProcedure.h:42

Member Data Documentation

simtime_t inet::ieee80211::TxopProcedure::limit = -1
protected
ProtectionMechanism inet::ieee80211::TxopProcedure::protectionMechanism = ProtectionMechanism::UNDEFINED_PROTECTION
protected

Referenced by startTxop(), and stopTxop().

simtime_t inet::ieee80211::TxopProcedure::start = -1
protected

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