![]() |
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 #include <LTE/main/RANG.hpp> 00029 #include <LTE/upperconvergence/eNB.hpp> 00030 00031 #include <DLL/Layer2.hpp> 00032 #include <DLL/StationManager.hpp> 00033 00034 #include <WNS/module/Base.hpp> 00035 00036 using namespace lte; 00037 using namespace lte::main; 00038 00039 STATIC_FACTORY_REGISTER_WITH_CREATOR(RANG, 00040 wns::node::component::Interface, 00041 "lte.RANG", 00042 wns::node::component::ConfigCreator); 00043 00044 RANG::RANG(wns::node::Interface* node, const wns::pyconfig::View& _config) : 00045 dll::RANG(node, _config), 00046 config(_config), 00047 logger(config.get("logger")), 00048 flowIDPool(config.get<simTimeType>("flowIDUnbindDelay"), 1, 65535) 00049 { 00050 MESSAGE_SINGLE(NORMAL, logger, "LTE::RANG created"); 00051 } 00052 00053 void 00054 RANG::sendData( 00055 const wns::service::dll::UnicastAddress& _peer, 00056 const wns::osi::PDUPtr& pdu, 00057 wns::service::dll::protocolNumber protocol, 00058 wns::service::dll::FlowID _dllFlowID) 00059 { 00060 MESSAGE_SINGLE(NORMAL, logger, "Outgoing PDU with FlowID: "<<_dllFlowID<<" for UT: "<<_peer); 00061 if(flowIDForUT.knows(_dllFlowID)) 00062 { 00063 if(flowIDForUT.find(_dllFlowID)==_peer) 00064 dll::RANG::sendData(_peer, pdu, protocol, _dllFlowID); 00065 else 00066 { 00067 MESSAGE_SINGLE(NORMAL, logger, "FlowID: "<<_dllFlowID<<" is not Flow of UT: "<<_peer); 00068 MESSAGE_SINGLE(NORMAL, logger, "Dropping PDU."); 00069 } 00070 } 00071 else 00072 { 00073 MESSAGE_SINGLE(NORMAL, logger, "FlowID: "<<_dllFlowID<<" unknown."); 00074 MESSAGE_SINGLE(NORMAL, logger, "Dropping PDU."); 00075 } 00076 } 00077 00078 wns::service::dll::FlowID 00079 RANG::onFlowRequest(lte::helper::TransactionID _transactionId, 00080 lte::upperconvergence::ENBUpperConvergence* _bsUpperConvergence, 00081 wns::service::dll::UnicastAddress utAddress) 00082 { 00083 // choose a FlowID 00084 wns::service::dll::FlowID flowID = flowIDPool.suggestPort(); 00085 flowIDPool.bind(flowID); 00086 MESSAGE_SINGLE(NORMAL, logger, "FlowRequest received for UT: "<<utAddress<< " confirming new FlowID: "<<flowID); 00087 00088 //insert FlowID and the apropriate BS's upperconvergence to a list 00089 assure(_bsUpperConvergence, "_bsUpperConvergence not set!"); 00090 FlowIDToBS.insert(flowID, _bsUpperConvergence); 00091 00092 //save FlowIDForUT: 00093 flowIDForUT.insert(flowID, utAddress); 00094 00095 // tell the BS the chosen FlowID 00096 return flowID; 00097 } 00098 00099 void 00100 RANG::onFlowRelease(wns::service::dll::FlowID flowID) 00101 { 00102 assure(FlowIDToBS.knows(flowID), "There is no Flow with this FlowID to release. FlowID: "<<flowID); 00103 00104 FlowIDToBS.erase(flowID); 00105 flowIDPool.unbind(flowID); 00106 00107 MESSAGE_SINGLE(NORMAL, logger, "Flow released with FlowID: "<<flowID); 00108 00109 // delete flows at ip 00110 ruleControl->onFlowRemoved(flowID); 00111 } 00112 00113 void 00114 RANG::deleteFlow(wns::service::dll::FlowID flowID) 00115 { 00116 assure(FlowIDToBS.knows(flowID), "There is no Flow with this FlowID to release. FlowID: "<<flowID); 00117 FlowIDToBS.erase(flowID); 00118 flowIDForUT.erase(flowID); 00119 flowIDPool.unbind(flowID); 00120 MESSAGE_SINGLE(NORMAL, logger, "Flow released with FlowID: "<<flowID); 00121 00122 // delete flows at IPTables 00123 ruleControl->onFlowRemoved(flowID); 00124 } 00125 00126 void 00127 RANG::registerIRuleControl(wns::service::dll::IRuleControl* rControl) 00128 { 00129 assure(rControl, "IRuleControl not set."); 00130 ruleControl = rControl; 00131 }
1.5.5