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

#include <AckHandler.h>

Inheritance diagram for inet::ieee80211::AckHandler:
inet::ieee80211::IAckHandler

Public Types

enum  Status {
  Status::FRAME_NOT_YET_TRANSMITTED, Status::NO_ACK_REQUIRED, Status::WAITING_FOR_ACK, Status::ACK_NOT_ARRIVED,
  Status::ACK_ARRIVED
}
 

Public Member Functions

virtual ~AckHandler ()
 
virtual void processReceivedAck (Ieee80211ACKFrame *ack, Ieee80211DataOrMgmtFrame *ackedFrame)
 
virtual void frameGotInProgress (Ieee80211DataOrMgmtFrame *dataOrMgmtFrame) override
 
virtual void processTransmittedDataOrMgmtFrame (Ieee80211DataOrMgmtFrame *frame)
 
virtual Status getAckStatus (Ieee80211DataOrMgmtFrame *frame)
 
virtual bool isEligibleToTransmit (Ieee80211DataOrMgmtFrame *frame) override
 
virtual bool isOutstandingFrame (Ieee80211DataOrMgmtFrame *frame) override
 
virtual int getNumberOfFramesWithStatus (Status status)
 
virtual void processFailedFrame (Ieee80211DataOrMgmtFrame *dataOrMgmtFrame)
 
- Public Member Functions inherited from inet::ieee80211::IAckHandler
virtual ~IAckHandler ()
 

Protected Member Functions

virtual StatusgetAckStatus (SequenceControlField id)
 
std::string getStatusString (Status status)
 
void printAckStatuses ()
 

Protected Attributes

std::map< SequenceControlField, StatusackStatuses
 

Member Enumeration Documentation

Enumerator
FRAME_NOT_YET_TRANSMITTED 
NO_ACK_REQUIRED 
WAITING_FOR_ACK 
ACK_NOT_ARRIVED 
ACK_ARRIVED 
31  {
32  FRAME_NOT_YET_TRANSMITTED,
33  NO_ACK_REQUIRED,
34  WAITING_FOR_ACK,
35  ACK_NOT_ARRIVED,
36  ACK_ARRIVED,
37  };

Constructor & Destructor Documentation

virtual inet::ieee80211::AckHandler::~AckHandler ( )
inlinevirtual
47 { }

Member Function Documentation

void inet::ieee80211::AckHandler::frameGotInProgress ( Ieee80211DataOrMgmtFrame dataOrMgmtFrame)
overridevirtual

Implements inet::ieee80211::IAckHandler.

61 {
62  auto id = SequenceControlField(dataOrMgmtFrame->getSequenceNumber(), dataOrMgmtFrame->getFragmentNumber());
63  Status& status = getAckStatus(id);
64  ASSERT(status != Status::WAITING_FOR_ACK);
66 }
uint16_t id
Definition: TCP_NSC.cc:85
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
virtual Status & getAckStatus(SequenceControlField id)
Definition: AckHandler.cc:23
Status
Definition: AckHandler.h:31
AckHandler::Status & inet::ieee80211::AckHandler::getAckStatus ( SequenceControlField  id)
protectedvirtual

Referenced by frameGotInProgress(), isEligibleToTransmit(), inet::ieee80211::Dcf::originatorProcessFailedFrame(), processFailedFrame(), and processReceivedAck().

24 {
25  auto it = ackStatuses.find(id);
26  if (it == ackStatuses.end()) {
28  return ackStatuses[id];
29  }
30  return it->second;
31 }
uint16_t id
Definition: TCP_NSC.cc:85
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
AckHandler::Status inet::ieee80211::AckHandler::getAckStatus ( Ieee80211DataOrMgmtFrame frame)
virtual
34 {
35  auto id = SequenceControlField(frame->getSequenceNumber(),frame->getFragmentNumber());
36  auto it = ackStatuses.find(id);
37  if (it == ackStatuses.end()) {
40  }
41  return it->second;
42 }
uint16_t id
Definition: TCP_NSC.cc:85
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
int inet::ieee80211::AckHandler::getNumberOfFramesWithStatus ( Status  status)
virtual
80 {
81  int count = 0;
82  for (auto ackStatus : ackStatuses)
83  if (ackStatus.second == status)
84  count++;
85  return count;
86 }
int count(const std::vector< T > &v, const T &a)
Definition: stlutils.h:58
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
std::string inet::ieee80211::AckHandler::getStatusString ( Status  status)
protected

