INET Framework for OMNeT++/OMNEST
inet::ieee80211::Ieee80211MgmtBase Class Referenceabstract

Abstract base class for 802.11 infrastructure mode management components. More...

#include <Ieee80211MgmtBase.h>

Inheritance diagram for inet::ieee80211::Ieee80211MgmtBase:
inet::ILifecycle inet::ieee80211::Ieee80211MgmtAdhoc inet::ieee80211::Ieee80211MgmtAPBase inet::ieee80211::Ieee80211MgmtSTA inet::ieee80211::Ieee80211MgmtSTASimplified inet::ieee80211::Ieee80211MgmtAP inet::ieee80211::Ieee80211MgmtAPSimplified

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int) override
 
virtual void handleMessage (cMessage *msg) override
 Dispatches incoming messages to handleTimer(), handleUpperMessage() or processFrame(). More...
 
virtual void handleTimer (cMessage *frame)=0
 Should be redefined to deal with self-messages. More...
 
virtual void handleUpperMessage (cPacket *msg)=0
 Should be redefined to encapsulate and enqueue msgs from higher layers. More...
 
virtual void handleCommand (int msgkind, cObject *ctrl)=0
 Should be redefined to handle commands from the "agent" (if present) 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...
 
Processing of different frame types
virtual void handleDataFrame (Ieee80211DataFrame *frame)=0
 
virtual void handleAuthenticationFrame (Ieee80211AuthenticationFrame *frame)=0
 
virtual void handleDeauthenticationFrame (Ieee80211DeauthenticationFrame *frame)=0
 
virtual void handleAssociationRequestFrame (Ieee80211AssociationRequestFrame *frame)=0
 
virtual void handleAssociationResponseFrame (Ieee80211AssociationResponseFrame *frame)=0
 
virtual void handleReassociationRequestFrame (Ieee80211ReassociationRequestFrame *frame)=0
 
virtual void handleReassociationResponseFrame (Ieee80211ReassociationResponseFrame *frame)=0
 
virtual void handleDisassociationFrame (Ieee80211DisassociationFrame *frame)=0
 
virtual void handleBeaconFrame (Ieee80211BeaconFrame *frame)=0
 
virtual void handleProbeRequestFrame (Ieee80211ProbeRequestFrame *frame)=0
 
virtual void handleProbeResponseFrame (Ieee80211ProbeResponseFrame *frame)=0
 

Protected Attributes

MACAddress myAddress
 
bool isOperational
 
long numDataFramesReceived
 
long numMgmtFramesReceived
 
long numMgmtFramesDropped
 
virtual void start ()
 lifecycle support More...
 
virtual void stop ()
 
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 

Additional Inherited Members

- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 

Detailed Description

Abstract base class for 802.11 infrastructure mode management components.

Author
Andras Varga

Member Function Documentation

void inet::ieee80211::Ieee80211MgmtBase::dropManagementFrame ( Ieee80211ManagementFrame frame)
protectedvirtual

Utility method to dispose of an unhandled frame.

Referenced by inet::ieee80211::Ieee80211MgmtAPSimplified::handleAssociationRequestFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleAssociationRequestFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleAssociationRequestFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleAssociationResponseFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleAssociationResponseFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleAssociationResponseFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleAuthenticationFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleAuthenticationFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleAuthenticationFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleBeaconFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleBeaconFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleBeaconFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleDeauthenticationFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleDeauthenticationFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleDeauthenticationFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleDisassociationFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleDisassociationFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleDisassociationFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleProbeRequestFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleProbeRequestFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleProbeRequestFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleProbeResponseFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleProbeResponseFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleProbeResponseFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleReassociationRequestFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleReassociationRequestFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleReassociationRequestFrame(), inet::ieee80211::Ieee80211MgmtAPSimplified::handleReassociationResponseFrame(), inet::ieee80211::Ieee80211MgmtAdhoc::handleReassociationResponseFrame(), and inet::ieee80211::Ieee80211MgmtSTASimplified::handleReassociationResponseFrame().

