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

#include <RecipientQoSMacDataService.h>

Inheritance diagram for inet::ieee80211::RecipientQoSMacDataService:
inet::ieee80211::IRecipientQoSMacDataService

Public Member Functions

virtual std::vector< Ieee80211Frame * > dataFrameReceived (Ieee80211DataFrame *dataFrame, IRecipientBlockAckAgreementHandler *blockAckAgreementHandler) override
 
virtual std::vector< Ieee80211Frame * > controlFrameReceived (Ieee80211Frame *controlFrame, IRecipientBlockAckAgreementHandler *blockAckAgreementHandler) override
 
virtual std::vector< Ieee80211Frame * > managementFrameReceived (Ieee80211ManagementFrame *mgmtFrame) override
 

Protected Member Functions

virtual ~RecipientQoSMacDataService ()
 
virtual void initialize () override
 
virtual Ieee80211DataFramedefragment (std::vector< Ieee80211DataFrame * > completeFragments)
 
Ieee80211ManagementFramedefragment (Ieee80211ManagementFrame *mgmtFragment)
 

Protected Attributes

BasicReassemblybasicReassembly = nullptr
 
IDuplicateRemovalduplicateRemoval = nullptr
 
BlockAckReorderingblockAckReordering = nullptr
 
IDefragmentationdefragmentation = nullptr
 
IMsduDeaggregationaMsduDeaggregation = nullptr
 

Constructor & Destructor Documentation

inet::ieee80211::RecipientQoSMacDataService::~RecipientQoSMacDataService ( )
protectedvirtual
173 {
174  delete duplicateRemoval;
175  delete basicReassembly;
176  delete aMsduDeaggregation;
177  delete blockAckReordering;
178 }
IMsduDeaggregation * aMsduDeaggregation
Definition: RecipientQoSMacDataService.h:46
BlockAckReordering * blockAckReordering
Definition: RecipientQoSMacDataService.h:44
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
IDuplicateRemoval * duplicateRemoval
Definition: RecipientQoSMacDataService.h:42

Member Function Documentation

std::vector< Ieee80211Frame * > inet::ieee80211::RecipientQoSMacDataService::controlFrameReceived ( Ieee80211Frame controlFrame,
IRecipientBlockAckAgreementHandler blockAckAgreementHandler 
)
overridevirtual

Implements inet::ieee80211::IRecipientQoSMacDataService.

122 {
123  if (auto blockAckReq = dynamic_cast<Ieee80211BasicBlockAckReq*>(controlFrame)) {
125  if (blockAckReordering) {
126  Tid tid = blockAckReq->getTidInfo();
127  MACAddress originatorAddr = blockAckReq->getTransmitterAddress();
128  RecipientBlockAckAgreement *agreement = blockAckAgreementHandler->getAgreement(tid, originatorAddr);
129  if (agreement)
130  frames = blockAckReordering->processReceivedBlockAckReq(blockAckReq);
131  else
132  return std::vector<Ieee80211Frame*>();
133  }
134  std::vector<Ieee80211Frame *> defragmentedFrames;
135  if (basicReassembly) { // FIXME: defragmentation
136  for (auto it : frames) {
137  auto fragments = it.second;
138  defragmentedFrames.push_back(defragment(fragments));
139  }
140  }
141  else {
142  for (auto it : frames) {
143  auto fragments = it.second;
144  if (fragments.size() == 1) {
145  defragmentedFrames.push_back(fragments.at(0));
146  }
147  else {
148  // TODO: drop?
149  }
150  }
151  }
152  std::vector<Ieee80211Frame *> deaggregatedFrames;
153  if (aMsduDeaggregation) {
154  for (auto frame : defragmentedFrames) {
155  auto dataFrame = check_and_cast<Ieee80211DataFrame *>(frame);
156  if (dataFrame->getAMsduPresent()) {
157  auto subframes = aMsduDeaggregation->deaggregateFrame(dataFrame);
158  for (auto subframe : *subframes)
159  deaggregatedFrames.push_back(subframe);
160  delete subframes;
161  }
162  else
163  deaggregatedFrames.push_back(dataFrame);
164  }
165  }
166  // TODO: MSDU Integrity, Replay Detection, RX MSDU Rate Limiting
167  return deaggregatedFrames;
168  }
169  return std::vector<Ieee80211Frame*>();
170 }
int8_t Tid
Definition: Ieee80211Defs.h:28
std::map< SequenceNumber, Fragments > ReorderBuffer
Definition: BlockAckReordering.h:36
IMsduDeaggregation * aMsduDeaggregation
Definition: RecipientQoSMacDataService.h:46
virtual Ieee80211DataFrame * defragment(std::vector< Ieee80211DataFrame * > completeFragments)
Definition: RecipientQoSMacDataService.cc:39
BlockAckReordering * blockAckReordering
Definition: RecipientQoSMacDataService.h:44
ReorderBuffer processReceivedBlockAckReq(Ieee80211BlockAckReq *frame)
Definition: BlockAckReordering.cc:63
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
virtual std::vector< Ieee80211DataFrame * > * deaggregateFrame(Ieee80211DataFrame *frame)=0
std::vector< Ieee80211Frame * > inet::ieee80211::RecipientQoSMacDataService::dataFrameReceived ( Ieee80211DataFrame dataFrame,
IRecipientBlockAckAgreementHandler blockAckAgreementHandler 
)
overridevirtual