Referenced by printAckStatuses().

97 {
98  switch (status) {
99  case Status::FRAME_NOT_YET_TRANSMITTED : return "FRAME_NOT_YET_TRANSMITTED";
100  case Status::NO_ACK_REQUIRED : return "NO_ACK_REQUIRED";
101  case Status::WAITING_FOR_ACK : return "WAITING_FOR_NORMAL_ACK";
102  case Status::ACK_NOT_ARRIVED : return "NORMAL_ACK_NOT_ARRIVED";
103  case Status::ACK_ARRIVED : return "NORMAL_ACK_ARRIVED";
104  default: throw cRuntimeError("Unknown status");
105  }
106 }
bool inet::ieee80211::AckHandler::isEligibleToTransmit ( Ieee80211DataOrMgmtFrame frame)
overridevirtual
bool inet::ieee80211::AckHandler::isOutstandingFrame ( Ieee80211DataOrMgmtFrame frame)
overridevirtual

Implements inet::ieee80211::IAckHandler.

75 {
76  return false;
77 }
void inet::ieee80211::AckHandler::printAckStatuses ( )
protected
109 {
110  for (auto ackStatus : ackStatuses) {
111  std::cout << "Seq Num = " << ackStatus.first.getSequenceNumber() << " " << "Frag Num = " << (int)ackStatus.first.getFragmentNumber() << std::endl;
112  std::cout << "Status = " << getStatusString(ackStatus.second) << std::endl;
113  }
114  std::cout << "=========================================" << std::endl;
115 }
std::string getStatusString(Status status)
Definition: AckHandler.cc:96
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
void inet::ieee80211::AckHandler::processFailedFrame ( Ieee80211DataOrMgmtFrame dataOrMgmtFrame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessFailedFrame().

90 {
91  ASSERT(getAckStatus(dataOrMgmtFrame) == Status::WAITING_FOR_ACK);
92  auto id = SequenceControlField(dataOrMgmtFrame->getSequenceNumber(), dataOrMgmtFrame->getFragmentNumber());
94 }
uint16_t id
Definition: TCP_NSC.cc:85
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39
virtual Status & getAckStatus(SequenceControlField id)
Definition: AckHandler.cc:23
void inet::ieee80211::AckHandler::processReceivedAck ( Ieee80211ACKFrame ack,
Ieee80211DataOrMgmtFrame ackedFrame 
)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessReceivedFrame().

45 {
46  auto id = SequenceControlField(ackedFrame->getSequenceNumber(), ackedFrame->getFragmentNumber());
47  Status &status = getAckStatus(id);
49  throw cRuntimeError("ackedFrame = %s is not yet transmitted", ackedFrame->getName());
50  status = Status::ACK_ARRIVED;
51 }
virtual Status & getAckStatus(SequenceControlField id)
Definition: AckHandler.cc:23
Status
Definition: AckHandler.h:31
void inet::ieee80211::AckHandler::processTransmittedDataOrMgmtFrame ( Ieee80211DataOrMgmtFrame frame)
virtual

Referenced by inet::ieee80211::Dcf::originatorProcessTransmittedFrame().

54 {
55  // TODO: mgmt with NoAck subfield?
56  auto id = SequenceControlField(frame->getSequenceNumber(),frame->getFragmentNumber());
58 }
uint16_t id
Definition: TCP_NSC.cc:85
std::map< SequenceControlField, Status > ackStatuses
Definition: AckHandler.h:39

Member Data Documentation


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