User Manual, Developers Guide and API Documentation

TransmissionQueue.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_TRANSMISSIONQUEUE_HPP
00030 #define WIFIMAC_DRAFTN_TRANSMISSIONQUEUE_HPP
00031 
00032 #include <WIFIMAC/draftn/BlockACKCommand.hpp>
00033 #include <WIFIMAC/management/PERInformationBase.hpp>
00034 
00035 #include <WNS/ldk/Compound.hpp>
00036 #include <WNS/service/dll/Address.hpp>
00037 #include <WNS/ldk/buffer/Buffer.hpp>
00038 
00039 namespace wifimac {
00040     namespace draftn {
00041 
00042         class BlockACK;
00043 
00057         class TransmissionQueue
00058         {
00059 
00063             typedef std::pair<wns::ldk::CompoundPtr, wns::simulator::Time> CompoundPtrWithTime;
00064 
00065         public:
00066             TransmissionQueue(BlockACK* parent_,
00067                               size_t maxOnAir_,
00068                               wns::simulator::Time maxDelay,
00069                               wns::service::dll::UnicastAddress adr_,
00070                               BlockACKCommand::SequenceNumber sn_,
00071                               wifimac::management::PERInformationBase* perMIB_,
00072                               std::auto_ptr<wns::ldk::buffer::SizeCalculator> *sizeCalculator);
00073             ~TransmissionQueue();
00074 
00076             void
00077             processOutgoing(const wns::ldk::CompoundPtr& compound);
00078 
00091             const wns::ldk::CompoundPtr
00092             hasData() const;
00093 
00097             wns::ldk::CompoundPtr
00098             getData();
00099 
00109             void
00110             processIncomingACK(std::set<BlockACKCommand::SequenceNumber> ackSNs);
00111 
00112             const size_t getNumOnAirPDUs() const
00113                 { return onAirQueue.size(); }
00114 
00115             const size_t getNumWaitingPDUs() const
00116                 { return txQueue.size(); }
00117 
00118             const unsigned int
00119             onAirQueueSize() const;
00120 
00121             const unsigned int
00122             txQueueSize() const;
00123 
00124             const unsigned int
00125             storageSize() const;
00126 
00127             const bool
00128             waitsForACK() const;
00129 
00130             const BlockACKCommand::SequenceNumber
00131             getNextSN() const
00132                 {
00133                     return nextSN;
00134                 }
00135 
00136             const wns::service::dll::UnicastAddress
00137             getReceiver()
00138                 {
00139                     return adr;
00140                 }
00141 
00142             void setMaxDelay(wns::simulator::Time delay)
00143                 {
00144                     maxDelay = delay;
00145                 }
00146 
00147             wns::simulator::Time getOldestTimestamp()
00148                 {
00149                     if (oldestTimestamp > wns::simulator::Time())
00150                         return oldestTimestamp + maxDelay;
00151                     else
00152                         return 0;
00153                 }
00154 
00155             std::list<wns::ldk::CompoundPtr>
00156             getAirableCompounds();
00157 
00158             const size_t
00159             maxAirSize()
00160                 {
00161                     return maxOnAir;
00162                 }
00163 
00164             void setMaxOnAir(size_t maxAir) 
00165                 {
00166                     maxOnAir = maxAir;
00167                 }
00168 
00169             wns::ldk::CompoundPtr
00170             getTxFront();
00171 
00172         private:
00173             bool
00174             isSortedBySN(const std::deque<CompoundPtrWithTime> q) const;
00175 
00176             wns::ldk::CompoundPtr baREQ;
00177             wifimac::management::PERInformationBase* perMIB;
00178             wns::simulator::Time maxDelay;
00179             wns::simulator::Time oldestTimestamp;
00180             size_t maxOnAir;
00181             const BlockACK* parent;
00182             const wns::service::dll::UnicastAddress adr;
00183             std::deque<CompoundPtrWithTime> txQueue;
00184             std::deque<CompoundPtrWithTime> onAirQueue;
00185             BlockACKCommand::SequenceNumber nextSN;
00186             bool waitForACK;
00187             bool baReqRequired;
00188             std::auto_ptr<wns::ldk::buffer::SizeCalculator> *sizeCalculator;
00189         };
00190 
00191 } // mac
00192 } // wifimac
00193 
00194 #endif // WIFIMAC_LOWERMAC_BLOCKACK_TRANSMISSIONQUEUE_HPP

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