User Manual, Developers Guide and API Documentation

HARQ.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_LDK_HARQ_HARQ_HPP
00029 #define WNS_LDK_HARQ_HARQ_HPP
00030 
00031 #include <WNS/ldk/harq/softcombining/Container.hpp>
00032 #include <WNS/ldk/harq/softcombining/IDecoder.hpp>
00033 #include <WNS/ldk/Compound.hpp>
00034 
00035 #include <WNS/ldk/fu/Plain.hpp>
00036 #include <WNS/ldk/Delayed.hpp>
00037 
00038 namespace wns { namespace ldk { namespace harq {
00039 
00040     class HARQCommand :
00041         public Command
00042     {
00043     public:
00044 
00045         typedef enum{
00046             I,
00047             ACK,
00048             NACK,
00049             INVALID
00050         } FrameType;
00051 
00052         HARQCommand()
00053         {
00054             peer.type = INVALID;
00055             peer.NDI = false;
00056             peer.processId = -1;
00057             peer.rv = 0;
00058         }
00059 
00060         struct {
00061         } local;
00062 
00063         struct {
00064             FrameType type;
00065             bool NDI;
00066             int processId;
00067             int rv;
00068         } peer;
00069 
00070         struct {} magic;
00071 
00072     };
00073 
00074     class HARQFU :
00075             public fu::Plain<HARQFU, HARQCommand>,
00076             public Delayed<HARQFU>
00077     {
00078     public:
00079         HARQFU(fun::FUN* fuNet, const wns::pyconfig::View& config);
00080 
00081         ~HARQFU();
00082 
00083         virtual void
00084         onFUNCreated();
00085 
00086         // SDU and PCI size calculation
00087         void
00088         calculateSizes(const CommandPool* commandPool,
00089                        Bit& commandPoolSize,
00090                        Bit& dataSize) const;
00091 
00092     private:
00093 
00094         class HARQSenderProcess
00095         {
00096         public:
00097 
00098             HARQSenderProcess(int processID, int numRVs, HARQFU* entity, wns::logger::Logger logger);
00099 
00100             bool
00101             hasCapacity() const;
00102 
00103             void
00104             enqueueTransmission(const wns::ldk::CompoundPtr& compound);
00105 
00106             void
00107             ackReceived();
00108 
00109             void
00110             nackReceived();
00111 
00112         private:
00113             int processID_;
00114 
00115             int numRVs_;
00116 
00117             HARQFU* entity_;
00118 
00119             wns::logger::Logger logger_;
00120 
00121             wns::ldk::CompoundPtr buffer_;
00122 
00123             bool waitingForFeedback_;
00124 
00125             int retransmissionCounter_;
00126 
00127         };
00128 
00129         class HARQReceiverProcess
00130         {
00131         public:
00132             HARQReceiverProcess(wns::pyconfig::View config, int processID, HARQFU* entity);
00133 
00134             void
00135             receive(const wns::ldk::CompoundPtr&);
00136 
00137             virtual void
00138             onFUNCreated();
00139 
00140         private:
00141             int processID_;
00142 
00143             int numRVs_;
00144 
00145             HARQFU* entity_;
00146 
00147             wns::logger::Logger logger_;
00148 
00149             softcombining::Container<wns::ldk::CompoundPtr> receptionBuffer_;
00150 
00151             wns::SmartPtr<softcombining::IDecoder> decoder_;
00152         };
00153 
00154         virtual void
00155         processIncoming(const wns::ldk::CompoundPtr& compound);
00156 
00157         virtual void
00158         processOutgoing(const wns::ldk::CompoundPtr&);
00159 
00160         virtual bool
00161         hasCapacity() const;
00162 
00163         virtual const wns::ldk::CompoundPtr
00164         hasSomethingToSend() const;
00165 
00166         virtual wns::ldk::CompoundPtr
00167         getSomethingToSend();
00168 
00169         void
00170         addToSendQueue(wns::ldk::CompoundPtr compound);
00171 
00172         wns::logger::Logger logger_;
00173 
00174         int numSenderProcesses_;
00175 
00176         int numReceiverProcesses_;
00177 
00178         int numRVs_;
00179 
00180         std::vector<HARQSenderProcess> senderProcesses_;
00181 
00182         std::vector<HARQFU::HARQReceiverProcess> receiverProcesses_;
00183 
00184         std::list<wns::ldk::CompoundPtr> sendQueue_;
00185     };
00186 
00187 } // harq
00188 } // ldk
00189 } // wns
00190 
00191 #endif // WNS_LDK_HARQ_HARQ_HPP

Generated on Sun May 27 03:31:44 2012 for openWNS by  doxygen 1.5.5