INET Framework for OMNeT++/OMNEST
|
#include <Ieee80211MgmtBase.h>
Protected Member Functions | |
virtual int | numInitStages () const |
virtual void | initialize (int) |
virtual void | handleMessage (cMessage *msg) |
virtual void | handleTimer (cMessage *frame)=0 |
virtual void | handleUpperMessage (cPacket *msg)=0 |
virtual void | handleCommand (int msgkind, cPolymorphic *ctrl)=0 |
virtual void | sendOrEnqueue (cPacket *frame) |
virtual bool | enqueue (cMessage *msg) |
virtual cMessage * | dequeue () |
virtual void | sendOut (cMessage *msg) |
virtual void | dropManagementFrame (Ieee80211ManagementFrame *frame) |
virtual cPacket * | decapsulate (Ieee80211DataFrame *frame) |
virtual void | sendUp (cMessage *msg) |
virtual void | processFrame (Ieee80211DataOrMgmtFrame *frame) |
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 | |
int | frameCapacity |
MACAddress | myAddress |
cQueue | dataQueue |
cQueue | mgmtQueue |
long | numDataFramesReceived |
long | numMgmtFramesReceived |
long | numMgmtFramesDropped |
cOutVector | dataQueueLenVec |
cOutVector | dataQueueDropVec |
Abstract base class for 802.11 infrastructure mode management components. Performs queueing for MAC, and dispatching incoming frames by frame type. Also keeps some simple statistics (frame counts).
cPacket * Ieee80211MgmtBase::decapsulate | ( | Ieee80211DataFrame * | frame | ) | [protected, virtual] |
Utility method to decapsulate a data frame (encapsulation depends on adhoc/STA/AP)
Referenced by Ieee80211MgmtSTASimplified::handleDataFrame(), Ieee80211MgmtSTA::handleDataFrame(), and Ieee80211MgmtAdhoc::handleDataFrame().
{ cPacket *payload = frame->decapsulate(); Ieee802Ctrl *ctrl = new Ieee802Ctrl(); ctrl->setSrc(frame->getAddress3()); ctrl->setDest(frame->getReceiverAddress()); payload->setControlInfo(ctrl); delete frame; return payload; }
cMessage * Ieee80211MgmtBase::dequeue | ( | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
void Ieee80211MgmtBase::dropManagementFrame | ( | Ieee80211ManagementFrame * | frame | ) | [protected, virtual] |
Utility method to dispose of an unhandled frame
Referenced by Ieee80211MgmtSTASimplified::handleAssociationRequestFrame(), Ieee80211MgmtSTA::handleAssociationRequestFrame(), Ieee80211MgmtAPSimplified::handleAssociationRequestFrame(), Ieee80211MgmtAdhoc::handleAssociationRequestFrame(), Ieee80211MgmtSTASimplified::handleAssociationResponseFrame(), Ieee80211MgmtAPSimplified::handleAssociationResponseFrame(), Ieee80211MgmtAP::handleAssociationResponseFrame(), Ieee80211MgmtAdhoc::handleAssociationResponseFrame(), Ieee80211MgmtSTASimplified::handleAuthenticationFrame(), Ieee80211MgmtAPSimplified::handleAuthenticationFrame(), Ieee80211MgmtAdhoc::handleAuthenticationFrame(), Ieee80211MgmtSTASimplified::handleBeaconFrame(), Ieee80211MgmtAPSimplified::handleBeaconFrame(), Ieee80211MgmtAP::handleBeaconFrame(), Ieee80211MgmtAdhoc::handleBeaconFrame(), Ieee80211MgmtSTASimplified::handleDeauthenticationFrame(), Ieee80211MgmtAPSimplified::handleDeauthenticationFrame(), Ieee80211MgmtAdhoc::handleDeauthenticationFrame(), Ieee80211MgmtSTASimplified::handleDisassociationFrame(), Ieee80211MgmtAPSimplified::handleDisassociationFrame(), Ieee80211MgmtAdhoc::handleDisassociationFrame(), Ieee80211MgmtSTASimplified::handleProbeRequestFrame(), Ieee80211MgmtSTA::handleProbeRequestFrame(), Ieee80211MgmtAPSimplified::handleProbeRequestFrame(), Ieee80211MgmtAP::handleProbeRequestFrame(), Ieee80211MgmtAdhoc::handleProbeRequestFrame(), Ieee80211MgmtSTASimplified::handleProbeResponseFrame(), Ieee80211MgmtAPSimplified::handleProbeResponseFrame(), Ieee80211MgmtAP::handleProbeResponseFrame(), Ieee80211MgmtAdhoc::handleProbeResponseFrame(), Ieee80211MgmtSTASimplified::handleReassociationRequestFrame(), Ieee80211MgmtSTA::handleReassociationRequestFrame(), Ieee80211MgmtAPSimplified::handleReassociationRequestFrame(), Ieee80211MgmtAdhoc::handleReassociationRequestFrame(), Ieee80211MgmtSTASimplified::handleReassociationResponseFrame(), Ieee80211MgmtAPSimplified::handleReassociationResponseFrame(), Ieee80211MgmtAP::handleReassociationResponseFrame(), and Ieee80211MgmtAdhoc::handleReassociationResponseFrame().
{ EV << "ignoring management frame: " << (cMessage *)frame << "\n"; delete frame; numMgmtFramesDropped++; }
bool Ieee80211MgmtBase::enqueue | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase.
Implements PassiveQueueBase.
{ ASSERT(dynamic_cast<Ieee80211DataOrMgmtFrame *>(msg)!=NULL); bool isDataFrame = dynamic_cast<Ieee80211DataFrame *>(msg)!=NULL; if (!isDataFrame) { // management frames are inserted into mgmtQueue mgmtQueue.insert(msg); return false; } else if (frameCapacity && dataQueue.length() >= frameCapacity) { EV << "Queue full, dropping packet.\n"; delete msg; dataQueueDropVec.record(1); return true; } else { dataQueue.insert(msg); dataQueueLenVec.record(dataQueue.length()); return false; } }
virtual void Ieee80211MgmtBase::handleAssociationRequestFrame | ( | Ieee80211AssociationRequestFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleAssociationResponseFrame | ( | Ieee80211AssociationResponseFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleAuthenticationFrame | ( | Ieee80211AuthenticationFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleBeaconFrame | ( | Ieee80211BeaconFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleCommand | ( | int | msgkind, |
cPolymorphic * | ctrl | ||
) | [protected, pure virtual] |
Should be redefined to handle commands from the "agent" (if present)
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by handleMessage().
virtual void Ieee80211MgmtBase::handleDataFrame | ( | Ieee80211DataFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleDeauthenticationFrame | ( | Ieee80211DeauthenticationFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleDisassociationFrame | ( | Ieee80211DisassociationFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
void Ieee80211MgmtBase::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Dispatches incoming messages to handleTimer(), handleUpperMessage() or processFrame().
Reimplemented from PassiveQueueBase.
Referenced by sendOrEnqueue().
{ if (msg->isSelfMessage()) { // process timers EV << "Timer expired: " << msg << "\n"; handleTimer(msg); } else if (msg->arrivedOn("macIn")) { // process incoming frame EV << "Frame arrived from MAC: " << msg << "\n"; Ieee80211DataOrMgmtFrame *frame = check_and_cast<Ieee80211DataOrMgmtFrame *>(msg); processFrame(frame); } else if (msg->arrivedOn("agentIn")) { // process command from agent EV << "Command arrived from agent: " << msg << "\n"; int msgkind = msg->getKind(); cPolymorphic *ctrl = msg->removeControlInfo(); delete msg; handleCommand(msgkind, ctrl); } else { // packet from upper layers, to be sent out cPacket *pk = PK(msg); EV << "Packet arrived from upper layers: " << pk << "\n"; if (pk->getByteLength() > 2312) error("message from higher layer (%s)%s is too long for 802.11b, %d bytes (fragmentation is not supported yet)", pk->getClassName(), pk->getName(), (int)(pk->getByteLength())); handleUpperMessage(pk); } }
virtual void Ieee80211MgmtBase::handleProbeRequestFrame | ( | Ieee80211ProbeRequestFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleProbeResponseFrame | ( | Ieee80211ProbeResponseFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleReassociationRequestFrame | ( | Ieee80211ReassociationRequestFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleReassociationResponseFrame | ( | Ieee80211ReassociationResponseFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
virtual void Ieee80211MgmtBase::handleTimer | ( | cMessage * | frame | ) | [protected, pure virtual] |
Should be redefined to deal with self-messages
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by handleMessage().
virtual void Ieee80211MgmtBase::handleUpperMessage | ( | cPacket * | msg | ) | [protected, pure virtual] |
Should be redefined to encapsulate and enqueue msgs from higher layers
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by handleMessage().
void Ieee80211MgmtBase::initialize | ( | int | stage | ) | [protected, virtual] |
Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
{ if (stage==0) { PassiveQueueBase::initialize(); dataQueue.setName("wlanDataQueue"); mgmtQueue.setName("wlanMgmtQueue"); dataQueueLenVec.setName("queue length"); dataQueueDropVec.setName("queue drop count"); numDataFramesReceived = 0; numMgmtFramesReceived = 0; numMgmtFramesDropped = 0; WATCH(numDataFramesReceived); WATCH(numMgmtFramesReceived); WATCH(numMgmtFramesDropped); // configuration frameCapacity = par("frameCapacity"); } else if (stage==1) { // obtain our address from MAC cModule *mac = getParentModule()->getSubmodule("mac"); if (!mac) error("MAC module not found; it is expected to be next to this submodule and called 'mac'"); myAddress.setAddress(mac->par("address").stringValue()); } }
virtual int Ieee80211MgmtBase::numInitStages | ( | ) | const [inline, protected, virtual] |
Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
{return 2;}
void Ieee80211MgmtBase::processFrame | ( | Ieee80211DataOrMgmtFrame * | frame | ) | [protected, virtual] |
Dispatch to frame processing methods according to frame type
Referenced by handleMessage().
{ switch(frame->getType()) { case ST_DATA: numDataFramesReceived++; handleDataFrame(check_and_cast<Ieee80211DataFrame *>(frame)); break; case ST_AUTHENTICATION: numMgmtFramesReceived++; handleAuthenticationFrame(check_and_cast<Ieee80211AuthenticationFrame *>(frame)); break; case ST_DEAUTHENTICATION: numMgmtFramesReceived++; handleDeauthenticationFrame(check_and_cast<Ieee80211DeauthenticationFrame *>(frame)); break; case ST_ASSOCIATIONREQUEST: numMgmtFramesReceived++; handleAssociationRequestFrame(check_and_cast<Ieee80211AssociationRequestFrame *>(frame)); break; case ST_ASSOCIATIONRESPONSE: numMgmtFramesReceived++; handleAssociationResponseFrame(check_and_cast<Ieee80211AssociationResponseFrame *>(frame)); break; case ST_REASSOCIATIONREQUEST: numMgmtFramesReceived++; handleReassociationRequestFrame(check_and_cast<Ieee80211ReassociationRequestFrame *>(frame)); break; case ST_REASSOCIATIONRESPONSE: numMgmtFramesReceived++; handleReassociationResponseFrame(check_and_cast<Ieee80211ReassociationResponseFrame *>(frame)); break; case ST_DISASSOCIATION: numMgmtFramesReceived++; handleDisassociationFrame(check_and_cast<Ieee80211DisassociationFrame *>(frame)); break; case ST_BEACON: numMgmtFramesReceived++; handleBeaconFrame(check_and_cast<Ieee80211BeaconFrame *>(frame)); break; case ST_PROBEREQUEST: numMgmtFramesReceived++; handleProbeRequestFrame(check_and_cast<Ieee80211ProbeRequestFrame *>(frame)); break; case ST_PROBERESPONSE: numMgmtFramesReceived++; handleProbeResponseFrame(check_and_cast<Ieee80211ProbeResponseFrame *>(frame)); break; default: error("unexpected frame type (%s)%s", frame->getClassName(), frame->getName()); } }
void Ieee80211MgmtBase::sendOrEnqueue | ( | cPacket * | frame | ) | [protected, virtual] |
Utility method for implementing handleUpperMessage(): gives the message to PassiveQueueBase
Referenced by Ieee80211MgmtAPBase::distributeReceivedDataFrame(), Ieee80211MgmtSTASimplified::handleUpperMessage(), Ieee80211MgmtSTA::handleUpperMessage(), Ieee80211MgmtAPSimplified::handleUpperMessage(), Ieee80211MgmtAP::handleUpperMessage(), Ieee80211MgmtAdhoc::handleUpperMessage(), Ieee80211MgmtAP::sendBeacon(), Ieee80211MgmtSTA::sendManagementFrame(), and Ieee80211MgmtAP::sendManagementFrame().
{ PassiveQueueBase::handleMessage(frame); }
void Ieee80211MgmtBase::sendOut | ( | cMessage * | msg | ) | [protected, virtual] |
Redefined from PassiveQueueBase: send message to MAC
Implements PassiveQueueBase.
{
send(msg, "macOut");
}
void Ieee80211MgmtBase::sendUp | ( | cMessage * | msg | ) | [protected, virtual] |
Utility method: sends the packet to the upper layer
Referenced by Ieee80211MgmtSTASimplified::handleDataFrame(), Ieee80211MgmtSTA::handleDataFrame(), and Ieee80211MgmtAdhoc::handleDataFrame().
{
send(msg, "uppergateOut");
}
cQueue Ieee80211MgmtBase::dataQueue [protected] |
Referenced by dequeue(), enqueue(), and initialize().
cOutVector Ieee80211MgmtBase::dataQueueDropVec [protected] |
Referenced by enqueue(), and initialize().
cOutVector Ieee80211MgmtBase::dataQueueLenVec [protected] |
Referenced by dequeue(), enqueue(), and initialize().
int Ieee80211MgmtBase::frameCapacity [protected] |
Referenced by enqueue(), and initialize().
cQueue Ieee80211MgmtBase::mgmtQueue [protected] |
Referenced by dequeue(), enqueue(), and initialize().
MACAddress Ieee80211MgmtBase::myAddress [protected] |
Referenced by initialize(), and Ieee80211MgmtAP::sendManagementFrame().
long Ieee80211MgmtBase::numDataFramesReceived [protected] |
Referenced by initialize(), and processFrame().
long Ieee80211MgmtBase::numMgmtFramesDropped [protected] |
Referenced by dropManagementFrame(), and initialize().
long Ieee80211MgmtBase::numMgmtFramesReceived [protected] |
Referenced by initialize(), and processFrame().