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

#include <DcfFs.h>

Inheritance diagram for inet::ieee80211::DcfFs:
inet::ieee80211::AlternativesFs inet::ieee80211::IFrameSequence

Public Member Functions

 DcfFs ()
 
virtual int selectDcfSequence (AlternativesFs *frameSequence, FrameSequenceContext *context)
 
virtual int selectSelfCtsOrRtsCts (AlternativesFs *frameSequence, FrameSequenceContext *context)
 
virtual int selectMulticastDataOrMgmt (AlternativesFs *frameSequence, FrameSequenceContext *context)
 
virtual bool hasMoreFragments (RepeatingFs *frameSequence, FrameSequenceContext *context)
 
virtual bool isSelfCtsNeeded (OptionalFs *frameSequence, FrameSequenceContext *context)
 
virtual bool isRtsCtsNeeded (OptionalFs *frameSequence, FrameSequenceContext *context)
 
virtual bool isCtsOrRtsCtsNeeded (OptionalFs *frameSequence, FrameSequenceContext *context)
 
virtual bool isBroadcastManagementOrGroupDataSequenceNeeded (AlternativesFs *frameSequence, FrameSequenceContext *context)
 
virtual bool isFragFrameSequenceNeeded (AlternativesFs *frameSequence, FrameSequenceContext *context)
 
- Public Member Functions inherited from inet::ieee80211::AlternativesFs
virtual ~AlternativesFs ()
 
 AlternativesFs (std::vector< IFrameSequence * > elements, std::function< int(AlternativesFs *, FrameSequenceContext *)> selector)
 
virtual int getStep ()
 
virtual int selectSequence (FrameSequenceContext *context)
 
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 ()
 

Additional Inherited Members

- Protected Attributes inherited from inet::ieee80211::AlternativesFs
int firstStep = -1
 
int step = -1
 
int elementIndex = -1
 
std::vector< IFrameSequence * > elements
 
std::function< int(AlternativesFs *, FrameSequenceContext *)> selector
 

Constructor & Destructor Documentation

