User Manual, Developers Guide and API Documentation

PreambleGenerator.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_CONVERGENCE_PREAMBLEGENERATOR_HPP
00030 #define WIFIMAC_CONVERGENCE_PREAMBLEGENERATOR_HPP
00031 
00032 #include <WIFIMAC/lowerMAC/Manager.hpp>
00033 #include <WIFIMAC/convergence/PhyUser.hpp>
00034 #include <WIFIMAC/management/ProtocolCalculator.hpp>
00035 
00036 #include <WNS/ldk/fu/Plain.hpp>
00037 #include <WNS/ldk/Delayed.hpp>
00038 
00039 namespace wifimac { namespace convergence {
00040 
00041     class PreambleGeneratorCommand:
00042         public wns::ldk::Command
00043     {
00044     public:
00045         struct {} local;
00046         struct {
00047             // id of the upcoming frame to which the preamble belongs to
00048             wns::Birthmark frameId;
00049         } peer;
00050         struct {} magic;
00051 
00052         wns::Birthmark getFrameId() const
00053         {
00054             return(this->peer.frameId);
00055         }
00056     };
00057 
00075     class PreambleGenerator:
00076         public wns::ldk::fu::Plain<PreambleGenerator, PreambleGeneratorCommand>,
00077         public wns::ldk::Delayed<PreambleGenerator>
00078     {
00079     public:
00080         PreambleGenerator(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00081 
00082         virtual
00083         ~PreambleGenerator();
00084 
00085     private:
00087         void processIncoming(const wns::ldk::CompoundPtr& compound);
00088         void processOutgoing(const wns::ldk::CompoundPtr& compound);
00089         bool hasCapacity() const;
00090         const wns::ldk::CompoundPtr hasSomethingToSend() const;
00091         wns::ldk::CompoundPtr getSomethingToSend();
00092 
00093         void onFUNCreated();
00094 
00098         void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00099 
00100         const std::string phyUserName;
00101         const std::string protocolCalculatorName;
00102         const std::string managerName;
00103 
00104         wns::logger::Logger logger;
00105 
00106         wns::ldk::CompoundPtr pendingCompound;
00107         wns::ldk::CompoundPtr pendingPreamble;
00108         wifimac::management::ProtocolCalculator* protocolCalculator;
00109 
00110         struct Friends
00111         {
00112             wifimac::convergence::PhyUser* phyUser;
00113             wifimac::lowerMAC::Manager* manager;
00114         } friends;
00115     };
00116 } // mac
00117 } // wifimac
00118 
00119 #endif // WIFIMAC_CONVERGENCE_PREAMBLEGENERATOR_HPP

Generated on Sun May 27 03:32:06 2012 for openWNS by  doxygen 1.5.5