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

Used in 802.11 infrastructure mode: handles management frames for a station (STA). More...

#include <Ieee80211MgmtSTASimplified.h>

Inheritance diagram for inet::ieee80211::Ieee80211MgmtSTASimplified:
inet::ieee80211::Ieee80211MgmtBase inet::ILifecycle

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int) override
 
virtual void handleTimer (cMessage *msg) override
 Implements abstract Ieee80211MgmtBase method. More...
 
virtual void handleUpperMessage (cPacket *msg) override
 Implements abstract Ieee80211MgmtBase method. More...
 
virtual void handleCommand (int msgkind, cObject *ctrl) override
 Implements abstract Ieee80211MgmtBase method – throws an error (no commands supported) More...
 
virtual Ieee80211DataFrameencapsulate (cPacket *msg)
 Utility function for handleUpperMessage() More...
 
virtual cPacket * decapsulate (Ieee80211DataFrame *frame)
 Utility method to decapsulate a data frame. More...
 
Processing of different frame types
virtual void handleDataFrame (Ieee80211DataFrame *frame) override
 
virtual void handleAuthenticationFrame (Ieee80211AuthenticationFrame *frame) override
 
virtual void handleDeauthenticationFrame (Ieee80211DeauthenticationFrame *frame) override
 
virtual void handleAssociationRequestFrame (Ieee80211AssociationRequestFrame *frame) override
 
virtual void handleAssociationResponseFrame (Ieee80211AssociationResponseFrame *frame) override
 
virtual void handleReassociationRequestFrame (Ieee80211ReassociationRequestFrame *frame) override
 
virtual void handleReassociationResponseFrame (Ieee80211ReassociationResponseFrame *frame) override
 
virtual void handleDisassociationFrame (Ieee80211DisassociationFrame *frame) override
 
virtual void handleBeaconFrame (Ieee80211BeaconFrame *frame) override
 
virtual void handleProbeRequestFrame (Ieee80211ProbeRequestFrame *frame) override
 
virtual void handleProbeResponseFrame (Ieee80211ProbeResponseFrame *frame) override
 
- Protected Member Functions inherited from inet::ieee80211::Ieee80211MgmtBase
virtual void handleMessage (cMessage *msg) override
 Dispatches incoming messages to handleTimer(), handleUpperMessage() or processFrame(). More...
 
virtual void sendDown (cPacket *frame)
 Utility method for implementing handleUpperMessage(): send message to MAC. More...
 
virtual void dropManagementFrame (Ieee80211ManagementFrame *frame)
 Utility method to dispose of an unhandled frame. More...
 
virtual void sendUp (cMessage *msg)
 Utility method: sends the packet to the upper layer. More...
 
virtual void processFrame (Ieee80211DataOrMgmtFrame *frame)
 Dispatch to frame processing methods according to frame type. More...
 
virtual void start ()
 lifecycle support More...
 
virtual void stop ()
 

Protected Attributes

MACAddress accessPointAddress
 
int receiveSequence
 
- Protected Attributes inherited from inet::ieee80211::Ieee80211MgmtBase
MACAddress myAddress
 
bool isOperational
 
long numDataFramesReceived
 
long numMgmtFramesReceived
 
long numMgmtFramesDropped
 

Additional Inherited Members

- Public Member Functions inherited from inet::ieee80211::Ieee80211MgmtBase
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 

Detailed Description

Used in 802.11 infrastructure mode: handles management frames for a station (STA).

See corresponding NED file for a detailed description. This implementation ignores many details.

Author
Andras Varga

Member Function Documentation

cPacket * inet::ieee80211::Ieee80211MgmtSTASimplified::decapsulate ( Ieee80211DataFrame frame)
protectedvirtual

Utility method to decapsulate a data frame.

Referenced by handleDataFrame().

87 {
88  cPacket *payload = frame->decapsulate();
89 
90  Ieee802Ctrl *ctrl = new Ieee802Ctrl();
91  ctrl->setSrc(frame->getAddress3());
92  ctrl->setDest(frame->getReceiverAddress());
93  if (frame->getType() == ST_DATA_WITH_QOS) {
94  int tid = frame->getTid();
95  if (tid < 8)
96  ctrl->setUserPriority(tid); // TID values 0..7 are UP
97  }
98  Ieee80211DataFrameWithSNAP *frameWithSNAP = dynamic_cast<Ieee80211DataFrameWithSNAP *>(frame);
99  if (frameWithSNAP)
100  ctrl->setEtherType(frameWithSNAP->getEtherType());
101  payload->setControlInfo(ctrl);
102 
103  delete frame;
104  return payload;
105 }
Definition: Ieee80211Frame_m.h:117
Ieee80211DataFrame * inet::ieee80211::Ieee80211MgmtSTASimplified::encapsulate ( cPacket *  msg)
protectedvirtual

Utility function for handleUpperMessage()

Referenced by handleUpperMessage().

