INET Framework for OMNeT++/OMNEST
Ieee80211MgmtSTASimplified.cc
Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2006 Andras Varga
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 
00019 #include "Ieee80211MgmtSTASimplified.h"
00020 #include "Ieee802Ctrl_m.h"
00021 
00022 
00023 Define_Module(Ieee80211MgmtSTASimplified);
00024 
00025 
00026 void Ieee80211MgmtSTASimplified::initialize(int stage)
00027 {
00028     Ieee80211MgmtBase::initialize(stage);
00029     if (stage==0)
00030     {
00031         accessPointAddress.setAddress(par("accessPointAddress").stringValue());
00032         receiveSequence = 0;
00033     }
00034 }
00035 
00036 void Ieee80211MgmtSTASimplified::handleTimer(cMessage *msg)
00037 {
00038     ASSERT(false);
00039 }
00040 
00041 void Ieee80211MgmtSTASimplified::handleUpperMessage(cPacket *msg)
00042 {
00043     Ieee80211DataFrame *frame = encapsulate(msg);
00044     sendOrEnqueue(frame);
00045 }
00046 
00047 void Ieee80211MgmtSTASimplified::handleCommand(int msgkind, cPolymorphic *ctrl)
00048 {
00049     error("handleCommand(): no commands supported");
00050 }
00051 
00052 Ieee80211DataFrame *Ieee80211MgmtSTASimplified::encapsulate(cPacket *msg)
00053 {
00054     Ieee80211DataFrame *frame = new Ieee80211DataFrame(msg->getName());
00055 
00056     // frame goes to the AP
00057     frame->setToDS(true);
00058 
00059     // receiver is the AP
00060     frame->setReceiverAddress(accessPointAddress);
00061 
00062     // destination address is in address3
00063     Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl *>(msg->removeControlInfo());
00064     ASSERT(!ctrl->getDest().isUnspecified());
00065     frame->setAddress3(ctrl->getDest());
00066     delete ctrl;
00067 
00068     frame->encapsulate(msg);
00069     return frame;
00070 }
00071 
00072 void Ieee80211MgmtSTASimplified::receiveChangeNotification(int category, const cPolymorphic *details)
00073 {
00074     Enter_Method_Silent();
00075     printNotificationBanner(category, details);
00076 }
00077 
00078 void Ieee80211MgmtSTASimplified::handleDataFrame(Ieee80211DataFrame *frame)
00079 {
00080     sendUp(decapsulate(frame));
00081 }
00082 
00083 void Ieee80211MgmtSTASimplified::handleAuthenticationFrame(Ieee80211AuthenticationFrame *frame)
00084 {
00085     dropManagementFrame(frame);
00086 }
00087 
00088 void Ieee80211MgmtSTASimplified::handleDeauthenticationFrame(Ieee80211DeauthenticationFrame *frame)
00089 {
00090     dropManagementFrame(frame);
00091 }
00092 
00093 void Ieee80211MgmtSTASimplified::handleAssociationRequestFrame(Ieee80211AssociationRequestFrame *frame)
00094 {
00095     dropManagementFrame(frame);
00096 }
00097 
00098 void Ieee80211MgmtSTASimplified::handleAssociationResponseFrame(Ieee80211AssociationResponseFrame *frame)
00099 {
00100     dropManagementFrame(frame);
00101 }
00102 
00103 void Ieee80211MgmtSTASimplified::handleReassociationRequestFrame(Ieee80211ReassociationRequestFrame *frame)
00104 {
00105     dropManagementFrame(frame);
00106 }
00107 
00108 void Ieee80211MgmtSTASimplified::handleReassociationResponseFrame(Ieee80211ReassociationResponseFrame *frame)
00109 {
00110     dropManagementFrame(frame);
00111 }
00112 
00113 void Ieee80211MgmtSTASimplified::handleDisassociationFrame(Ieee80211DisassociationFrame *frame)
00114 {
00115     dropManagementFrame(frame);
00116 }
00117 
00118 void Ieee80211MgmtSTASimplified::handleBeaconFrame(Ieee80211BeaconFrame *frame)
00119 {
00120     dropManagementFrame(frame);
00121 }
00122 
00123 void Ieee80211MgmtSTASimplified::handleProbeRequestFrame(Ieee80211ProbeRequestFrame *frame)
00124 {
00125     dropManagementFrame(frame);
00126 }
00127 
00128 void Ieee80211MgmtSTASimplified::handleProbeResponseFrame(Ieee80211ProbeResponseFrame *frame)
00129 {
00130     dropManagementFrame(frame);
00131 }
00132 
00133