Ieee80211MgmtBase Class Reference

#include <Ieee80211MgmtBase.h>

Inheritance diagram for Ieee80211MgmtBase:

PassiveQueueBase INotifiable IPassiveQueue Ieee80211MgmtAdhoc Ieee80211MgmtAPBase Ieee80211MgmtSTA Ieee80211MgmtSTASimplified Ieee80211MgmtAP Ieee80211MgmtAPSimplified List of all members.

Detailed Description

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).

Author:
Andras Varga


Protected Member Functions

virtual int numInitStages () const
virtual void initialize (int)
void handleMessage (cMessage *msg)
virtual void handleTimer (cMessage *frame)=0
virtual void handleUpperMessage (cMessage *msg)=0
virtual void handleCommand (int msgkind, cPolymorphic *ctrl)=0
void sendOrEnqueue (cMessage *frame)
virtual bool enqueue (cMessage *msg)
virtual cMessage * dequeue ()
void sendOut (cMessage *msg)
virtual void dropManagementFrame (Ieee80211ManagementFrame *frame)
virtual cMessage * 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


Member Function Documentation

cMessage * Ieee80211MgmtBase::decapsulate ( Ieee80211DataFrame frame  )  [protected, virtual]

Utility method to decapsulate a data frame (encapsulation depends on adhoc/STA/AP)

00162 {
00163     cMessage *payload = frame->decapsulate();
00164 
00165     Ieee802Ctrl *ctrl = new Ieee802Ctrl();
00166     ctrl->setSrc(frame->getAddress3());
00167     ctrl->setDest(frame->getReceiverAddress());
00168     payload->setControlInfo(ctrl);
00169 
00170     delete frame;
00171     return payload;
00172 }

