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

Used in 802.11 ad-hoc mode. More...

#include <Ieee80211MgmtAdhoc.h>

Inheritance diagram for inet::ieee80211::Ieee80211MgmtAdhoc:
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 ()
 

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 ()
 
- Protected Attributes inherited from inet::ieee80211::Ieee80211MgmtBase
MACAddress myAddress
 
bool isOperational
 
long numDataFramesReceived
 
long numMgmtFramesReceived
 
long numMgmtFramesDropped
 

Detailed Description

Used in 802.11 ad-hoc mode.

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

Author
Andras Varga

Member Function Documentation

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

Utility method to decapsulate a data frame.

Referenced by handleDataFrame().

70 {
71  cPacket *payload = frame->decapsulate();
72 
73  Ieee802Ctrl *ctrl = new Ieee802Ctrl();
74  ctrl->setSrc(frame->getTransmitterAddress());
75  ctrl->setDest(frame->getReceiverAddress());
76  int tid = frame->getTid();
77  if (tid < 8)
78  ctrl->setUserPriority(tid); // TID values 0..7 are UP
79  Ieee80211DataFrameWithSNAP *frameWithSNAP = dynamic_cast<Ieee80211DataFrameWithSNAP *>(frame);
80  if (frameWithSNAP)
81  ctrl->setEtherType(frameWithSNAP->getEtherType());
82  payload->setControlInfo(ctrl);
83 
84  delete frame;
85  return payload;
86 }
Ieee80211DataFrame * inet::ieee80211::Ieee80211MgmtAdhoc::encapsulate ( cPacket *  msg)
protectedvirtual

Utility function for handleUpperMessage()

Referenced by handleUpperMessage().

49 {
50  Ieee80211DataFrameWithSNAP *frame = new Ieee80211DataFrameWithSNAP(msg->getName());
51 
52  // copy receiver address from the control info (sender address will be set in MAC)
53  Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl *>(msg->removeControlInfo());
54  frame->setReceiverAddress(ctrl->getDest());
55  frame->setEtherType(ctrl->getEtherType());
56  int up = ctrl->getUserPriority();
57  if (up >= 0) {
58  // make it a QoS frame, and set TID
59  frame->setType(ST_DATA_WITH_QOS);
60  frame->addBitLength(QOSCONTROL_BITS);
61  frame->setTid(up);
62  }
63  delete ctrl;
64 
65  frame->encapsulate(msg);
66  return frame;
67 }
Definition: Ieee80211Frame_m.h:117
const unsigned int QOSCONTROL_BITS
Definition: Ieee80211Frame_m.h:48
void inet::ieee80211::Ieee80211MgmtAdhoc::handleAssociationRequestFrame ( Ieee80211AssociationRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

104 {
105  dropManagementFrame(frame);
106 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleAssociationResponseFrame ( Ieee80211AssociationResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

109 {
110  dropManagementFrame(frame);
111 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleAuthenticationFrame ( Ieee80211AuthenticationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

94 {
95  dropManagementFrame(frame);
96 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleBeaconFrame ( Ieee80211BeaconFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

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

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

Implements inet::ieee80211::Ieee80211MgmtBase.

44 {
45  throw cRuntimeError("handleCommand(): no commands supported");
46 }
void inet::ieee80211::Ieee80211MgmtAdhoc::handleDataFrame ( Ieee80211DataFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

89 {
90  sendUp(decapsulate(frame));
91 }
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: Ieee80211MgmtAdhoc.cc:69
void inet::ieee80211::Ieee80211MgmtAdhoc::handleDeauthenticationFrame ( Ieee80211DeauthenticationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

99 {
100  dropManagementFrame(frame);
101 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleDisassociationFrame ( Ieee80211DisassociationFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

124 {
125  dropManagementFrame(frame);
126 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleProbeRequestFrame ( Ieee80211ProbeRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

134 {
135  dropManagementFrame(frame);
136 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleProbeResponseFrame ( Ieee80211ProbeResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

139 {
140  dropManagementFrame(frame);
141 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleReassociationRequestFrame ( Ieee80211ReassociationRequestFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

114 {
115  dropManagementFrame(frame);
116 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleReassociationResponseFrame ( Ieee80211ReassociationResponseFrame frame)
overrideprotectedvirtual

Implements inet::ieee80211::Ieee80211MgmtBase.

119 {
120  dropManagementFrame(frame);
121 }
virtual void dropManagementFrame(Ieee80211ManagementFrame *frame)
Utility method to dispose of an unhandled frame.
Definition: Ieee80211MgmtBase.cc:90
void inet::ieee80211::Ieee80211MgmtAdhoc::handleTimer ( cMessage *  msg)
overrideprotectedvirtual

Implements abstract Ieee80211MgmtBase method.

Implements inet::ieee80211::Ieee80211MgmtBase.

33 {
34  ASSERT(false);
35 }
void inet::ieee80211::Ieee80211MgmtAdhoc::handleUpperMessage ( cPacket *  msg)
overrideprotectedvirtual

Implements abstract Ieee80211MgmtBase method.

Implements inet::ieee80211::Ieee80211MgmtBase.

38 {
39  Ieee80211DataFrame *frame = encapsulate(msg);
40  sendDown(frame);
41 }
virtual Ieee80211DataFrame * encapsulate(cPacket *msg)
Utility function for handleUpperMessage()
Definition: Ieee80211MgmtAdhoc.cc:48
virtual void sendDown(cPacket *frame)
Utility method for implementing handleUpperMessage(): send message to MAC.
Definition: Ieee80211MgmtBase.cc:84
void inet::ieee80211::Ieee80211MgmtAdhoc::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::Ieee80211MgmtBase.

28 {
30 }
virtual void initialize(int) override
Definition: Ieee80211MgmtBase.cc:30
virtual int inet::ieee80211::Ieee80211MgmtAdhoc::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::Ieee80211MgmtBase.

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

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