User Manual, Developers Guide and API Documentation

RTSCTSwithFLA.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_DRAFTN_RTSCTSWITHFLA_HPP
00030 #define WIFIMAC_DRAFTN_RTSCTSWITHFLA_HPP
00031 
00032 #include <WIFIMAC/lowerMAC/RTSCTS.hpp>
00033 
00034 #include <WIFIMAC/convergence/PhyUser.hpp>
00035 #include <WIFIMAC/lowerMAC/Manager.hpp>
00036 #include <WIFIMAC/lowerMAC/RateAdaptation.hpp>
00037 #include <WIFIMAC/lowerMAC/ITransmissionCounter.hpp>
00038 #include <WIFIMAC/lowerMAC/RTSCTS.hpp>
00039 
00040 #include <WIFIMAC/convergence/INetworkAllocationVector.hpp>
00041 #include <WIFIMAC/convergence/IRxStartEnd.hpp>
00042 #include <WIFIMAC/convergence/ITxStartEnd.hpp>
00043 #include <WIFIMAC/management/ProtocolCalculator.hpp>
00044 #include <WIFIMAC/draftn/SINRwithMIMOInformationBase.hpp>
00045 
00046 #include <WNS/ldk/fu/Plain.hpp>
00047 #include <WNS/ldk/Delayed.hpp>
00048 
00049 #include <WNS/ldk/probe/Probe.hpp>
00050 #include <WNS/probe/bus/ContextCollector.hpp>
00051 
00052 #include <WNS/simulator/Time.hpp>
00053 #include <WNS/events/CanTimeout.hpp>
00054 
00055 #include <WNS/Observer.hpp>
00056 
00057 namespace wifimac { namespace draftn {
00058 
00059     class RTSCTSwithFLACommand:
00060         public wns::ldk::Command,
00061         public wifimac::lowerMAC::RTSProviderCommand
00062 //        public wifimac::lowerMAC::RTSCTSCommand
00063     {
00064     public:
00065         struct {} local;
00066 
00067         struct {
00068             bool isFLARequest;
00069             bool isFLAResponse;
00070             wns::Ratio cqi;
00071             std::vector< std::vector<wns::Ratio> > mimoFactors;
00072             bool isRTS;
00073         } peer;
00074 
00075         struct {
00076             Bit frameSize;
00077         } magic;
00078 
00079         bool isRTS() const
00080             {
00081                 return(this->peer.isRTS);
00082             }
00083     };
00084 
00085 
00089    class RTSCTSwithFLA:
00090         public wns::ldk::fu::Plain<RTSCTSwithFLA, RTSCTSwithFLACommand>,
00091         public wns::ldk::Delayed<RTSCTSwithFLA>,
00092         public wns::events::CanTimeout,
00093         public wns::Observer<wifimac::convergence::INetworkAllocationVector>,
00094         public wns::Observer<wifimac::convergence::IRxStartEnd>,
00095         public wns::Observer<wifimac::convergence::ITxStartEnd>,
00096         public wns::ldk::probe::Probe
00097     {
00098     public:
00099 
00100         RTSCTSwithFLA(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00101 
00102         virtual
00103         ~RTSCTSwithFLA();
00104 
00105         // observer RxStartEnd
00106         void
00107         onRxStart(wns::simulator::Time expRxTime);
00108         void
00109         onRxEnd();
00110         void
00111         onRxError();
00112 
00113         // observer TxStartEnd
00114         void
00115         onTxStart(const wns::ldk::CompoundPtr& compound);
00116         void
00117         onTxEnd(const wns::ldk::CompoundPtr& compound);
00118 
00119         // observer NAV
00120         void
00121         onNAVBusy(const wns::service::dll::UnicastAddress setter);
00122         void
00123         onNAVIdle();
00124 
00128         void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00129 
00130     private:
00132         void processIncoming(const wns::ldk::CompoundPtr& compound);
00133         void processOutgoing(const wns::ldk::CompoundPtr& compound);
00134         bool hasCapacity() const;
00135         const wns::ldk::CompoundPtr hasSomethingToSend() const;
00136         wns::ldk::CompoundPtr getSomethingToSend();
00137 
00138         void onFUNCreated();
00139 
00141         void onTimeout();
00142 
00143         wns::ldk::CompoundPtr
00144         prepareRTS(const wns::ldk::CompoundPtr& mpdu);
00145 
00146         wns::ldk::CompoundPtr
00147         prepareCTS(const wns::ldk::CompoundPtr& rts);
00148 
00149         const std::string phyUserName;
00150         const std::string raName;
00151         const std::string managerName;
00152         const std::string arqName;
00153         const std::string navName;
00154         const std::string rxsName;
00155         const std::string txStartEndName;
00156         const std::string protocolCalculatorName;
00157         const std::string sinrMIBServiceName;
00158 
00159         const wns::simulator::Time estimatedValidity;
00160 
00162         const wns::simulator::Time sifsDuration;
00163 
00164         const wns::simulator::Time maximumACKDuration;
00165         const wns::simulator::Time maximumCTSDuration;
00166         const wns::simulator::Time preambleProcessingDelay;
00167         const wns::simulator::Time ctsTimeout;
00168 
00169         const wifimac::convergence::PhyMode rtsctsPhyMode;
00170 
00171         const Bit rtsBits;
00172         const Bit ctsBits;
00173         const Bit rtsctsThreshold;
00174         const bool rtsctsOnTxopData;
00175 
00176         bool nav;
00177         wns::service::dll::UnicastAddress navSetter;
00178 
00179         wns::logger::Logger logger;
00180 
00181         wns::ldk::CompoundPtr pendingRTS;
00182         wns::ldk::CompoundPtr pendingCTS;
00183         wns::ldk::CompoundPtr pendingMPDU;
00184 
00185         wifimac::draftn::SINRwithMIMOInformationBase* sinrMIB;
00186         wifimac::management::ProtocolCalculator *protocolCalculator;
00187 
00188         struct Friends
00189         {
00190             wifimac::convergence::PhyUser* phyUser;
00191             wifimac::lowerMAC::Manager* manager;
00192             wifimac::lowerMAC::RateAdaptation *ra;
00193             wifimac::lowerMAC::ITransmissionCounter* arq;
00194         } friends;
00195 
00196         enum RTSCTSState
00197         {
00198             idle,
00199             transmitRTS,
00200             waitForCTS,
00201             receiveCTS,
00202             receptionFinished
00203         } state;
00204 
00205         wns::simulator::Time ctsPrepared;
00206         wns::simulator::Time lastTimeout;
00207 
00208         wns::probe::bus::ContextCollectorPtr rtsSuccessProbe;
00209     };
00210 
00211 
00212 } // mac
00213 } // wifimac
00214 
00215 #endif // WIFIMAC_LOWERMAC_CONSTANTWAIT_HPP

Generated on Fri May 25 03:32:09 2012 for openWNS by  doxygen 1.5.5