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

#include <MsduDeaggregation.h>

Inheritance diagram for inet::ieee80211::MsduDeaggregation:
inet::ieee80211::IMsduDeaggregation

Public Member Functions

virtual std::vector< Ieee80211DataFrame * > * deaggregateFrame (Ieee80211DataFrame *frame) override
 
- Public Member Functions inherited from inet::ieee80211::IMsduDeaggregation
virtual ~IMsduDeaggregation ()
 

Protected Member Functions

virtual void setExplodedFrameAddress (Ieee80211DataFrame *frame, Ieee80211MsduSubframe *subframe, Ieee80211DataFrame *aMsduFrame)
 

Member Function Documentation

std::vector< Ieee80211DataFrame * > * inet::ieee80211::MsduDeaggregation::deaggregateFrame ( Ieee80211DataFrame frame)
overridevirtual

Implements inet::ieee80211::IMsduDeaggregation.

56 {
57  std::vector<Ieee80211DataFrame *> *frames = new std::vector<Ieee80211DataFrame *>();
58  Ieee80211AMsdu *aMsdu = check_and_cast<Ieee80211AMsdu *>(frame->getEncapsulatedPacket());
59  int tid = frame->getTid();
60  int numOfSubframes = aMsdu->getSubframesArraySize();
61  for (int i = 0; i < numOfSubframes; i++)
62  {
63  Ieee80211MsduSubframe msduSubframe = aMsdu->getSubframes(i);
64  cPacket *msdu = msduSubframe.decapsulate();
65  Ieee80211DataFrame *dataFrame = nullptr;
66  // TODO: review, restore snap header, see Ieee80211MsduSubframe
67  dataFrame = (msduSubframe.getEtherType() != -1) ? new Ieee80211DataFrameWithSNAP(msduSubframe.getName()) : new Ieee80211DataFrame(msduSubframe.getName());
68  dataFrame->setType(ST_DATA_WITH_QOS);
69  dataFrame->addBitLength(QOSCONTROL_BITS);
70  dataFrame->setTransmitterAddress(msduSubframe.getSa());
71  dataFrame->setToDS(frame->getToDS());
72  dataFrame->setFromDS(frame->getFromDS());
73  dataFrame->setTid(tid);
74  // TODO: review, restore snap header, see Ieee80211MsduSubframe
75  if (auto dataFrameWithSnap = dynamic_cast<Ieee80211DataFrameWithSNAP*>(dataFrame))
76  dataFrameWithSnap->setEtherType(msduSubframe.getEtherType());
77  dataFrame->encapsulate(msdu);
78  setExplodedFrameAddress(dataFrame, &msduSubframe, frame);
79  frames->push_back(dataFrame);
80  }
81  delete frame;
82  return frames;
83 }
virtual void setExplodedFrameAddress(Ieee80211DataFrame *frame, Ieee80211MsduSubframe *subframe, Ieee80211DataFrame *aMsduFrame)
Definition: MsduDeaggregation.cc:25
Definition: Ieee80211Frame_m.h:117
const unsigned int QOSCONTROL_BITS
Definition: Ieee80211Frame_m.h:48
void inet::ieee80211::MsduDeaggregation::setExplodedFrameAddress ( Ieee80211DataFrame frame,
Ieee80211MsduSubframe subframe,
Ieee80211DataFrame aMsduFrame 
)
protectedvirtual

Referenced by deaggregateFrame().

26 {
27  bool toDS = aMsduFrame->getToDS();
28  bool fromDS = aMsduFrame->getFromDS();
29  if (fromDS == 0 && toDS == 0) // STA to STA
30  {
31  frame->setTransmitterAddress(aMsduFrame->getTransmitterAddress());
32  frame->setReceiverAddress(aMsduFrame->getReceiverAddress());
33  }
34  else if (fromDS == 1 && toDS == 0) // AP to STA
35  {
36  frame->setTransmitterAddress(frame->getTransmitterAddress());
37  frame->setReceiverAddress(subframe->getDa());
38  frame->setAddress3(subframe->getSa());
39  }
40  else if (fromDS == 0 && toDS == 1) // STA to AP
41  {
42  frame->setTransmitterAddress(subframe->getSa());
43  frame->setReceiverAddress(aMsduFrame->getReceiverAddress());
44  frame->setAddress3(subframe->getDa());
45  }
46  else if (fromDS == 1 && toDS == 1) // AP to AP
47  {
48  frame->setReceiverAddress(aMsduFrame->getReceiverAddress());
49  frame->setTransmitterAddress(aMsduFrame->getTransmitterAddress());
50  frame->setAddress3(subframe->getDa());
51  frame->setAddress4(subframe->getSa());
52  }
53 }

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