INET Framework for OMNeT++/OMNEST
Ieee80211MgmtAdhoc.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 "Ieee80211MgmtAdhoc.h"
00020 #include "Ieee802Ctrl_m.h"
00021 
00022 
00023 Define_Module(Ieee80211MgmtAdhoc);
00024 
00025 
00026 void Ieee80211MgmtAdhoc::initialize(int stage)
00027 {
00028     Ieee80211MgmtBase::initialize(stage);
00029 }
00030 
00031 void Ieee80211MgmtAdhoc::handleTimer(cMessage *msg)
00032 {
00033     ASSERT(false);
00034 }
00035 
00036 void Ieee80211MgmtAdhoc::handleUpperMessage(cPacket *msg)
00037 {
00038     Ieee80211DataFrame *frame = encapsulate(msg);
00039     sendOrEnqueue(frame);
00040 }
00041 
00042 void Ieee80211MgmtAdhoc::handleCommand(int msgkind, cPolymorphic *ctrl)
00043 {
00044     error("handleCommand(): no commands supported");
00045 }
00046 
00047 Ieee80211DataFrame *Ieee80211MgmtAdhoc::encapsulate(cPacket *msg)
00048 {
00049     Ieee80211DataFrame *frame = new Ieee80211DataFrame(msg->getName());
00050 
00051     // copy receiver address from the control info (sender address will be set in MAC)
00052     Ieee802Ctrl *ctrl = check_and_cast<Ieee802Ctrl *>(msg->removeControlInfo());
00053     frame->setReceiverAddress(ctrl->getDest());
00054     delete ctrl;
00055 
00056     frame->encapsulate(msg);
00057     return frame;
00058 }
00059 
00060 void Ieee80211MgmtAdhoc::receiveChangeNotification(int category, const cPolymorphic *details)
00061 {
00062     Enter_Method_Silent();
00063     printNotificationBanner(category, details);
00064 }
00065 
00066 void Ieee80211MgmtAdhoc::handleDataFrame(Ieee80211DataFrame *frame)
00067 {
00068     sendUp(decapsulate(frame));
00069 }
00070 
00071 void Ieee80211MgmtAdhoc::handleAuthenticationFrame(Ieee80211AuthenticationFrame *frame)
00072 {
00073     dropManagementFrame(frame);
00074 }
00075 
00076 void Ieee80211MgmtAdhoc::handleDeauthenticationFrame(Ieee80211DeauthenticationFrame *frame)
00077 {
00078     dropManagementFrame(frame);
00079 }
00080 
00081 void Ieee80211MgmtAdhoc::handleAssociationRequestFrame(Ieee80211AssociationRequestFrame *frame)
00082 {
00083     dropManagementFrame(frame);
00084 }
00085 
00086 void Ieee80211MgmtAdhoc::handleAssociationResponseFrame(Ieee80211AssociationResponseFrame *frame)
00087 {
00088     dropManagementFrame(frame);
00089 }
00090 
00091 void Ieee80211MgmtAdhoc::handleReassociationRequestFrame(Ieee80211ReassociationRequestFrame *frame)
00092 {
00093     dropManagementFrame(frame);
00094 }
00095 
00096 void Ieee80211MgmtAdhoc::handleReassociationResponseFrame(Ieee80211ReassociationResponseFrame *frame)
00097 {
00098     dropManagementFrame(frame);
00099 }
00100 
00101 void Ieee80211MgmtAdhoc::handleDisassociationFrame(Ieee80211DisassociationFrame *frame)
00102 {
00103     dropManagementFrame(frame);
00104 }
00105 
00106 void Ieee80211MgmtAdhoc::handleBeaconFrame(Ieee80211BeaconFrame *frame)
00107 {
00108     dropManagementFrame(frame);
00109 }
00110 
00111 void Ieee80211MgmtAdhoc::handleProbeRequestFrame(Ieee80211ProbeRequestFrame *frame)
00112 {
00113     dropManagementFrame(frame);
00114 }
00115 
00116 void Ieee80211MgmtAdhoc::handleProbeResponseFrame(Ieee80211ProbeResponseFrame *frame)
00117 {
00118     dropManagementFrame(frame);
00119 }
00120 
00121