User Manual, Developers Guide and API Documentation

AssociationHandler.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 LTE_CONTROLPLANE_ASSOCIATIONHANDLER_ASSOCIATIONHANDLER_HPP
00029 #define LTE_CONTROLPLANE_ASSOCIATIONHANDLER_ASSOCIATIONHANDLER_HPP
00030 
00031 #include <LTE/controlplane/flowmanagement/IFlowManager.hpp>
00032 #include <LTE/helper/HasModeName.hpp>
00033 #include <LTE/helper/SwitchConnector.hpp>
00034 
00035 #include <DLL/services/control/Association.hpp>
00036 
00037 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00038 #include <WNS/ldk/HasReceptor.hpp>
00039 #include <WNS/ldk/HasConnector.hpp>
00040 #include <WNS/ldk/HasDeliverer.hpp>
00041 #include <WNS/ldk/Compound.hpp>
00042 #include <WNS/ldk/Command.hpp>
00043 #include <WNS/ldk/FlowSeparator.hpp>
00044 #include <WNS/ldk/FUNConfigCreator.hpp>
00045 #include <WNS/logger/Logger.hpp>
00046 #include <WNS/service/dll/Address.hpp>
00047 #include <WNS/service/dll/FlowID.hpp>
00048 #include <WNS/Enum.hpp>
00049 #include <WNS/pyconfig/View.hpp>
00050 #include <WNS/Subject.hpp>
00051 #include <WNS/SmartPtr.hpp>
00052 
00053 
00054 namespace lte { namespace controlplane{ namespace associationHandler {
00055 
00056       ENUM_BEGIN(CompoundType);
00057       ENUM(association_req,       0);
00058       ENUM(association_ack,       1);
00059       ENUM(disassociation_req,    2);
00060       ENUM(disassociation_ack,    3);
00061       ENUM_END();
00062 
00063       class AssociationHandler;
00064 
00066       class AssociationCommand :
00067     public wns::ldk::Command
00068       {
00069       public:
00071     typedef int CompoundType;
00072 
00073     AssociationCommand() {
00074     };
00075 
00076     struct Local {
00077     } local;
00078 
00079     struct Peer {
00080       CompoundType myCompoundType;
00081       wns::service::dll::UnicastAddress src;
00082       wns::service::dll::UnicastAddress dst;
00083       wns::service::dll::UnicastAddress user;
00084       lte::controlplane::flowmanagement::IFlowSwitching::ControlPlaneFlowIDs controlPlaneFlowIDs;
00085 
00086       // in disassociation_req
00087       wns::service::dll::UnicastAddress targetRAP;
00088 
00089       // in disassociation_ack
00090       bool preserve;
00091 
00092       // used for mode switch of association_ack by RN
00093       std::string mode;
00094       // duplexgroup: TDD = 0, fd = 3,hd = 1/2
00095       int duplexGroup;
00096     } peer;
00097 
00098     struct Magic {
00099       // user is not allowed to know the bs address
00100       // which but must be used now for the e2e flow control
00101       wns::service::dll::UnicastAddress bs;
00102       // can be used to do assures for correct reception
00103       const AssociationHandler* sender;
00104       // can be used to do assures for correct reception
00105       //SmartPtr<OnDeleteWarner> warner;
00106     } magic;
00107       };
00108 
00109       class AssociationHandler :
00110     virtual public wns::ldk::FunctionalUnit,
00111     public wns::ldk::CommandTypeSpecifier<AssociationCommand>,
00112     public wns::ldk::HasReceptor<>,
00113     public wns::ldk::HasConnector<lte::helper::SwitchConnector>,
00114     public wns::ldk::HasDeliverer<>,
00115     public lte::helper::HasModeName,
00116     public dll::services::control::AssociationInfo
00117       {
00118       public:
00120     AssociationHandler(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00121 
00123     virtual ~AssociationHandler();
00124 
00125     virtual void
00126     onFUNCreated();
00127 
00128     bool
00129     doIsAccepting(const wns::ldk::CompoundPtr& /* compound */) const;
00130 
00131     void
00132     doSendData(const wns::ldk::CompoundPtr& /* compound */);
00133 
00134     void
00135     doWakeup();
00136 
00137     virtual void
00138     disassociationOnTimeout(const wns::service::dll::UnicastAddress /*adr*/, const std::string /*mode*/){};
00139 
00140     void
00141     calculateSizes(const wns::ldk::CommandPool* commandPool,
00142                Bit& commandPoolSize,
00143                Bit& dataSize) const;
00144 
00145     virtual int getMyDuplexGroup(int frameNr, bool isDL) = 0;
00146     virtual int getPeerDuplexGroup(wns::service::dll::UnicastAddress user) = 0;
00147 
00148     void
00149     notifyOnAssociated(wns::service::dll::UnicastAddress,
00150                wns::service::dll::UnicastAddress );
00151 
00152     void
00153     notifyOnDisassociated(wns::service::dll::UnicastAddress,
00154                   wns::service::dll::UnicastAddress );
00155 
00156       private:
00157     wns::ldk::fun::FUN* fun;
00158 
00159 
00160       protected:
00161     struct {
00162       wns::ldk::IConnectorReceptacle* bchBuffer;
00163       wns::ldk::IConnectorReceptacle* rachDispatcher;
00164       wns::ldk::IConnectorReceptacle* cpDispatcher;
00165       lte::controlplane::flowmanagement::IFlowSwitching* flowManager;
00166     } friends;
00167 
00168     wns::ldk::CommandReaderInterface* macgReader;
00169     wns::ldk::CommandReaderInterface* rlcReader;
00170 
00171     dll::ILayer2* layer2;
00172 
00173     dll::services::control::Association* associationService;
00174 
00175     lte::helper::SwitchConnector* connector;
00176 
00178     Bit commandSize;
00179 
00181     std::list<std::string> flowSeparatorNames;
00182     std::list<wns::ldk::FlowSeparator*> flowSeparators;
00183 
00185     wns::logger::Logger logger;
00186       };
00187     }
00188   }
00189 }
00190 #endif // LTE_CONTROLPLANE_ASSOCIATIONHANDLER_ASSOCIATIONHANDLER_HPP

Generated on Mon May 21 03:32:02 2012 for openWNS by  doxygen 1.5.5