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

#include <BasicMsduAggregationPolicy.h>

Inheritance diagram for inet::ieee80211::BasicMsduAggregationPolicy:
inet::ieee80211::IMsduAggregationPolicy

Public Member Functions

virtual std::vector< Ieee80211DataFrame * > * computeAggregateFrames (cQueue *queue) override
 
- Public Member Functions inherited from inet::ieee80211::IMsduAggregationPolicy
virtual ~IMsduAggregationPolicy ()
 

Protected Member Functions

virtual void initialize () override
 
virtual bool isAggregationPossible (int numOfFramesToAggragate, int aMsduLength)
 
virtual bool isEligible (Ieee80211DataFrame *frame, Ieee80211DataFrame *testFrame, int aMsduLength)
 

Protected Attributes

bool qOsCheck = false
 
int subframeNumThreshold = -1
 
int aggregationLengthThreshold = -1
 
int maxAMsduSize = -1
 

Member Function Documentation

std::vector< Ieee80211DataFrame * > * inet::ieee80211::BasicMsduAggregationPolicy::computeAggregateFrames ( cQueue *  queue)
overridevirtual

Implements inet::ieee80211::IMsduAggregationPolicy.

70 {
71  ASSERT(!queue->isEmpty());
72  int aMsduLength = 0;
73  auto firstFrame = dynamic_cast<Ieee80211DataFrame *>(queue->front());
74  auto frames = new std::vector<Ieee80211DataFrame *>();
75  for (cQueue::Iterator it(*queue); !it.end(); it++)
76  {
77  auto dataFrame = dynamic_cast<Ieee80211DataFrame *>(*it);
78  if (!dataFrame || !isEligible(dataFrame, firstFrame, aMsduLength))
79  break;
80  frames->push_back(dataFrame);
81  aMsduLength += dataFrame->getEncapsulatedPacket()->getByteLength() + LENGTH_A_MSDU_SUBFRAME_HEADER / 8; // sum of MSDU lengths + subframe header
82  }
83  if (frames->size() <= 1 || !isAggregationPossible(frames->size(), aMsduLength)) {
84  delete frames;
85  return nullptr;
86  }
87  else
88  return frames;
89 }
virtual bool isEligible(Ieee80211DataFrame *frame, Ieee80211DataFrame *testFrame, int aMsduLength)
Definition: BasicMsduAggregationPolicy.cc:39
virtual bool isAggregationPossible(int numOfFramesToAggragate, int aMsduLength)
Definition: BasicMsduAggregationPolicy.cc:33
const unsigned int LENGTH_A_MSDU_SUBFRAME_HEADER
Definition: Ieee80211Frame_m.h:51
void inet::ieee80211::BasicMsduAggregationPolicy::initialize ( )
overrideprotectedvirtual
26 {
27  subframeNumThreshold = par("subframeNumThreshold");
28  aggregationLengthThreshold = par("aggregationLengthThreshold");
29  maxAMsduSize = par("maxAMsduSize");
30  qOsCheck = par("qOsCheck");
31 }
bool qOsCheck
Definition: BasicMsduAggregationPolicy.h:29
int subframeNumThreshold
Definition: BasicMsduAggregationPolicy.h:30
int aggregationLengthThreshold
Definition: BasicMsduAggregationPolicy.h:31
int maxAMsduSize
Definition: BasicMsduAggregationPolicy.h:32
bool inet::ieee80211::BasicMsduAggregationPolicy::isAggregationPossible ( int  numOfFramesToAggragate,
int  aMsduLength 
)
protectedvirtual

Referenced by computeAggregateFrames().

34 {
35  return ((subframeNumThreshold == -1 || subframeNumThreshold <= numOfFramesToAggragate) &&
36  (aggregationLengthThreshold == -1 || aggregationLengthThreshold <= aMsduLength));
37 }
int subframeNumThreshold
Definition: BasicMsduAggregationPolicy.h:30
int aggregationLengthThreshold
Definition: BasicMsduAggregationPolicy.h:31
bool inet::ieee80211::BasicMsduAggregationPolicy::isEligible ( Ieee80211DataFrame frame,
Ieee80211DataFrame testFrame,
int  aMsduLength 
)
protectedvirtual

Referenced by computeAggregateFrames().

40 {
41 // Only QoS data frames have a TID.
42  if (qOsCheck && frame->getType() != ST_DATA_WITH_QOS)
43  return false;
44 
45 // The maximum MPDU length that can be transported using A-MPDU aggregation is 4095 octets. An
46 // A-MSDU cannot be fragmented. Therefore, an A-MSDU of a length that exceeds 4065 octets (
47 // 4095 minus the QoS data MPDU overhead) cannot be transported in an A-MPDU.
48  if (aMsduLength + testFrame->getEncapsulatedPacket()->getByteLength() + LENGTH_A_MSDU_SUBFRAME_HEADER / 8 > maxAMsduSize) // default value of maxAMsduSize is 4065
49  return false;
50 
51 // The value of TID present in the QoS Control field of the MPDU carrying the A-MSDU indicates the TID for
52 // all MSDUs in the A-MSDU. Because this value of TID is common to all MSDUs in the A-MSDU, only MSDUs
53 // delivered to the MAC by an MA-UNITDATA.request primitive with an integer priority parameter that maps
54 // to the same TID can be aggregated together using A-MSDU.
55  if (testFrame->getTid() != frame->getTid())
56  return false;
57 
58 // An A-MSDU contains only MSDUs whose DA and SA parameter values map to the same receiver address
59 // (RA) and transmitter address (TA) values, i.e., all the MSDUs are intended to be received by a single
60 // receiver, and necessarily they are all transmitted by the same transmitter. The rules for determining RA and
61 // TA are independent of whether the frame body carries an A-MSDU.
62  if (testFrame->getReceiverAddress() != frame->getReceiverAddress() ||
63  testFrame->getTransmitterAddress() != frame->getTransmitterAddress())
64  return false;
65 
66  return true;
67 }
bool qOsCheck
Definition: BasicMsduAggregationPolicy.h:29
Definition: Ieee80211Frame_m.h:117
const unsigned int LENGTH_A_MSDU_SUBFRAME_HEADER
Definition: Ieee80211Frame_m.h:51
int maxAMsduSize
Definition: BasicMsduAggregationPolicy.h:32

Member Data Documentation

int inet::ieee80211::BasicMsduAggregationPolicy::aggregationLengthThreshold = -1
protected
int inet::ieee80211::BasicMsduAggregationPolicy::maxAMsduSize = -1
protected

Referenced by initialize(), and isEligible().

bool inet::ieee80211::BasicMsduAggregationPolicy::qOsCheck = false
protected

Referenced by initialize(), and isEligible().

int inet::ieee80211::BasicMsduAggregationPolicy::subframeNumThreshold = -1
protected

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