59 {
60  Ieee80211DataFrameWithSNAP *frame = new Ieee80211DataFrameWithSNAP(msg->getName());
61 
62  // frame goes to the AP
63  frame->setToDS(true);
64 
65  // receiver is the AP
66  frame->setReceiverAddress(accessPointAddress);
67 
68  // destination address is in address3
69  Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl *>(msg->removeControlInfo());
70  ASSERT(!ctrl->getDest().isUnspecified());
71  frame->setAddress3(ctrl->getDest());
72  frame->setEtherType(ctrl->getEtherType());
73  int up = ctrl->getUserPriority();
74  if (up >= 0) {
75  // make it a QoS frame, and set TID
76  frame->setType(ST_DATA_WITH_QOS);
77  frame->addBitLength(QOSCONTROL_BITS);
78  frame->setTid(up);
79  }
80  delete ctrl;
81 
82  frame->encapsulate(msg);
83  return frame;
84 }
Definition: Ieee80211Frame_m.h:117
MACAddress accessPointAddress
Definition: Ieee80211MgmtSTASimplified.h:40
const unsigned int QOSCONTROL_BITS
Definition: Ieee80211Frame_m.h:48
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleAssociationRequestFrame ( Ieee80211AssociationRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

123 {
124  dropManagementFrame(frame);
125 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleAssociationResponseFrame ( Ieee80211AssociationResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

128 {
129  dropManagementFrame(frame);
130 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleAuthenticationFrame ( Ieee80211AuthenticationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

113 {
114  dropManagementFrame(frame);
115 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleBeaconFrame ( Ieee80211BeaconFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

148 {
149  dropManagementFrame(frame);
150 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleCommand ( int  msgkind,
cObject *  ctrl 
)
overrideprotectedvirtual

Implements abstract Ieee80211MgmtBase method – throws an error (no commands supported)

Implements inet::ieee80211::Ieee80211MgmtBase.

54 {
55  throw cRuntimeError("handleCommand(): no commands supported");
56 }
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleDataFrame ( Ieee80211DataFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

108 {
109  sendUp(decapsulate(frame));
110 }
virtual void sendUp(cMessage *msg)
Utility method: sends the packet to the upper layer.
Definition: Ieee80211MgmtBase.cc:97
virtual cPacket * decapsulate(Ieee80211DataFrame *frame)
Utility method to decapsulate a data frame.
Definition: Ieee80211MgmtSTASimplified.cc:86
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleDeauthenticationFrame ( Ieee80211DeauthenticationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

118 {
119  dropManagementFrame(frame);
120 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleDisassociationFrame ( Ieee80211DisassociationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

143 {
144  dropManagementFrame(frame);
145 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleProbeRequestFrame ( Ieee80211ProbeRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

153 {
154  dropManagementFrame(frame);
155 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleProbeResponseFrame ( Ieee80211ProbeResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

158 {
159  dropManagementFrame(frame);
160 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleReassociationRequestFrame ( Ieee80211ReassociationRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

133 {
134  dropManagementFrame(frame);
135 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleReassociationResponseFrame ( Ieee80211ReassociationResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

138 {
139  dropManagementFrame(frame);
140 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleTimer ( cMessage *  msg)
overrideprotectedvirtual

Implements abstract Ieee80211MgmtBase method.

Implements inet::ieee80211::Ieee80211MgmtBase.

38 {
39  ASSERT(false);
40 }
void inet::ieee80211::Ieee80211MgmtSTASimplified::handleUpperMessage ( cPacket *  msg)
overrideprotectedvirtual

Implements abstract Ieee80211MgmtBase method.

Implements inet::ieee80211::Ieee80211MgmtBase.

43 {
45  EV << "STA is not associated with an access point, discarding packet " << msg << "\n";
46  delete msg;
47  return;
48  }
49  Ieee80211DataFrame *frame = encapsulate(msg);
50  sendDown(frame);
51 }
virtual void sendDown(cPacket *frame)
Utility method for implementing handleUpperMessage(): send message to MAC.
Definition: Ieee80211MgmtBase.cc:84
bool isUnspecified() const
Returns true if all address bytes are zero.
Definition: MACAddress.h:151
virtual Ieee80211DataFrame * encapsulate(cPacket *msg)
Utility function for handleUpperMessage()
Definition: Ieee80211MgmtSTASimplified.cc:58
MACAddress accessPointAddress
Definition: Ieee80211MgmtSTASimplified.h:40
void inet::ieee80211::Ieee80211MgmtSTASimplified::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::Ieee80211MgmtBase.

28 {
30 
31  if (stage == INITSTAGE_LOCAL) {
32  accessPointAddress.setAddress(par("accessPointAddress").stringValue());
33  receiveSequence = 0;
34  }
35 }
int receiveSequence
Definition: Ieee80211MgmtSTASimplified.h:41
Local initializations.
Definition: InitStages.h:35
void setAddress(const char *hexstr)
Converts address value from hex string (12 hex digits, may also contain spaces, hyphens and colons) ...
Definition: MACAddress.cc:102
MACAddress accessPointAddress
Definition: Ieee80211MgmtSTASimplified.h:40
#define stringValue()
Definition: NedFunctions.cc:24
virtual void initialize(int) override
Definition: Ieee80211MgmtBase.cc:30
virtual int inet::ieee80211::Ieee80211MgmtSTASimplified::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::Ieee80211MgmtBase.

44 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116

Member Data Documentation

MACAddress inet::ieee80211::Ieee80211MgmtSTASimplified::accessPointAddress
protected
int inet::ieee80211::Ieee80211MgmtSTASimplified::receiveSequence
protected

Referenced by initialize().


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