Implements inet::ieee80211::IRecipientQoSMacDataService.

56 {
57  // TODO: A-MPDU Deaggregation, MPDU Header+CRC Validation, Address1 Filtering, Duplicate Removal, MPDU Decryption
58  if (duplicateRemoval && duplicateRemoval->isDuplicate(dataFrame)) {
59  delete dataFrame;
60  return std::vector<Ieee80211Frame*>();
61  }
63  frames[dataFrame->getSequenceNumber()].push_back(dataFrame);
64  if (blockAckReordering && blockAckAgreementHandler) {
65  Tid tid = dataFrame->getTid();
66  MACAddress originatorAddr = dataFrame->getTransmitterAddress();
67  RecipientBlockAckAgreement *agreement = blockAckAgreementHandler->getAgreement(tid, originatorAddr);
68  if (agreement)
69  frames = blockAckReordering->processReceivedQoSFrame(agreement, dataFrame);
70  }
71  std::vector<Ieee80211Frame *> defragmentedFrames;
72  if (basicReassembly) { // FIXME: defragmentation
73  for (auto it : frames) {
74  auto fragments = it.second;
75  Ieee80211DataFrame *frame = defragment(fragments);
76  // TODO: revise
77  if (frame)
78  defragmentedFrames.push_back(frame);
79  }
80  }
81  else {
82  for (auto it : frames) {
83  auto fragments = it.second;
84  if (fragments.size() == 1)
85  defragmentedFrames.push_back(fragments.at(0));
86  else ; // TODO: drop?
87  }
88  }
89  std::vector<Ieee80211Frame *> deaggregatedFrames;
90  if (aMsduDeaggregation) {
91  for (auto frame : defragmentedFrames) {
92  auto dataFrame = check_and_cast<Ieee80211DataFrame *>(frame);
93  if (dataFrame->getAMsduPresent()) {
94  auto subframes = aMsduDeaggregation->deaggregateFrame(dataFrame);
95  for (auto subframe : *subframes)
96  deaggregatedFrames.push_back(subframe);
97  delete subframes;
98  }
99  else
100  deaggregatedFrames.push_back(dataFrame);
101  }
102  }
103  // TODO: MSDU Integrity, Replay Detection, RX MSDU Rate Limiting
104  return deaggregatedFrames;
105 }
int8_t Tid
Definition: Ieee80211Defs.h:28
std::map< SequenceNumber, Fragments > ReorderBuffer
Definition: BlockAckReordering.h:36
IMsduDeaggregation * aMsduDeaggregation
Definition: RecipientQoSMacDataService.h:46
virtual Ieee80211DataFrame * defragment(std::vector< Ieee80211DataFrame * > completeFragments)
Definition: RecipientQoSMacDataService.cc:39
BlockAckReordering * blockAckReordering
Definition: RecipientQoSMacDataService.h:44
ReorderBuffer processReceivedQoSFrame(RecipientBlockAckAgreement *agreement, Ieee80211DataFrame *dataFrame)
Definition: BlockAckReordering.cc:27
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
IDuplicateRemoval * duplicateRemoval
Definition: RecipientQoSMacDataService.h:42
virtual bool isDuplicate(Ieee80211DataOrMgmtFrame *frame)=0
virtual std::vector< Ieee80211DataFrame * > * deaggregateFrame(Ieee80211DataFrame *frame)=0
Ieee80211DataFrame * inet::ieee80211::RecipientQoSMacDataService::defragment ( std::vector< Ieee80211DataFrame * >  completeFragments)
protectedvirtual

