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

#include <Fragmentation.h>

Inheritance diagram for inet::ieee80211::Fragmentation:
inet::ieee80211::IFragmentation

Public Member Functions

virtual std::vector< Ieee80211DataOrMgmtFrame * > * fragmentFrame (Ieee80211DataOrMgmtFrame *frame, const std::vector< int > &fragmentSizes) override
 
- Public Member Functions inherited from inet::ieee80211::IFragmentation
virtual ~IFragmentation ()
 

Member Function Documentation

std::vector< Ieee80211DataOrMgmtFrame * > * inet::ieee80211::Fragmentation::fragmentFrame ( Ieee80211DataOrMgmtFrame frame,
const std::vector< int > &  fragmentSizes 
)
overridevirtual

Implements inet::ieee80211::IFragmentation.

27 {
28  // Notes:
29  // 1. only the MSDU is carried in the fragments (i.e. only frame's payload, without the 802.11 header)
30  // 3. for convenience, this implementation sends the original frame encapsulated in the last fragment, all other fragments are dummies with no data
31  //
32  std::vector<Ieee80211DataOrMgmtFrame *> *fragments = new std::vector<Ieee80211DataOrMgmtFrame *>();
33 
34  cPacket *payload = frame->decapsulate();
35  Ieee80211DataOrMgmtFrame *fragmentHeader = frame->dup();
36  frame->encapsulate(payload); // restore original state
37 
38  for (int i = 0; i < (int)fragmentSizes.size(); i++) {
39  bool lastFragment = i == (int)fragmentSizes.size() - 1;
40  Ieee80211DataOrMgmtFrame *fragment = fragmentHeader->dup();
41  fragment->setFragmentNumber(i);
42  fragment->setMoreFragments(!lastFragment);
43  if (lastFragment)
44  fragment->encapsulate(frame); // TODO: khm, 802.11 in 802.11, convenient but wrong
45  fragment->setByteLength(fragmentSizes.at(i));
46  fragments->push_back(fragment);
47  }
48  delete fragmentHeader;
49  return fragments;
50 }

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