User Manual, Developers Guide and API Documentation

Beacon.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiFiMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2007
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 16, D-52074 Aachen, Germany
00009  * phone: ++49-241-80-27910,
00010  * fax: ++49-241-80-22242
00011  * email: info@openwns.org
00012  * www: http://www.openwns.org
00013  * _____________________________________________________________________________
00014  *
00015  * openWNS is free software; you can redistribute it and/or modify it under the
00016  * terms of the GNU Lesser General Public License version 2 as published by the
00017  * Free Software Foundation;
00018  *
00019  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00020  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00021  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00022  * details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00026  *
00027  ******************************************************************************/
00028 
00029 #ifndef WIFIMAC_MANAGEMENT_BEACON_HPP
00030 #define WIFIMAC_MANAGEMENT_BEACON_HPP
00031 
00032 #include <WIFIMAC/lowerMAC/Manager.hpp>
00033 #include <WIFIMAC/management/ILinkNotification.hpp>
00034 #include <WIFIMAC/pathselection/IPathSelection.hpp>
00035 #include <WIFIMAC/convergence/PhyMode.hpp>
00036 
00037 #include <WNS/ldk/fu/Plain.hpp>
00038 #include <WNS/ldk/Delayed.hpp>
00039 #include <WNS/ldk/Command.hpp>
00040 #include <WNS/logger/Logger.hpp>
00041 #include <WNS/events/PeriodicTimeout.hpp>
00042 #include <WNS/events/CanTimeout.hpp>
00043 #include <WNS/service/dll/Address.hpp>
00044 #include <WNS/PowerRatio.hpp>
00045 #include <WNS/pyconfig/Sequence.hpp>
00046 
00047 #include <map>
00048 
00049 namespace wifimac { namespace management {
00050 
00051     class BeaconCommand :
00052         public wns::ldk::Command
00053     {
00054     public:
00055         struct {} local;
00056         struct {
00057             std::string bssId;
00058         } peer;
00059         struct {} magic;
00060     };
00061 
00070     class Beacon :
00071         public wns::ldk::fu::Plain<Beacon, BeaconCommand>,
00072         public wns::ldk::Delayed<Beacon>,
00073         public LinkNotificator,
00074         public wns::events::PeriodicTimeout,
00075         public wns::events::CanTimeout
00076     {
00077     public:
00078 
00079         Beacon(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00080 
00081         virtual
00082         ~Beacon();
00083 
00085         void processIncoming(const wns::ldk::CompoundPtr& compound);
00086         void processOutgoing(const wns::ldk::CompoundPtr& compound);
00087         bool hasCapacity() const;
00088         const wns::ldk::CompoundPtr hasSomethingToSend() const;
00089         wns::ldk::CompoundPtr getSomethingToSend();
00090 
00091 
00092     private:
00097         virtual void onFUNCreated();
00098 
00104         virtual void periodically();
00105 
00111         virtual void onTimeout();
00112 
00116         void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00117 
00118         wns::pyconfig::View config;
00119         wns::logger::Logger logger;
00120 
00121         wns::ldk::CompoundPtr currentBeacon;
00122 
00123         const std::string phyUserCommandName;
00124 
00128         wns::simulator::Time scanDuration;
00129         wns::pyconfig::Sequence scanFrequencies;
00130         wns::pyconfig::Sequence::iterator<double> freqIter;
00131 
00132         const wifimac::convergence::PhyMode beaconPhyMode;
00133 
00134 
00139         const std::string bssId;
00140 
00144         typedef std::map<wns::Power, wns::service::dll::UnicastAddress> power2adrMap;
00145         power2adrMap beaconRxStrength;
00146         typedef std::map<wns::service::dll::UnicastAddress, double> adr2frequencyMap;
00147         adr2frequencyMap bssFrequencies;
00148 
00149         struct Friends
00150         {
00151             wifimac::lowerMAC::Manager* manager;
00152         } friends;
00153     };
00154 
00155 
00156 } // mac
00157 } // wifimac
00158 
00159 #endif // WIFIMAC_SCHEDULER_HPP

Generated on Mon May 21 03:32:15 2012 for openWNS by  doxygen 1.5.5