INET Framework for OMNeT++/OMNEST
Ieee80211MgmtAP.h
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 #ifndef IEEE80211_MGMT_AP_H
00019 #define IEEE80211_MGMT_AP_H
00020 
00021 #include <omnetpp.h>
00022 #include <map>
00023 #include "Ieee80211MgmtAPBase.h"
00024 #include "NotificationBoard.h"
00025 
00026 
00033 class INET_API Ieee80211MgmtAP : public Ieee80211MgmtAPBase
00034 {
00035   public:
00037     enum STAStatus {NOT_AUTHENTICATED, AUTHENTICATED, ASSOCIATED};
00038 
00040     struct STAInfo {
00041         MACAddress address;
00042         STAStatus status;
00043         int authSeqExpected;  // when NOT_AUTHENTICATED: transaction sequence number of next expected auth frame
00044         //int consecFailedTrans;  //XXX
00045         //double expiry;          //XXX association should expire after a while if STA is silent?
00046     };
00047 
00048     struct MAC_compare {
00049         bool operator()(const MACAddress& u1, const MACAddress& u2) const {return u1.compareTo(u2) < 0;}
00050     };
00051     typedef std::map<MACAddress,STAInfo, MAC_compare> STAList;
00052 
00053   protected:
00054     // configuration
00055     std::string ssid;
00056     int channelNumber;
00057     simtime_t beaconInterval;
00058     int numAuthSteps;
00059     Ieee80211SupportedRatesElement supportedRates;
00060 
00061     // state
00062     STAList staList; 
00063     cMessage *beaconTimer;
00064 
00065   protected:
00066     virtual int numInitStages() const {return 2;}
00067     virtual void initialize(int);
00068 
00070     virtual void handleTimer(cMessage *msg);
00071 
00073     virtual void handleUpperMessage(cPacket *msg);
00074 
00076     virtual void handleCommand(int msgkind, cPolymorphic *ctrl);
00077 
00079     virtual void receiveChangeNotification(int category, const cPolymorphic *details);
00080 
00082     virtual STAInfo *lookupSenderSTA(Ieee80211ManagementFrame *frame);
00083 
00085     virtual void sendManagementFrame(Ieee80211ManagementFrame *frame, const MACAddress& destAddr);
00086 
00088     virtual void sendBeacon();
00089 
00092     virtual void handleDataFrame(Ieee80211DataFrame *frame);
00093     virtual void handleAuthenticationFrame(Ieee80211AuthenticationFrame *frame);
00094     virtual void handleDeauthenticationFrame(Ieee80211DeauthenticationFrame *frame);
00095     virtual void handleAssociationRequestFrame(Ieee80211AssociationRequestFrame *frame);
00096     virtual void handleAssociationResponseFrame(Ieee80211AssociationResponseFrame *frame);
00097     virtual void handleReassociationRequestFrame(Ieee80211ReassociationRequestFrame *frame);
00098     virtual void handleReassociationResponseFrame(Ieee80211ReassociationResponseFrame *frame);
00099     virtual void handleDisassociationFrame(Ieee80211DisassociationFrame *frame);
00100     virtual void handleBeaconFrame(Ieee80211BeaconFrame *frame);
00101     virtual void handleProbeRequestFrame(Ieee80211ProbeRequestFrame *frame);
00102     virtual void handleProbeResponseFrame(Ieee80211ProbeResponseFrame *frame);
00104 };
00105 
00106 #endif
00107