#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 |
virtual int Ieee80211MgmtBase::numInitStages | ( | ) | const [inline, protected, virtual] |
Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
void Ieee80211MgmtBase::initialize | ( | int | stage | ) | [protected, virtual] |
Reimplemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPBase, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
00030 { 00031 if (stage==0) 00032 { 00033 PassiveQueueBase::initialize(); 00034 00035 dataQueue.setName("wlanDataQueue"); 00036 mgmtQueue.setName("wlanMgmtQueue"); 00037 dataQueueLenVec.setName("queue length"); 00038 dataQueueDropVec.setName("queue drop count"); 00039 00040 numDataFramesReceived = 0; 00041 numMgmtFramesReceived = 0; 00042 numMgmtFramesDropped = 0; 00043 WATCH(numDataFramesReceived); 00044 WATCH(numMgmtFramesReceived); 00045 WATCH(numMgmtFramesDropped); 00046 00047 // configuration 00048 frameCapacity = par("frameCapacity"); 00049 00050 00051 } 00052 else if (stage==1) 00053 { 00054 // obtain our address from MAC 00055 cModule *mac = getParentModule()->getSubmodule("mac"); 00056 if (!mac) 00057 error("MAC module not found; it is expected to be next to this submodule and called 'mac'"); 00058 myAddress.setAddress(mac->par("address").stringValue()); 00059 } 00060 }
void Ieee80211MgmtBase::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Dispatches incoming messages to handleTimer(), handleUpperMessage() or processFrame().
Reimplemented from PassiveQueueBase.
00064 { 00065 if (msg->isSelfMessage()) 00066 { 00067 // process timers 00068 EV << "Timer expired: " << msg << "\n"; 00069 handleTimer(msg); 00070 } 00071 else if (msg->arrivedOn("macIn")) 00072 { 00073 // process incoming frame 00074 EV << "Frame arrived from MAC: " << msg << "\n"; 00075 Ieee80211DataOrMgmtFrame *frame = check_and_cast<Ieee80211DataOrMgmtFrame *>(msg); 00076 processFrame(frame); 00077 } 00078 else if (msg->arrivedOn("agentIn")) 00079 { 00080 // process command from agent 00081 EV << "Command arrived from agent: " << msg << "\n"; 00082 int msgkind = msg->getKind(); 00083 cPolymorphic *ctrl = msg->removeControlInfo(); 00084 delete msg; 00085 00086 handleCommand(msgkind, ctrl); 00087 } 00088 else 00089 { 00090 // packet from upper layers, to be sent out 00091 cPacket *pk = PK(msg); 00092 EV << "Packet arrived from upper layers: " << pk << "\n"; 00093 if (pk->getByteLength() > 2312) 00094 error("message from higher layer (%s)%s is too long for 802.11b, %d bytes (fragmentation is not supported yet)", 00095 pk->getClassName(), pk->getName(), pk->getByteLength()); 00096 00097 handleUpperMessage(pk); 00098 } 00099 }
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().
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().
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().
00102 { 00103 PassiveQueueBase::handleMessage(frame); 00104 }
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 }
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::sendOut | ( | cMessage * | msg | ) | [protected, virtual] |
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().
00155 { 00156 EV << "ignoring management frame: " << (cMessage *)frame << "\n"; 00157 delete frame; 00158 numMgmtFramesDropped++; 00159 }
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().
00162 { 00163 cPacket *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 }
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().
void Ieee80211MgmtBase::processFrame | ( | Ieee80211DataOrMgmtFrame * | frame | ) | [protected, virtual] |
Dispatch to frame processing methods according to frame type
Referenced by handleMessage().
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->getClassName(), frame->getName()); 00228 } 00229 }
virtual void Ieee80211MgmtBase::handleDataFrame | ( | Ieee80211DataFrame * | 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::handleDeauthenticationFrame | ( | Ieee80211DeauthenticationFrame * | frame | ) | [protected, pure virtual] |
Implemented in Ieee80211MgmtAdhoc, Ieee80211MgmtAP, Ieee80211MgmtAPSimplified, Ieee80211MgmtSTA, and Ieee80211MgmtSTASimplified.
Referenced by processFrame().
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::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::handleDisassociationFrame | ( | Ieee80211DisassociationFrame * | 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::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().
int Ieee80211MgmtBase::frameCapacity [protected] |
Referenced by enqueue(), and initialize().
MACAddress Ieee80211MgmtBase::myAddress [protected] |
Referenced by initialize(), and Ieee80211MgmtAP::sendManagementFrame().
cQueue Ieee80211MgmtBase::dataQueue [protected] |
Referenced by dequeue(), enqueue(), and initialize().
cQueue Ieee80211MgmtBase::mgmtQueue [protected] |
Referenced by dequeue(), enqueue(), and initialize().
long Ieee80211MgmtBase::numDataFramesReceived [protected] |
Referenced by initialize(), and processFrame().
long Ieee80211MgmtBase::numMgmtFramesReceived [protected] |
Referenced by initialize(), and processFrame().
long Ieee80211MgmtBase::numMgmtFramesDropped [protected] |
Referenced by dropManagementFrame(), and initialize().
cOutVector Ieee80211MgmtBase::dataQueueLenVec [protected] |
Referenced by dequeue(), enqueue(), and initialize().
cOutVector Ieee80211MgmtBase::dataQueueDropVec [protected] |
Referenced by enqueue(), and initialize().