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

#include <QoSSequenceNumberAssignment.h>

Inheritance diagram for inet::ieee80211::QoSSequenceNumberAssignment:
inet::ieee80211::ISequenceNumberAssignment

Public Member Functions

virtual void assignSequenceNumber (Ieee80211DataOrMgmtFrame *frame) override
 
- Public Member Functions inherited from inet::ieee80211::ISequenceNumberAssignment
virtual ~ISequenceNumberAssignment ()
 

Protected Types

enum  CacheType { SHARED, TIME_PRIORITY, DATA }
 
typedef std::pair< MACAddress, TidKey
 

Protected Member Functions

virtual CacheType getCacheType (Ieee80211DataOrMgmtFrame *frame, bool incoming)
 

Protected Attributes

std::map< Key, SequenceNumberlastSentSeqNums
 
std::map< MACAddress, SequenceNumberlastSentTimePrioritySeqNums
 
std::map< MACAddress, SequenceNumberlastSentSharedSeqNums
 
SequenceNumber lastSentSharedCounterSeqNum = 0
 

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
SHARED 
TIME_PRIORITY 
DATA 
33  {
34  SHARED,
36  DATA
37  };
Definition: QoSSequenceNumberAssignment.h:35
Definition: QoSSequenceNumberAssignment.h:34
Definition: QoSSequenceNumberAssignment.h:36

Member Function Documentation

void inet::ieee80211::QoSSequenceNumberAssignment::assignSequenceNumber ( Ieee80211DataOrMgmtFrame frame)
overridevirtual

Implements inet::ieee80211::ISequenceNumberAssignment.

36 {
37  CacheType type = getCacheType(frame, false);
38  int seqNum;
39  MACAddress address = frame->getReceiverAddress();
40  if (type == TIME_PRIORITY)
41  {
42  // Error in spec?
43  // "QoS STA may use values from additional modulo-4096 counters per <Address 1, TID> for sequence numbers assigned to
44  // time priority management frames." 9.3.2.10 Duplicate detection and recovery, But management frames don't have QoS Control field.
45  auto it = lastSentTimePrioritySeqNums.find(address);
46  if (it == lastSentTimePrioritySeqNums.end())
47  lastSentTimePrioritySeqNums[address] = seqNum = 0;
48  else
49  it->second = seqNum = (it->second + 1) % 4096;
50  }
51  if (type == SHARED)
52  {
53  auto it = lastSentSharedSeqNums.find(address);
54  if (it == lastSentSharedSeqNums.end())
56  else {
57  if (it->second == lastSentSharedCounterSeqNum)
58  lastSentSharedCounterSeqNum = (lastSentSharedCounterSeqNum + 1) % 4096; // make it different from the last sequence number sent to that RA (spec: "add 2")
59  it->second = seqNum = lastSentSharedCounterSeqNum;
60  }
61  }
62  else if (type == DATA)
63  {
64  Ieee80211DataFrame *qosDataFrame = check_and_cast<Ieee80211DataFrame *>(frame);
65  Key key(frame->getReceiverAddress(), qosDataFrame->getTid());
66  auto it = lastSentSeqNums.find(key);
67  if (it == lastSentSeqNums.end())
68  lastSentSeqNums[key] = seqNum = 0;
69  else
70  it->second = seqNum = (it->second + 1) % 4096;
71  }
72  else
73  ASSERT(false);
74 
75  frame->setSequenceNumber(seqNum);
76 }
CacheType
Definition: QoSSequenceNumberAssignment.h:32
std::map< Key, SequenceNumber > lastSentSeqNums
Definition: QoSSequenceNumberAssignment.h:40
Definition: QoSSequenceNumberAssignment.h:35
SequenceNumber lastSentSharedCounterSeqNum
Definition: QoSSequenceNumberAssignment.h:43
Definition: QoSSequenceNumberAssignment.h:34
std::pair< MACAddress, Tid > Key
Definition: QoSSequenceNumberAssignment.h:38
std::map< MACAddress, SequenceNumber > lastSentTimePrioritySeqNums
Definition: QoSSequenceNumberAssignment.h:41
virtual CacheType getCacheType(Ieee80211DataOrMgmtFrame *frame, bool incoming)
Definition: QoSSequenceNumberAssignment.cc:23
std::map< MACAddress, SequenceNumber > lastSentSharedSeqNums
Definition: QoSSequenceNumberAssignment.h:42
Definition: QoSSequenceNumberAssignment.h:36
QoSSequenceNumberAssignment::CacheType inet::ieee80211::QoSSequenceNumberAssignment::getCacheType ( Ieee80211DataOrMgmtFrame frame,
bool  incoming 
)
protectedvirtual

Referenced by assignSequenceNumber().

24 {
25  bool isTimePriorityFrame = false; // TODO
26  const MACAddress& address = incoming ? frame->getTransmitterAddress() : frame->getReceiverAddress();
27  if (isTimePriorityFrame)
28  return TIME_PRIORITY;
29  else if (frame->getType() != ST_DATA_WITH_QOS || address.isMulticast())
30  return SHARED;
31  else
32  return DATA;
33 }
Definition: QoSSequenceNumberAssignment.h:35
Definition: Ieee80211Frame_m.h:117
Definition: QoSSequenceNumberAssignment.h:34
Definition: QoSSequenceNumberAssignment.h:36

Member Data Documentation

std::map<Key, SequenceNumber> inet::ieee80211::QoSSequenceNumberAssignment::lastSentSeqNums
protected

Referenced by assignSequenceNumber().

SequenceNumber inet::ieee80211::QoSSequenceNumberAssignment::lastSentSharedCounterSeqNum = 0
protected

Referenced by assignSequenceNumber().

std::map<MACAddress, SequenceNumber> inet::ieee80211::QoSSequenceNumberAssignment::lastSentSharedSeqNums
protected

Referenced by assignSequenceNumber().

std::map<MACAddress, SequenceNumber> inet::ieee80211::QoSSequenceNumberAssignment::lastSentTimePrioritySeqNums
protected

Referenced by assignSequenceNumber().


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