91 {
92  EV << "ignoring management frame: " << (cMessage *)frame << "\n";
93  delete frame;
95 }
long numMgmtFramesDropped
Definition: Ieee80211MgmtBase.h:47
virtual void inet::ieee80211::Ieee80211MgmtBase::handleAssociationRequestFrame ( Ieee80211AssociationRequestFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleAssociationResponseFrame ( Ieee80211AssociationResponseFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleAuthenticationFrame ( Ieee80211AuthenticationFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleBeaconFrame ( Ieee80211BeaconFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleCommand ( int  msgkind,
cObject *  ctrl 
)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleDataFrame ( Ieee80211DataFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleDeauthenticationFrame ( Ieee80211DeauthenticationFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleDisassociationFrame ( Ieee80211DisassociationFrame frame)
protectedpure virtual
void inet::ieee80211::Ieee80211MgmtBase::handleMessage ( cMessage *  msg)
overrideprotectedvirtual

Dispatches incoming messages to handleTimer(), handleUpperMessage() or processFrame().

52 {
53  if (!isOperational)
54  throw cRuntimeError("Message '%s' received when module is OFF", msg->getName());
55 
56  if (msg->isSelfMessage()) {
57  // process timers
58  EV << "Timer expired: " << msg << "\n";
59  handleTimer(msg);
60  }
61  else if (msg->arrivedOn("macIn")) {
62  // process incoming frame
63  EV << "Frame arrived from MAC: " << msg << "\n";
64  Ieee80211DataOrMgmtFrame *frame = check_and_cast<Ieee80211DataOrMgmtFrame *>(msg);
65  processFrame(frame);
66  }
67  else if (msg->arrivedOn("agentIn")) {
68  // process command from agent
69  EV << "Command arrived from agent: " << msg << "\n";
70  int msgkind = msg->getKind();
71  cObject *ctrl = msg->removeControlInfo();
72  delete msg;
73 
74  handleCommand(msgkind, ctrl);
75  }
76  else {
77  // packet from upper layers, to be sent out
78  cPacket *pk = PK(msg);
79  EV << "Packet arrived from upper layers: " << pk << "\n";
81  }
82 }
virtual void handleTimer(cMessage *frame)=0
Should be redefined to deal with self-messages.
virtual void handleUpperMessage(cPacket *msg)=0
Should be redefined to encapsulate and enqueue msgs from higher layers.
virtual void handleCommand(int msgkind, cObject *ctrl)=0
Should be redefined to handle commands from the "agent" (if present)
#define PK(msg)
Definition: INETDefs.h:92
bool isOperational
Definition: Ieee80211MgmtBase.h:42
virtual void processFrame(Ieee80211DataOrMgmtFrame *frame)
Dispatch to frame processing methods according to frame type.
Definition: Ieee80211MgmtBase.cc:103
bool inet::ieee80211::Ieee80211MgmtBase::handleOperationStage ( LifecycleOperation operation,
int  stage,
IDoneCallback doneCallback 
)
overridevirtual

Perform one stage of a lifecycle operation.

Processing may be done entirely within this method, or may be a longer process that involves nonzero simulation time or several events, and is triggered by this method call.

Return value: true = "done"; false = "not yet done, will invoke doneCallback when done"

Implements inet::ILifecycle.

168 {
169  Enter_Method_Silent();
170  if (dynamic_cast<NodeStartOperation *>(operation)) {
172  start();
173  }
174  else if (dynamic_cast<NodeShutdownOperation *>(operation)) {
176  stop();
177  }
178  else if (dynamic_cast<NodeCrashOperation *>(operation)) {
179  if ((NodeCrashOperation::Stage)stage == NodeCrashOperation::STAGE_CRASH) // crash is immediate
180  stop();
181  }
182  else
183  throw cRuntimeError("Unsupported operation '%s'", operation->getClassName());
184  return true;
185 }
Definition: NodeOperations.h:48
virtual void start()
lifecycle support
Definition: Ieee80211MgmtBase.cc:187
Stage
Definition: NodeOperations.h:71
Stage
Definition: NodeOperations.h:126
virtual void stop()
Definition: Ieee80211MgmtBase.cc:192
Stage
Definition: NodeOperations.h:46
Definition: NodeOperations.h:127
virtual void inet::ieee80211::Ieee80211MgmtBase::handleProbeRequestFrame ( Ieee80211ProbeRequestFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleProbeResponseFrame ( Ieee80211ProbeResponseFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleReassociationRequestFrame ( Ieee80211ReassociationRequestFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleReassociationResponseFrame ( Ieee80211ReassociationResponseFrame frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleTimer ( cMessage *  frame)
protectedpure virtual
virtual void inet::ieee80211::Ieee80211MgmtBase::handleUpperMessage ( cPacket *  msg)
protectedpure virtual
void inet::ieee80211::Ieee80211MgmtBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented in inet::ieee80211::Ieee80211MgmtSTA, inet::ieee80211::Ieee80211MgmtAP, inet::ieee80211::Ieee80211MgmtAPBase, inet::ieee80211::Ieee80211MgmtSTASimplified, inet::ieee80211::Ieee80211MgmtAPSimplified, and inet::ieee80211::Ieee80211MgmtAdhoc.

Referenced by inet::ieee80211::Ieee80211MgmtAdhoc::initialize(), inet::ieee80211::Ieee80211MgmtSTASimplified::initialize(), inet::ieee80211::Ieee80211MgmtAPBase::initialize(), and inet::ieee80211::Ieee80211MgmtSTA::initialize().

31 {
32  if (stage == INITSTAGE_LOCAL) {
36  WATCH(numDataFramesReceived);
37  WATCH(numMgmtFramesReceived);
38  WATCH(numMgmtFramesDropped);
39  }
40  else if (stage == INITSTAGE_LINK_LAYER) {
41  NodeStatus *nodeStatus = dynamic_cast<NodeStatus *>(findContainingNode(this)->getSubmodule("status"));
42  isOperational = (!nodeStatus) || nodeStatus->getState() == NodeStatus::UP;
43  }
44  else if (stage == INITSTAGE_LINK_LAYER_2) {
45  // obtain our address from MAC
46  cModule *mac = getModuleFromPar<cModule>(par("macModule"), this);
47  myAddress.setAddress(mac->par("address").stringValue());
48  }
49 }
long numMgmtFramesReceived
Definition: Ieee80211MgmtBase.h:46
long numDataFramesReceived
Definition: Ieee80211MgmtBase.h:45
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
Local initializations.
Definition: InitStages.h:35
Initialization of link-layer protocols.
Definition: InitStages.h:59
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
long numMgmtFramesDropped
Definition: Ieee80211MgmtBase.h:47
MACAddress myAddress
Definition: Ieee80211MgmtBase.h:41
bool isOperational
Definition: Ieee80211MgmtBase.h:42
Additional link-layer initializations that depend on the previous stage.
Definition: InitStages.h:64
Definition: NodeStatus.h:40
virtual int inet::ieee80211::Ieee80211MgmtBase::numInitStages ( ) const
inlineoverrideprotectedvirtual
void inet::ieee80211::Ieee80211MgmtBase::processFrame ( Ieee80211DataOrMgmtFrame frame)
protectedvirtual

Dispatch to frame processing methods according to frame type.

Referenced by handleMessage().

104 {
105  switch (frame->getType()) {
106  case ST_DATA:
107  case ST_DATA_WITH_QOS:
109  handleDataFrame(check_and_cast<Ieee80211DataFrame *>(frame));
110  break;
111 
112  case ST_AUTHENTICATION:
114  handleAuthenticationFrame(check_and_cast<Ieee80211AuthenticationFrame *>(frame));
115  break;
116 
117  case ST_DEAUTHENTICATION:
119  handleDeauthenticationFrame(check_and_cast<Ieee80211DeauthenticationFrame *>(frame));
120  break;
121 
124  handleAssociationRequestFrame(check_and_cast<Ieee80211AssociationRequestFrame *>(frame));
125  break;
126 
129  handleAssociationResponseFrame(check_and_cast<Ieee80211AssociationResponseFrame *>(frame));
130  break;
131 
134  handleReassociationRequestFrame(check_and_cast<Ieee80211ReassociationRequestFrame *>(frame));
135  break;
136 
139  handleReassociationResponseFrame(check_and_cast<Ieee80211ReassociationResponseFrame *>(frame));
140  break;
141 
142  case ST_DISASSOCIATION:
144  handleDisassociationFrame(check_and_cast<Ieee80211DisassociationFrame *>(frame));
145  break;
146 
147  case ST_BEACON:
149  handleBeaconFrame(check_and_cast<Ieee80211BeaconFrame *>(frame));
150  break;
151 
152  case ST_PROBEREQUEST:
154  handleProbeRequestFrame(check_and_cast<Ieee80211ProbeRequestFrame *>(frame));
155  break;
156 
157  case ST_PROBERESPONSE:
159  handleProbeResponseFrame(check_and_cast<Ieee80211ProbeResponseFrame *>(frame));
160  break;
161 
162  default:
163  throw cRuntimeError("Unexpected frame type (%s)%s", frame->getClassName(), frame->getName());
164  }
165 }
Definition: Ieee80211Frame_m.h:99
long numMgmtFramesReceived
Definition: Ieee80211MgmtBase.h:46
virtual void handleAuthenticationFrame(Ieee80211AuthenticationFrame *frame)=0
Definition: Ieee80211Frame_m.h:100
long numDataFramesReceived
Definition: Ieee80211MgmtBase.h:45
Definition: Ieee80211Frame_m.h:106
Definition: Ieee80211Frame_m.h:117
Definition: Ieee80211Frame_m.h:98
Definition: Ieee80211Frame_m.h:101
Definition: Ieee80211Frame_m.h:103
virtual void handleBeaconFrame(Ieee80211BeaconFrame *frame)=0
virtual void handleAssociationRequestFrame(Ieee80211AssociationRequestFrame *frame)=0
virtual void handleProbeResponseFrame(Ieee80211ProbeResponseFrame *frame)=0
virtual void handleReassociationRequestFrame(Ieee80211ReassociationRequestFrame *frame)=0
virtual void handleDeauthenticationFrame(Ieee80211DeauthenticationFrame *frame)=0
Definition: Ieee80211Frame_m.h:102
virtual void handleDisassociationFrame(Ieee80211DisassociationFrame *frame)=0
Definition: Ieee80211Frame_m.h:116
virtual void handleAssociationResponseFrame(Ieee80211AssociationResponseFrame *frame)=0
virtual void handleReassociationResponseFrame(Ieee80211ReassociationResponseFrame *frame)=0
virtual void handleDataFrame(Ieee80211DataFrame *frame)=0
Definition: Ieee80211Frame_m.h:97
virtual void handleProbeRequestFrame(Ieee80211ProbeRequestFrame *frame)=0
Definition: Ieee80211Frame_m.h:107
Definition: Ieee80211Frame_m.h:105
void inet::ieee80211::Ieee80211MgmtBase::sendDown ( cPacket *  frame)
protectedvirtual
void inet::ieee80211::Ieee80211MgmtBase::sendUp ( cMessage *  msg)
protectedvirtual

Utility method: sends the packet to the upper layer.

Referenced by inet::ieee80211::Ieee80211MgmtAdhoc::handleDataFrame(), and inet::ieee80211::Ieee80211MgmtSTASimplified::handleDataFrame().

98 {
99  ASSERT(isOperational);
100  send(msg, "upperLayerOut");
101 }
bool isOperational
Definition: Ieee80211MgmtBase.h:42
void inet::ieee80211::Ieee80211MgmtBase::start ( )
protectedvirtual

lifecycle support

Reimplemented in inet::ieee80211::Ieee80211MgmtAP.

Referenced by handleOperationStage(), and inet::ieee80211::Ieee80211MgmtAP::start().

188 {
189  isOperational = true;
190 }
bool isOperational
Definition: Ieee80211MgmtBase.h:42
void inet::ieee80211::Ieee80211MgmtBase::stop ( )
protectedvirtual

Reimplemented in inet::ieee80211::Ieee80211MgmtAP.

Referenced by handleOperationStage(), and inet::ieee80211::Ieee80211MgmtAP::stop().

193 {
194  isOperational = false;
195 }
bool isOperational
Definition: Ieee80211MgmtBase.h:42

Member Data Documentation

bool inet::ieee80211::Ieee80211MgmtBase::isOperational
protected
MACAddress inet::ieee80211::Ieee80211MgmtBase::myAddress
protected

Referenced by initialize().

long inet::ieee80211::Ieee80211MgmtBase::numDataFramesReceived
protected

Referenced by initialize(), and processFrame().

long inet::ieee80211::Ieee80211MgmtBase::numMgmtFramesDropped
protected

Referenced by dropManagementFrame(), and initialize().

long inet::ieee80211::Ieee80211MgmtBase::numMgmtFramesReceived
protected

Referenced by initialize(), and processFrame().


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