Referenced by controlFrameReceived(), dataFrameReceived(), and managementFrameReceived().

40 {
41  for (auto fragment : completeFragments)
42  if (auto completeFrame = dynamic_cast<Ieee80211DataFrame*>(basicReassembly->addFragment(fragment)))
43  return completeFrame;
44  return nullptr;
45 }
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
virtual Ieee80211DataOrMgmtFrame * addFragment(Ieee80211DataOrMgmtFrame *frame) override
Add a fragment to the reassembly buffer.
Definition: BasicReassembly.cc:29
Ieee80211ManagementFrame * inet::ieee80211::RecipientQoSMacDataService::defragment ( Ieee80211ManagementFrame mgmtFragment)
protected
48 {
49  if (auto completeFrame = dynamic_cast<Ieee80211ManagementFrame *>(basicReassembly->addFragment(mgmtFragment)))
50  return completeFrame;
51  else
52  return nullptr;
53 }
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
virtual Ieee80211DataOrMgmtFrame * addFragment(Ieee80211DataOrMgmtFrame *frame) override
Add a fragment to the reassembly buffer.
Definition: BasicReassembly.cc:29
void inet::ieee80211::RecipientQoSMacDataService::initialize ( )
overrideprotectedvirtual
32 {
33  duplicateRemoval = new QoSDuplicateRemoval();
34  basicReassembly = new BasicReassembly();
35  aMsduDeaggregation = new MsduDeaggregation();
36  blockAckReordering = new BlockAckReordering();
37 }
IMsduDeaggregation * aMsduDeaggregation
Definition: RecipientQoSMacDataService.h:46
BlockAckReordering * blockAckReordering
Definition: RecipientQoSMacDataService.h:44
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
IDuplicateRemoval * duplicateRemoval
Definition: RecipientQoSMacDataService.h:42
std::vector< Ieee80211Frame * > inet::ieee80211::RecipientQoSMacDataService::managementFrameReceived ( Ieee80211ManagementFrame mgmtFrame)
overridevirtual

Implements inet::ieee80211::IRecipientQoSMacDataService.

108 {
109  // TODO: MPDU Header+CRC Validation, Address1 Filtering, Duplicate Removal, MPDU Decryption
110  if (duplicateRemoval && duplicateRemoval->isDuplicate(mgmtFrame))
111  return std::vector<Ieee80211Frame*>();
112  if (basicReassembly) { // FIXME: defragmentation
113  mgmtFrame = defragment(mgmtFrame);
114  }
115  if (auto delba = dynamic_cast<Ieee80211Delba *>(mgmtFrame))
117  // TODO: Defrag, MSDU Integrity, Replay Detection, RX MSDU Rate Limiting
118  return std::vector<Ieee80211Frame*>({mgmtFrame});
119 }
virtual Ieee80211DataFrame * defragment(std::vector< Ieee80211DataFrame * > completeFragments)
Definition: RecipientQoSMacDataService.cc:39
BlockAckReordering * blockAckReordering
Definition: RecipientQoSMacDataService.h:44
BasicReassembly * basicReassembly
Definition: RecipientQoSMacDataService.h:37
IDuplicateRemoval * duplicateRemoval
Definition: RecipientQoSMacDataService.h:42
virtual bool isDuplicate(Ieee80211DataOrMgmtFrame *frame)=0
void processReceivedDelba(Ieee80211Delba *delba)
Definition: BlockAckReordering.cc:211

Member Data Documentation

IMsduDeaggregation* inet::ieee80211::RecipientQoSMacDataService::aMsduDeaggregation = nullptr
protected
BasicReassembly* inet::ieee80211::RecipientQoSMacDataService::basicReassembly = nullptr
protected
BlockAckReordering* inet::ieee80211::RecipientQoSMacDataService::blockAckReordering = nullptr
protected
IDefragmentation* inet::ieee80211::RecipientQoSMacDataService::defragmentation = nullptr
protected
IDuplicateRemoval* inet::ieee80211::RecipientQoSMacDataService::duplicateRemoval = nullptr
protected

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