User Manual, Developers Guide and API Documentation

StopAndWaitARQ.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_STOPANDWAITARQ_HPP
00030 #define WIFIMAC_LOWERMAC_STOPANDWAITARQ_HPP
00031 
00032 #include <WIFIMAC/lowerMAC/Manager.hpp>
00033 #include <WIFIMAC/convergence/IRxStartEnd.hpp>
00034 #include <WIFIMAC/convergence/ITxStartEnd.hpp>
00035 #include <WIFIMAC/management/PERInformationBase.hpp>
00036 #include <WIFIMAC/convergence/PhyMode.hpp>
00037 #include <WIFIMAC/lowerMAC/ITransmissionCounter.hpp>
00038 
00039 #include <WNS/ldk/arq/StopAndWait.hpp>
00040 #include <WNS/Observer.hpp>
00041 #include <WNS/ldk/Layer.hpp>
00042 #include <WNS/simulator/Time.hpp>
00043 
00044 #include <WNS/ldk/probe/Probe.hpp>
00045 #include <WNS/probe/bus/ContextCollector.hpp>
00046 
00047 namespace wifimac { namespace lowerMAC {
00048 
00052      class StopAndWaitARQ :
00053         public wns::ldk::arq::StopAndWait,
00054         public wns::Observer<wifimac::convergence::IRxStartEnd>,
00055         public wns::Observer<wifimac::convergence::ITxStartEnd>,
00056         public wifimac::lowerMAC::ITransmissionCounter,
00057         public wns::ldk::probe::Probe
00058     {
00059     public:
00060         StopAndWaitARQ(wns::ldk::fun::FUN* fuNet, const wns::pyconfig::View& config);
00061 
00062         // observer ChannelState
00063         void
00064         onChannelBusy();
00065         void
00066         onChannelIdle();
00067 
00068         // observer RxStartEnd
00069         void
00070         onRxStart(wns::simulator::Time expRxTime);
00071         void
00072         onRxEnd();
00073         void
00074         onRxError();
00075 
00076         // observer TxStartEnd
00077         void
00078         onTxStart(const wns::ldk::CompoundPtr& compound);
00079         void
00080         onTxEnd(const wns::ldk::CompoundPtr& compound);
00081 
00082         // implementation of ITransmissionCounter
00083         void
00084         onTransmissionHasFailed(const wns::ldk::CompoundPtr& compound);
00085 
00086         unsigned int
00087         getTransmissionCounter(const wns::ldk::CompoundPtr& compound) const;
00088 
00089         void
00090         copyTransmissionCounter(const wns::ldk::CompoundPtr& src, const wns::ldk::CompoundPtr& dst);
00091 
00092     private:
00093         void
00094         onFUNCreated();
00095 
00096         wns::ldk::CompoundPtr getData();
00097 
00098         void
00099         transmissionHasFailed(const wns::ldk::CompoundPtr& compound);
00100 
00101         void onTimeout();
00102         void processOutgoing(const wns::ldk::CompoundPtr& compound);
00103         void processIncoming(const wns::ldk::CompoundPtr& compound);
00104         bool hasCapacity() const;
00105 
00106         const std::string rxsName;
00107         const std::string txStartEndName;
00108         const std::string managerName;
00109         const std::string perMIBServiceName;
00110 
00111         const int shortRetryLimit;
00112         const int longRetryLimit;
00113         const Bit rtsctsThreshold;
00114 
00115         int stationShortRetryCounter;
00116         int stationLongRetryCounter;
00117         int shortRetryCounter;
00118         int longRetryCounter;
00119 
00120         const wns::simulator::Time sifsDuration;
00121         const wns::simulator::Time maximumACKDuration;
00122         const wns::simulator::Time ackTimeout;
00123 
00124         const wifimac::convergence::PhyMode ackPhyMode;
00125 
00126         const bool bianchiRetryCounter;
00127 
00128         enum AckState {
00129             none,
00130             waitForACK,
00131             receiving,
00132             receptionFinished,
00133             sendingACK
00134         } ackState;
00135 
00136         struct Friends
00137         {
00138             wifimac::lowerMAC::Manager* manager;
00139         } friends;
00140 
00141         wifimac::management::PERInformationBase* perMIB;
00142 
00143         wns::probe::bus::ContextCollectorPtr numTxAttemptsProbe;
00144     };
00145 
00146 } // namespace lowerMAC
00147 } // namespace wifimac
00148 
00149 #endif //ifndef WIFIMAC_LOWERMAC_STOPANDWAITARQ_HPP

Generated on Sat May 26 03:32:09 2012 for openWNS by  doxygen 1.5.5