![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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_FLOWMANAGER_HPP 00029 #define LTE_CONTROLPLANE_FLOWMANAGER_HPP 00030 00031 #include <LTE/controlplane/flowmanagement/IFlowManager.hpp> 00032 #include <LTE/helper/TransactionID.hpp> 00033 00034 #include <WNS/ldk/ControlServiceInterface.hpp> 00035 #include <WNS/ldk/FlowSeparator.hpp> 00036 #include <WNS/ldk/FlowGate.hpp> 00037 #include <WNS/ldk/tools/Synchronizer.hpp> 00038 #include <WNS/service/dll/FlowID.hpp> 00039 #include <WNS/service/tl/FlowID.hpp> 00040 #include <WNS/distribution/Distribution.hpp> 00041 #include <WNS/container/Pool.hpp> 00042 00043 #include <DLL/StationManager.hpp> 00044 00045 namespace lte { namespace upperconvergence { class UEUpperConvergence; class ENBUpperConvergence; }} 00046 namespace lte { namespace controlplane { class AssociationsProxyUT; class AssociationsProxyBS; }} 00047 namespace lte { namespace controlplane { namespace flowmanagement { namespace flowhandler{ class FlowHandlerBS; class FlowHandlerUT; }}}} 00048 00049 namespace lte { namespace controlplane { namespace flowmanagement { 00050 class FlowManager : 00051 virtual public IFlowSwitching, 00052 virtual public wns::ldk::flowseparator::FlowInfoProvider 00053 { 00054 public: 00055 typedef std::list<wns::service::dll::FlowID> FlowIdList; 00056 00057 typedef wns::container::Registry<wns::service::dll::FlowID, 00058 wns::service::dll::FlowID> SwitchingTable; 00059 typedef wns::container::Registry<wns::service::dll::FlowID, 00060 wns::service::dll::UnicastAddress> FlowIDTable; 00061 typedef wns::container::Registry<wns::service::dll::FlowID, 00062 wns::service::qos::QoSClass> FlowIDToQoSTable; 00063 typedef wns::container::Registry<wns::service::dll::UnicastAddress, 00064 ControlPlaneFlowIDs> ControlPlaneFlowIdTable; 00065 00066 FlowManager(wns::ldk::ControlServiceRegistry* csr, const wns::pyconfig::View& config); 00067 virtual ~FlowManager(); 00068 00069 virtual std::string 00070 getFlowTable() const; 00071 00072 virtual std::string 00073 printControlPlaneFlowIDs(ControlPlaneFlowIDs flowIDs) const; 00074 00075 virtual bool 00076 isControlPlaneFlowID(wns::service::dll::FlowID flowID, 00077 ControlPlaneFlowIDs flowIDs) const; 00078 00079 virtual bool 00080 isControlPlaneFlowID(wns::service::dll::UnicastAddress peerAddress, wns::service::dll::FlowID flowID) const; 00081 00082 virtual void 00083 buildFlow(wns::service::tl::FlowID flowID, wns::service::qos::QoSClass qosClass){}; 00084 00085 virtual void 00086 flowBuilt(lte::helper::TransactionID) {}; 00087 00088 wns::service::dll::FlowID 00089 getBCHFlowID(); 00090 00091 virtual wns::service::dll::FlowID 00092 getFlowIDin(wns::service::dll::FlowID flowIDout); 00093 00094 virtual wns::service::dll::FlowID 00095 getFlowIDout(wns::service::dll::FlowID flowIDin); 00096 00097 bool 00098 hasFlowIDout(wns::service::dll::FlowID flowIDout); 00099 00100 bool 00101 isAwaitingAck(wns::service::dll::FlowID _flowID); 00102 00103 void 00104 deleteAllUpperFlows(wns::service::dll::UnicastAddress bsAdr); 00105 00106 void 00107 closeUpperFlows(wns::service::dll::UnicastAddress userAdr); 00108 00109 void 00110 closeUpperFlow(wns::service::dll::FlowID flowID); 00111 00112 void 00113 deleteAllFlowSeparators(wns::service::dll::UnicastAddress utAddress); 00114 00115 void 00116 openUpperFlow(wns::service::dll::FlowID flowID); 00117 00118 void 00119 deleteFlowSeparator(wns::service::dll::FlowID flowID); 00120 00122 virtual void onAssociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr) = 0; 00124 virtual void onDisassociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr) = 0; 00125 00126 wns::container::Registry<lte::helper::TransactionID, 00127 wns::service::tl::FlowID> TransactionIDToTlFlowID; 00128 00129 wns::container::Registry<lte::helper::TransactionID, 00130 wns::service::dll::FlowID> TransactionIDToOldFlowID; 00131 00132 wns::container::Registry<wns::service::tl::FlowID, 00133 wns::service::dll::FlowID> TlFlowIDToDllFlowID; 00134 00135 wns::container::Registry<lte::helper::TransactionID, 00136 wns::service::qos::QoSClass> TransactionIDToQoSClass; 00137 00138 wns::container::Registry<wns::service::dll::FlowID, 00139 wns::service::tl::FlowID> DllFlowIDToTlFlowID; 00140 00141 //maps outgoing transactionID to the incoming one (uplink direction) 00142 wns::container::Registry<lte::helper::TransactionID, 00143 lte::helper::TransactionID> TransactionIdOutToIn; 00144 00145 //maps outgoing transactionID to FlowHandler which has requested the flowID 00146 wns::container::Registry<lte::helper::TransactionID, 00147 lte::controlplane::flowmanagement::flowhandler::FlowHandlerBS*> TransactionIdOutToFlowHandler; 00148 00149 ControlPlaneFlowIdTable controlPlaneFlowIdsForPeer; 00150 00151 // Switching table: maps incoming FlowID to outgoing FlowID 00152 SwitchingTable FlowIDInToFlowIDOut; 00153 FlowIDTable FlowIDToUT; 00154 00156 virtual bool 00157 isValidFlow(const wns::ldk::ConstKeyPtr& key) const; 00158 00159 virtual bool 00160 isValidFlowId(wns::service::dll::FlowID flowID) const; 00161 00163 virtual int 00164 countFlows() const; 00165 00167 virtual int 00168 countFlows(wns::service::dll::UnicastAddress utAddress) const; 00169 00170 void 00171 insertFlowIDToUT(wns::service::dll::FlowID flowID, wns::service::dll::UnicastAddress utAdress); 00172 00173 virtual void 00174 deleteFlowsForUT(wns::service::dll::UnicastAddress utAddress); 00175 00176 virtual wns::service::dll::UnicastAddress 00177 getUTForFlow(wns::service::dll::FlowID flowID); 00178 00179 virtual FlowIdList 00180 getFlowsForUT(wns::service::dll::UnicastAddress utAddress); 00181 00182 virtual void 00183 deleteSwitchingTableForUT(wns::service::dll::UnicastAddress utAddress); 00184 00185 bool 00186 hasPreserved(wns::service::dll::UnicastAddress userAdr) const; 00187 00188 bool 00189 hasPreserved(wns::service::dll::FlowID flowID) const; 00190 00191 void 00192 registerPreservedUser(wns::service::dll::UnicastAddress userAdr); 00193 00194 void 00195 registerPreservedFlowID(wns::service::dll::FlowID flowID); 00196 00197 void 00198 deletePreservedUser(wns::service::dll::UnicastAddress userAdr); 00199 00200 protected: 00201 lte::helper::TransactionID drawNewTransactionID() const; 00202 00203 dll::ILayer2* layer2; 00204 bool plainDisassociation; 00205 wns::ldk::CommandReaderInterface* rlcReader; 00206 wns::distribution::Distribution* transactionIdDistribution; 00207 wns::logger::Logger logger; 00208 wns::container::Pool<int> flowIDPool; 00209 wns::container::Pool<int> broadcastFlowIDPool; 00210 std::string separator; 00211 std::list<IFlowSwitching::ModeName> myModes; 00212 std::list<std::string> flowSeparatorNames; 00213 std::list<wns::ldk::FlowSeparator*> flowSeparators; 00214 wns::ldk::tools::Synchronizer* upperSynchronizer; 00215 wns::ldk::FlowGate* upperFlowGate; 00216 wns::ldk::FlowGate* arqFlowGate; 00217 std::set<wns::service::dll::UnicastAddress> preservedUsers; 00218 std::set<wns::service::dll::FlowID> preservedFlowIDs; 00219 wns::service::dll::FlowID bchFlowID_; 00220 private: 00221 wns::service::dll::FlowID dllflowID; 00222 }; 00223 00224 class FlowManagerBS : 00225 public FlowManager, 00226 public IFlowManagerENB, 00227 public wns::ldk::ControlService 00228 { 00229 public: 00230 FlowManagerBS(wns::ldk::ControlServiceRegistry* csr, const wns::pyconfig::View& config); 00231 00232 virtual 00233 ~FlowManagerBS(); 00234 00235 virtual wns::service::qos::QoSClass 00236 getQoSClassForBSFlowID(wns::service::dll::FlowID dllFlowID) const; 00237 virtual wns::service::qos::QoSClass 00238 getQoSClassForUTFlowID(wns::service::dll::FlowID dllFlowID) const; 00239 virtual void 00240 setControlPlaneFlowIDs(wns::service::dll::UnicastAddress peerAddress, ControlPlaneFlowIDs flowIDs); 00241 virtual std::string 00242 getFlowTable() const; 00243 00244 virtual void 00245 buildFlow(wns::service::tl::FlowID flowID, wns::service::qos::QoSClass qosClass); 00246 00247 virtual void 00248 flowBuilt(wns::service::dll::FlowID flowID); 00249 00250 virtual ControlPlaneFlowIDs 00251 getControlPlaneFlowIDs(wns::service::dll::UnicastAddress peerAddress); 00252 00253 void 00254 forwardFlowRequest(lte::helper::TransactionID _transactionID, 00255 lte::controlplane::flowmanagement::flowhandler::FlowHandlerBS* _flowHandlerBS, 00256 wns::service::dll::UnicastAddress utAddress, 00257 wns::service::dll::FlowID oldFlowID, 00258 wns::service::qos::QoSClass qosClass); 00259 00260 virtual void 00261 onCSRCreated(); 00262 00263 void 00264 releaseFlow(wns::service::dll::FlowID flowID); 00265 00266 void 00267 deleteFlowsInRang(wns::service::dll::UnicastAddress userAdr); 00268 00269 void 00270 deleteLowerFlow(wns::service::dll::FlowID flowID); 00271 00272 void 00273 deleteAllLowerFlows(wns::service::dll::UnicastAddress userAdr, ModeName mode); 00274 00275 void 00276 onDisassociationReq(wns::service::dll::UnicastAddress userAdr, ModeName mode, bool preserved); 00277 00278 void 00279 preserveFlows(wns::service::dll::UnicastAddress userAdr); 00280 00282 virtual void onAssociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr); 00284 virtual void onDisassociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr); 00285 private: 00286 lte::upperconvergence::ENBUpperConvergence* bsUpperConvergence; 00287 lte::controlplane::AssociationsProxyBS* aProxyBS; 00288 00289 wns::container::Registry<wns::service::dll::FlowID, 00290 wns::service::qos::QoSClass> DllFlowIDToQoSClass; 00291 }; 00292 00293 class FlowManagerUT : 00294 public FlowManager, 00295 public IFlowManagerUE, 00296 public wns::ldk::ControlService 00297 { 00298 public: 00299 FlowManagerUT(wns::ldk::ControlServiceRegistry* csr, const wns::pyconfig::View& config); 00300 00301 virtual 00302 ~FlowManagerUT(); 00303 00304 virtual wns::service::qos::QoSClass 00305 getQoSClassForBSFlowID(wns::service::dll::FlowID dllFlowID) const; 00306 virtual wns::service::qos::QoSClass 00307 getQoSClassForUTFlowID(wns::service::dll::FlowID dllFlowID) const; 00308 virtual void 00309 setControlPlaneFlowIDs(wns::service::dll::UnicastAddress peerAddress, ControlPlaneFlowIDs flowIDs); 00310 virtual std::string 00311 getFlowTable() const; 00312 00313 virtual void 00314 buildFlow(wns::service::tl::FlowID flowID, wns::service::qos::QoSClass qosClass); 00315 00316 virtual void 00317 flowBuilt(lte::helper::TransactionID _transactionID, wns::service::dll::FlowID _dllFlowID); 00318 00319 virtual ControlPlaneFlowIDs 00320 getControlPlaneFlowIDs(wns::service::dll::UnicastAddress peerAddress); 00321 00322 void 00323 releaseFlow(wns::service::tl::FlowID flowID); 00324 00325 void 00326 flowReleased(wns::service::dll::FlowID flowID); 00327 00328 void 00329 getAssociations(); 00330 00331 std::string 00332 selectMode(); 00333 00334 virtual void 00335 onCSRCreated(); 00336 00337 void 00338 onDisassociatedPerMode(wns::service::dll::UnicastAddress bsAdr, ModeName mode, bool preserved); 00339 00340 void 00341 onAssociatedPerMode(wns::service::dll::UnicastAddress rapAdr, bool preserved); 00342 00343 void 00344 disassociating(ModeName mode); 00345 00346 void 00347 onPlainDisassociation(ModeName mode); 00348 00349 void 00350 reBuildFlows(wns::service::dll::UnicastAddress bsAdr, bool preserved); 00351 00352 void 00353 deleteLowerFlow(wns::service::dll::FlowID flowID); 00354 00355 void 00356 deleteAllLowerFlows(ModeName mode); 00357 00358 void 00359 closeLowerFlows(ModeName mode); 00360 00362 virtual void onAssociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr); 00364 virtual void onDisassociated(wns::service::dll::UnicastAddress userAdr, wns::service::dll::UnicastAddress dstAdr); 00365 private: 00366 void 00367 insertDroppedFlowIDs(); 00368 00369 00370 FlowIDTable DroppedFlowIDs; 00371 wns::service::dll::FlowID l2FlowID; 00372 std::string selectedMode; 00373 lte::controlplane::AssociationsProxyUT* aProxyUT; 00374 lte::upperconvergence::UEUpperConvergence* utUpperConvergence; 00375 wns::container::Registry<wns::service::tl::FlowID, 00376 lte::controlplane::flowmanagement::flowhandler::FlowHandlerUT*> TlFlowIDToFlowHandler; 00377 FlowIDToQoSTable DllFlowIDToQoSClass; 00378 }; 00379 } 00380 } 00381 } 00382 00383 #endif // LTE_CONTROLPLANE_FLOWMANAGER_HPP
1.5.5