cMessage * Ieee80211MgmtBase::dequeue (  )  [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

00133 {
00134     // management frames have priority
00135     if (!mgmtQueue.empty())
00136         return (cMessage *)mgmtQueue.pop();
00137 
00138     // return a data frame if we have one
00139     if (dataQueue.empty())
00140         return NULL;
00141 
00142     cMessage *pk = (cMessage *)dataQueue.pop();
00143 
00144     // statistics
00145     dataQueueLenVec.record(dataQueue.length());
00146     return pk;
00147 }

void Ieee80211MgmtBase::dropManagementFrame ( Ieee80211ManagementFrame frame  )  [protected, virtual]

Utility method to dispose of an unhandled frame

00155 {
00156     EV << "ignoring management frame: " << (cMessage *)frame << "\n";
00157     delete frame;
00158     numMgmtFramesDropped++;
00159 }

bool Ieee80211MgmtBase::enqueue ( cMessage *  msg  )  [protected, virtual]

Redefined from PassiveQueueBase.

Implements PassiveQueueBase.

00107 {
00108     ASSERT(dynamic_cast<Ieee80211DataOrMgmtFrame *>(msg)!=NULL);
00109     bool isDataFrame = dynamic_cast<Ieee80211DataFrame *>(msg)!=NULL;
00110 
00111     if (!isDataFrame)
00112     {
00113         // management frames are inserted into mgmtQueue
00114         mgmtQueue.insert(msg);
00115         return false;
00116     }
00117     else if (frameCapacity && dataQueue.length() >= frameCapacity)
00118     {
00119         EV << "Queue full, dropping packet.\n";
00120         delete msg;
00121         dataQueueDropVec.record(1);
00122         return true;
00123     }
00124     else
00125     {
00126         dataQueue.insert(msg);
00127         dataQueueLenVec.record(dataQueue.length());
00128         return false;
00129     }
00130 }

virtual void Ieee80211MgmtBase::handleAssociationRequestFrame ( Ieee80211AssociationRequestFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleAssociationResponseFrame ( Ieee80211AssociationResponseFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleAuthenticationFrame ( Ieee80211AuthenticationFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleBeaconFrame ( Ieee80211BeaconFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

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.

virtual void Ieee80211MgmtBase::handleDataFrame ( Ieee80211DataFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleDeauthenticationFrame ( Ieee80211DeauthenticationFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleDisassociationFrame ( Ieee80211DisassociationFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

void Ieee80211MgmtBase::handleMessage ( cMessage *  msg  )  [protected, virtual]

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

Reimplemented from PassiveQueueBase.

00065 {
00066     if (msg->isSelfMessage())
00067     {
00068         // process timers
00069         EV << "Timer expired: " << msg << "\n";
00070         handleTimer(msg);
00071     }
00072     else if (msg->arrivedOn("macIn"))
00073     {
00074         // process incoming frame
00075         EV << "Frame arrived from MAC: " << msg << "\n";
00076         Ieee80211DataOrMgmtFrame *frame = check_and_cast<Ieee80211DataOrMgmtFrame *>(msg);
00077         processFrame(frame);
00078     }
00079     else if (msg->arrivedOn("agentIn"))
00080     {
00081         // process command from agent
00082         EV << "Command arrived from agent: " << msg << "\n";
00083         int msgkind = msg->kind();
00084         cPolymorphic *ctrl = msg->removeControlInfo();
00085         delete msg;
00086 
00087         handleCommand(msgkind, ctrl);
00088     }
00089     else
00090     {
00091         // packet from upper layers, to be sent out
00092         EV << "Packet arrived from upper layers: " << msg << "\n";
00093         if (msg->byteLength() > 2312)
00094             error("message from higher layer (%s)%s is too long for 802.11b, %d bytes (fragmentation is not supported yet)",
00095                   msg->className(), msg->name(), msg->byteLength());
00096 
00097         handleUpperMessage(msg);
00098     }
00099 }

virtual void Ieee80211MgmtBase::handleProbeRequestFrame ( Ieee80211ProbeRequestFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleProbeResponseFrame ( Ieee80211ProbeResponseFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleReassociationRequestFrame ( Ieee80211ReassociationRequestFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

virtual void Ieee80211MgmtBase::handleReassociationResponseFrame ( Ieee80211ReassociationResponseFrame frame  )  [protected, pure virtual]

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

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.

virtual void Ieee80211MgmtBase::handleUpperMessage ( cMessage *  msg  )  [protected, pure virtual]

Should be redefined to encapsulate and enqueue msgs from higher layers

Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

void Ieee80211MgmtBase::initialize ( int   )  [protected, virtual]

Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

00031 {
00032     if (stage==0)
00033     {
00034         PassiveQueueBase::initialize();
00035 
00036         dataQueue.setName("wlanDataQueue");
00037         mgmtQueue.setName("wlanMgmtQueue");
00038         dataQueueLenVec.setName("queue length");
00039         dataQueueDropVec.setName("queue drop count");
00040 
00041         numDataFramesReceived = 0;
00042         numMgmtFramesReceived = 0;
00043         numMgmtFramesDropped = 0;
00044         WATCH(numDataFramesReceived);
00045         WATCH(numMgmtFramesReceived);
00046         WATCH(numMgmtFramesDropped);
00047 
00048         // configuration
00049         frameCapacity = par("frameCapacity");
00050 
00051 
00052     }
00053     else if (stage==1)
00054     {
00055         // obtain our address from MAC
00056         cModule *mac = parentModule()->submodule("mac");
00057         if (!mac)
00058             error("MAC module not found; it is expected to be next to this submodule and called 'mac'");
00059         myAddress.setAddress(mac->par("address").stringValue());
00060     }
00061 }

virtual int Ieee80211MgmtBase::numInitStages (  )  const [inline, protected, virtual]

Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.

00058 {return 2;}

void Ieee80211MgmtBase::processFrame ( Ieee80211DataOrMgmtFrame frame  )  [protected, virtual]

Dispatch to frame processing methods according to frame type

00180 {
00181     switch(frame->getType())
00182     {
00183       case ST_DATA:
00184         numDataFramesReceived++;
00185         handleDataFrame(check_and_cast<Ieee80211DataFrame *>(frame));
00186         break;
00187       case ST_AUTHENTICATION:
00188         numMgmtFramesReceived++;
00189         handleAuthenticationFrame(check_and_cast<Ieee80211AuthenticationFrame *>(frame));
00190         break;
00191       case ST_DEAUTHENTICATION:
00192         numMgmtFramesReceived++;
00193         handleDeauthenticationFrame(check_and_cast<Ieee80211DeauthenticationFrame *>(frame));
00194         break;
00195       case ST_ASSOCIATIONREQUEST:
00196         numMgmtFramesReceived++;
00197         handleAssociationRequestFrame(check_and_cast<Ieee80211AssociationRequestFrame *>(frame));
00198         break;
00199       case ST_ASSOCIATIONRESPONSE:
00200         numMgmtFramesReceived++;
00201         handleAssociationResponseFrame(check_and_cast<Ieee80211AssociationResponseFrame *>(frame));
00202         break;
00203       case ST_REASSOCIATIONREQUEST:
00204         numMgmtFramesReceived++;
00205         handleReassociationRequestFrame(check_and_cast<Ieee80211ReassociationRequestFrame *>(frame));
00206         break;
00207       case ST_REASSOCIATIONRESPONSE:
00208         numMgmtFramesReceived++;
00209         handleReassociationResponseFrame(check_and_cast<Ieee80211ReassociationResponseFrame *>(frame)); break;
00210       case ST_DISASSOCIATION:
00211         numMgmtFramesReceived++;
00212         handleDisassociationFrame(check_and_cast<Ieee80211DisassociationFrame *>(frame));
00213         break;
00214       case ST_BEACON:
00215         numMgmtFramesReceived++;
00216         handleBeaconFrame(check_and_cast<Ieee80211BeaconFrame *>(frame));
00217         break;
00218       case ST_PROBEREQUEST:
00219         numMgmtFramesReceived++;
00220         handleProbeRequestFrame(check_and_cast<Ieee80211ProbeRequestFrame *>(frame));
00221         break;
00222       case ST_PROBERESPONSE:
00223         numMgmtFramesReceived++;
00224         handleProbeResponseFrame(check_and_cast<Ieee80211ProbeResponseFrame *>(frame));
00225         break;
00226       default:
00227         error("unexpected frame type (%s)%s", frame->className(), frame->name());
00228     }
00229 }

void Ieee80211MgmtBase::sendOrEnqueue ( cMessage *  frame  )  [protected]

Utility method for implementing handleUpperMessage(): gives the message to PassiveQueueBase

00102 {
00103     PassiveQueueBase::handleMessage(frame);
00104 }

void Ieee80211MgmtBase::sendOut ( cMessage *  msg  )  [protected, virtual]

Redefined from PassiveQueueBase: send message to MAC

Implements PassiveQueueBase.

00150 {
00151     send(msg, "macOut");
00152 }

void Ieee80211MgmtBase::sendUp ( cMessage *  msg  )  [protected, virtual]

Utility method: sends the packet to the upper layer

00175 {
00176     send(msg, "uppergateOut");
00177 }


Member Data Documentation

cQueue Ieee80211MgmtBase::dataQueue [protected]

cOutVector Ieee80211MgmtBase::dataQueueDropVec [protected]

cOutVector Ieee80211MgmtBase::dataQueueLenVec [protected]

int Ieee80211MgmtBase::frameCapacity [protected]

cQueue Ieee80211MgmtBase::mgmtQueue [protected]

MACAddress Ieee80211MgmtBase::myAddress [protected]

long Ieee80211MgmtBase::numDataFramesReceived [protected]

long Ieee80211MgmtBase::numMgmtFramesDropped [protected]

long Ieee80211MgmtBase::numMgmtFramesReceived [protected]


The documentation for this class was generated from the following files:
Generated on Wed Apr 4 13:20:20 2007 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.7