User Manual, Developers Guide and API Documentation

TempSendBuffer.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, 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 WIMEMAC_DRP_TEMPSENDBUFFER_H
00030 #define WIMEMAC_DRP_TEMPSENDBUFFER_H
00031 
00032 #include <WNS/service/dll/Address.hpp>
00033 #include <queue>
00034 #include <WNS/simulator/Time.hpp>
00035 #include <WIMEMAC/helper/Queues.hpp>
00036 #include <WNS/logger/Logger.hpp>
00037 #include <WNS/events/CanTimeout.hpp>
00038 
00039 namespace wimemac { namespace helper {
00040          class Queues;
00041 }}
00042 
00043 namespace wimemac {
00044 namespace drp {
00045 class TempSendBuffer;
00046 class DRPScheduler;
00047 
00048 
00049     class TempSendBuffer:
00050         public wns::events::CanTimeout
00051     {
00052     public:
00053         TempSendBuffer(helper::Queues* _DRPQueues,wns::service::dll::UnicastAddress _target,
00054         DRPScheduler* _drpscheduler, wns::logger::Logger logger);
00055 
00056         void SetTxopDuration(wns::simulator::Time duration_);
00057         int CalculateMaxSize();
00058         int GetCompoundSize();
00059         bool StartBuffering();
00060         bool FillBuffer();
00061         bool CalculateTxTime(int size, wns::simulator::Time &duration);
00062         wns::simulator::Time CalculateTxTime(int size);
00063         bool IsBufferEmpty() const;
00064         wns::ldk::CompoundPtr GetCompound();
00065         void TransmitCompound(const wns::ldk::CompoundPtr& compound);
00066         void ImmAck();
00067         void StopBuffering();
00068         void NewArrival();
00069         int numCompounds();
00070         wns::simulator::Time txBufferTime();
00071 
00072         int GetNumOfTotalRetransmissions();
00073         int GetNumOfRetransmissions(const wns::ldk::CompoundPtr& compound);
00074         int GetNumOfRetransmissions();
00075         wns::service::dll::UnicastAddress GetTarget();
00076         Bit getNextCompoundSize();
00077         Bit getCurrentCompoundSize();
00078 
00079     private:
00080         enum AckType {
00081             No, Imm, Block
00082         };
00083 
00084         struct TempBuffer
00085         {
00086             Bit bits;
00087             wns::simulator::Time timeleft;
00088             wns::service::dll::UnicastAddress target;
00089             std::deque<wns::ldk::CompoundPtr> pduQueue;
00090         } tempBuffer;
00091 
00092         wns::simulator::Time txOPTime;
00093         wns::simulator::Time txOPStartTime;
00094         int firstMASOfTxOP;
00095         helper::Queues* DRPQueues;
00096         wns::logger::Logger logger;
00097 
00098         bool isWaitingSIFS;
00099         bool isTransmissionStarted;
00100         int numOfRetransmissions;
00101         int numTotalRetransmissions;
00102 
00103         int sentCompoundsInLastBufferAction;
00104         int successfullCompoundsInLastBufferAction;
00105         int sentCompoundsInLastTxOP;
00106         int successfullCompoundsInLastTxOP;
00107 
00108         const wns::simulator::Time GuardDuration;
00109         const wns::simulator::Time TxAckDuration;
00110         const wns::simulator::Time SIFS;
00111 
00112         DRPScheduler* drpscheduler;
00113 
00114         void SendCompounds();
00115         void onTimeout();
00116 
00117     };
00118 }//helper
00119 }//wimemac
00120 #endif

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