inet::ieee80211::DcfFs::DcfFs ( )
24  :
25  // Excerpt from G.2 Basic sequences (p. 2309)
26  // frame-sequence =
27  // ( [ CTS ] ( Management + broadcast | Data + group ) ) |
28  // ( [ CTS | RTS CTS] {frag-frame ACK } last-frame ACK )
29  //
30  // frag-frame = ( Data | Management ) + individual + frag;
31  // last-frame = ( Data | Management ) + individual + last;
32  //
35  new SequentialFs({new OptionalFs(new AlternativesFs({new SelfCtsFs(), new SequentialFs({new RtsFs(), new CtsFs()})},
39  new LastFrameAckFs()})},
41 {
42 }
AlternativesFs(std::vector< IFrameSequence * > elements, std::function< int(AlternativesFs *, FrameSequenceContext *)> selector)
Definition: GenericFrameSequences.cc:170
virtual int selectDcfSequence(AlternativesFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:44
#define REPEATINGFS_PREDICATE(predicate)
Definition: GenericFrameSequences.h:31
virtual int selectMulticastDataOrMgmt(AlternativesFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:95
Definition: PrimitiveFrameSequences.h:28
Definition: PrimitiveFrameSequences.h:41
Definition: GenericFrameSequences.h:34
#define ALTERNATIVESFS_SELECTOR(selector)
Definition: GenericFrameSequences.h:32
Definition: PrimitiveFrameSequences.h:149
virtual bool isCtsOrRtsCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:78
#define OPTIONALFS_PREDICATE(predicate)
Definition: GenericFrameSequences.h:30
virtual bool isSelfCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:67
virtual bool hasMoreFragments(RepeatingFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:62
Definition: PrimitiveFrameSequences.h:107
Definition: PrimitiveFrameSequences.h:135
Definition: PrimitiveFrameSequences.h:121
virtual int selectSelfCtsOrRtsCts(AlternativesFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:53
Definition: PrimitiveFrameSequences.h:68
Definition: GenericFrameSequences.h:74
Definition: GenericFrameSequences.h:52

Member Function Documentation

bool inet::ieee80211::DcfFs::hasMoreFragments ( RepeatingFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs().

63 {
65 }
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
virtual bool getMoreFragments() const
virtual bool hasInProgressFrames()
Definition: InProgressFrames.h:56
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
bool inet::ieee80211::DcfFs::isBroadcastManagementOrGroupDataSequenceNeeded ( AlternativesFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by selectDcfSequence().

86 {
87  if (context->getInProgressFrames()->hasInProgressFrames()) {
88  auto frameToTransmit = context->getInProgressFrames()->getFrameToTransmit();
89  return frameToTransmit->getReceiverAddress().isMulticast();
90  }
91  else
92  return false;
93 }
virtual MACAddress & getReceiverAddress()
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
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 hasInProgressFrames()
Definition: InProgressFrames.h:56
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
bool inet::ieee80211::DcfFs::isCtsOrRtsCtsNeeded ( OptionalFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs().

79 {
80  bool selfCts = isSelfCtsNeeded(frameSequence, context);
81  bool rtsCts = isRtsCtsNeeded(frameSequence, context);
82  return selfCts || rtsCts;
83 }
virtual bool isSelfCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:67
virtual bool isRtsCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:72
bool inet::ieee80211::DcfFs::isFragFrameSequenceNeeded ( AlternativesFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by selectDcfSequence().

102 {
103  return context->getInProgressFrames()->hasInProgressFrames() && dynamic_cast<Ieee80211DataOrMgmtFrame*>(context->getInProgressFrames()->getFrameToTransmit());
104 }
Class generated from inet/linklayer/ieee80211/mac/Ieee80211Frame.msg:166 by nedtool.
Definition: Ieee80211Frame_m.h:438
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
virtual bool hasInProgressFrames()
Definition: InProgressFrames.h:56
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
bool inet::ieee80211::DcfFs::isRtsCtsNeeded ( OptionalFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by isCtsOrRtsCtsNeeded(), and selectSelfCtsOrRtsCts().

73 {
74  auto protectedFrame = context->getInProgressFrames()->getFrameToTransmit();
75  return context->getRtsPolicy()->isRtsNeeded(protectedFrame);
76 }
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
virtual bool isRtsNeeded(Ieee80211Frame *protectedFrame) const =0
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
virtual IRtsPolicy * getRtsPolicy() const
Definition: FrameSequenceContext.h:89
bool inet::ieee80211::DcfFs::isSelfCtsNeeded ( OptionalFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs(), isCtsOrRtsCtsNeeded(), and selectSelfCtsOrRtsCts().

68 {
69  return false; // TODO: Implement
70 }
int inet::ieee80211::DcfFs::selectDcfSequence ( AlternativesFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs().

45 {
46  bool multicastMgmtOrDataSequence = isBroadcastManagementOrGroupDataSequenceNeeded(frameSequence, context);
47  bool fragFrameSequence = isFragFrameSequenceNeeded(frameSequence, context);
48  if (multicastMgmtOrDataSequence) return 0;
49  else if (fragFrameSequence) return 1;
50  else throw cRuntimeError("One alternative must be chosen");
51 }
virtual bool isFragFrameSequenceNeeded(AlternativesFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:101
virtual bool isBroadcastManagementOrGroupDataSequenceNeeded(AlternativesFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:85
int inet::ieee80211::DcfFs::selectMulticastDataOrMgmt ( AlternativesFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs().

96 {
97  auto frameToTransmit = context->getInProgressFrames()->getFrameToTransmit();
98  return dynamic_cast<Ieee80211ManagementFrame*>(frameToTransmit) ? 0 : 1;
99 }
virtual Ieee80211DataOrMgmtFrame * getFrameToTransmit()
Definition: InProgressFrames.cc:52
Class generated from inet/linklayer/ieee80211/mac/Ieee80211Frame.msg:217 by nedtool.
Definition: Ieee80211Frame_m.h:604
virtual InProgressFrames * getInProgressFrames() const
Definition: FrameSequenceContext.h:87
int inet::ieee80211::DcfFs::selectSelfCtsOrRtsCts ( AlternativesFs frameSequence,
FrameSequenceContext context 
)
virtual

Referenced by DcfFs().

54 {
55  bool selfCts = isSelfCtsNeeded(nullptr, context); // TODO
56  bool rtsCts = isRtsCtsNeeded(nullptr, context); // TODO
57  if (selfCts) return 0;
58  else if (rtsCts) return 1;
59  else throw cRuntimeError("One alternative must be chosen");
60 }
virtual bool isSelfCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:67
virtual bool isRtsCtsNeeded(OptionalFs *frameSequence, FrameSequenceContext *context)
Definition: DcfFs.cc:72

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