User Manual, Developers Guide and API Documentation

TXOP.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_LOWERMAC_TXOP_HPP
00030 #define WIFIMAC_LOWERMAC_TXOP_HPP
00031 
00032 #include <WIFIMAC/convergence/PhyUser.hpp>
00033 #include <WIFIMAC/lowerMAC/Manager.hpp>
00034 #include <WIFIMAC/lowerMAC/ITXOPWindow.hpp>
00035 #include <WIFIMAC/lowerMAC/ITXOPObserver.hpp>
00036 #include <WIFIMAC/lowerMAC/RateAdaptation.hpp>
00037 #include <WIFIMAC/management/ProtocolCalculator.hpp>
00038 
00039 #include <WNS/ldk/fu/Plain.hpp>
00040 #include <WNS/ldk/Processor.hpp>
00041 #include <WNS/ldk/Delayed.hpp>
00042 #include <WNS/ldk/probe/Probe.hpp>
00043 
00044 #include <WNS/events/CanTimeout.hpp>
00045 #include <WNS/probe/bus/ContextCollector.hpp>
00046 
00047 #include <WNS/Observer.hpp>
00048 
00049 namespace wifimac { namespace lowerMAC {
00063     class TXOP:
00064         public wns::ldk::fu::Plain<TXOP, wns::ldk::EmptyCommand>,
00065         public wns::ldk::Processor<TXOP>,
00066     public wns::ldk::probe::Probe
00067     {
00068     public:
00069 
00070         TXOP(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00071 
00072         virtual
00073         ~TXOP();
00074 
00075         // observer TxStartEnd
00076         void
00077         onTxStart(const wns::ldk::CompoundPtr& compound);
00078         void
00079         onTxEnd(const wns::ldk::CompoundPtr& compound);
00080 
00083     void
00084     registerObserver(wifimac::lowerMAC::ITXOPObserver *observer) {observers.push_back(observer);}
00085 
00086     void setTXOPLimit(wns::simulator::Time limit);
00087     private:
00089         void processIncoming(const wns::ldk::CompoundPtr& compound);
00090         void processOutgoing(const wns::ldk::CompoundPtr& compound);
00091 
00092         bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00093 
00094         void onFUNCreated();
00095 
00097     void closeTXOP();
00098 
00099         const std::string managerName;
00100         const std::string protocolCalculatorName;
00101         const std::string txopWindowName;
00102         const std::string raName;
00103 
00105         const wns::simulator::Time sifsDuration;
00106         const wns::simulator::Time maximumACKDuration;
00107         const bool singleReceiver;
00108     
00110     bool maxOutTXOP;
00111 
00112     wns::simulator::Time txopLimit;
00113         wns::simulator::Time remainingTXOPDuration;
00114         wns::service::dll::UnicastAddress txopReceiver;
00115 
00116         wns::logger::Logger logger;
00117 
00118     std::vector<wifimac::lowerMAC::ITXOPObserver *> observers;
00119         wifimac::management::ProtocolCalculator* protocolCalculator;
00120         struct Friends
00121         {
00122             wifimac::lowerMAC::Manager* manager;
00123             wifimac::lowerMAC::ITXOPWindow* txopWindow;
00124             wifimac::lowerMAC::RateAdaptation* ra;
00125         } friends;
00126 
00127     wns::probe::bus::ContextCollectorPtr TXOPDurationProbe;
00128     };
00129 
00130 } // lowerMAC
00131 } // wifimac
00132 
00133 #endif // WIFIMAC_LOWERMAC_TXOP_HPP

Generated on Sun May 27 03:32:12 2012 for openWNS by  doxygen 1.5.5