User Manual, Developers Guide and API Documentation

FlowControl.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_COMMAND_FLOWCONTROL_HPP
00029 #define WNS_LDK_COMMAND_FLOWCONTROL_HPP
00030 
00031 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00032 #include <WNS/ldk/HasReceptor.hpp>
00033 #include <WNS/ldk/HasConnector.hpp>
00034 #include <WNS/ldk/HasDeliverer.hpp>
00035 #include <WNS/ldk/Delayed.hpp>
00036 
00037 #include <WNS/pyconfig/View.hpp>
00038 #include <WNS/logger/Logger.hpp>
00039 
00040 #include <WNS/ldk/tools/Gate.hpp>
00041 
00042 
00043 
00044 namespace wns { namespace ldk { namespace command {
00045 
00046     class FlowControlInterface
00047     {
00048     public:
00049         virtual void open() = 0;
00050         virtual void close() = 0;
00051 
00052     protected:
00053         virtual ~FlowControlInterface() {}
00054     };
00055 
00056 
00057     class FlowControlCommand :
00058         public Command
00059     {
00060     public:
00061         typedef enum {START, STOP} FrameType;
00062 
00063         struct {} local;
00064         struct {
00065             FrameType type;
00066         } peer;
00067         struct {} magic;
00068     };
00069 
00075     class FlowControl :
00076         public CommandTypeSpecifier<FlowControlCommand>,
00077         public HasReceptor<>,
00078         public HasConnector<>,
00079         public HasDeliverer<>,
00080         public Delayed<FlowControl>,
00081         public Cloneable<FlowControl>
00082     {
00083     public:
00084         FlowControl(fun::FUN* fuNet, const wns::pyconfig::View& config);
00085 
00086         // FlowControl interface
00087         virtual void open();
00088         virtual void close();
00089 
00090         // PDUHandler interface
00091         virtual void processIncoming(const CompoundPtr& compound);
00092         virtual void processOutgoing(const CompoundPtr& compound);
00093         virtual bool hasCapacity() const;
00094         virtual const CompoundPtr hasSomethingToSend() const;
00095         virtual CompoundPtr getSomethingToSend();
00096 
00097         virtual void onFUNCreated();
00098         virtual void calculateSizes(const CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00099         virtual CommandPool* createReply(const CommandPool* original) const;
00100 
00101     private:
00102         pyconfig::View config;
00103 
00104         CompoundPtr toSend;
00105 
00106         struct _friends {
00107             tools::GateInterface* gate;
00108         } friends;
00109 
00110         logger::Logger logger;
00111 
00112         void send(FlowControlCommand::FrameType type);
00113     };
00114 
00115 }}}
00116 
00117 #endif // NOT defined WNS_LDK_COMMAND_FLOWCONTROL_HPP
00118 
00119 

Generated on Thu May 24 03:31:37 2012 for openWNS by  doxygen 1.5.5