User Manual, Developers Guide and API Documentation

eNB.cpp

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. 16, 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/upperconvergence/eNB.hpp>
00029 #include <LTE/rlc/RLCCommand.hpp>
00030 #include <LTE/main/IRANG.hpp>
00031 
00032 #include <DLL/Layer2.hpp>
00033 #include <DLL/RANG.hpp>
00034 
00035 #include <DLL/StationManager.hpp>
00036 #define A2N(a) layer2->getStationManager()->getStationByMAC(a)->getName()
00037 
00038 using namespace lte::upperconvergence;
00039 
00040 STATIC_FACTORY_REGISTER_WITH_CREATOR(ENBUpperConvergence,
00041                      wns::ldk::FunctionalUnit,
00042                                      "lte.eNBUpperConvergence",
00043                      wns::ldk::FUNConfigCreator);
00044 
00045 ENBUpperConvergence::ENBUpperConvergence(wns::ldk::fun::FUN* _fun, const wns::pyconfig::View& config) :
00046     dll::APUpperConvergence(_fun, config),
00047     layer2(NULL),
00048     rlcReader(NULL),
00049     flowManagementRang(NULL)
00050 {
00051 }
00052 
00053 void
00054 ENBUpperConvergence::onFUNCreated()
00055 {
00056   layer2 = getFUN()->getLayer<dll::ILayer2*>();
00057   rlcReader   = getFUN()->getCommandReader("rlc");
00058   assure(rlcReader, "rlcReader not set");
00059   dll::UpperConvergence::onFUNCreated();
00060 }
00061 
00062 void
00063 ENBUpperConvergence::registerHandler(wns::service::dll::protocolNumber proto,
00064                     wns::service::dll::Handler* dh)
00065 {
00066   dll::APUpperConvergence::registerHandler(proto, dh);
00067 
00068   assureType(dh, lte::main::rang::IFlowManagement*);
00069 
00070   flowManagementRang = dynamic_cast<lte::main::rang::IFlowManagement*>(dh);
00071   assure(flowManagementRang, "ENBUpperConvergence failed to register lte::main::rang::IFlowManagment");
00072 }
00073 
00074 void
00075 ENBUpperConvergence::sendData(
00076     const wns::service::dll::UnicastAddress& _peer,
00077     const wns::osi::PDUPtr& pdu,
00078     wns::service::dll::protocolNumber protocol,
00079     wns::service::dll::FlowID _dllFlowID)
00080 {
00081     // received compound from RANG
00082     // _dllFlowID is valid between RANG and ENB
00083     MESSAGE_SINGLE(NORMAL, logger,"Sending Compound with RANG-DLL-FlowID="<< _dllFlowID<<" to: "<<A2N(_peer));
00084     dll::UpperConvergence::sendData(_peer, pdu, protocol, _dllFlowID);
00085 }
00086 
00087 void
00088 ENBUpperConvergence::processIncoming(const wns::ldk::CompoundPtr& compound)
00089 {
00090     // the FlowID is read out of the RLC command to be forwarded to the datahandler
00091     lte::rlc::RLCCommand* rlcCommand = rlcReader->readCommand<lte::rlc::RLCCommand>(compound->getCommandPool());
00092     assure(rlcCommand, "RlcCommand not set");
00093 
00094     MESSAGE_BEGIN(NORMAL, logger, m, getFUN()->getName());
00095     m << ": doOnData(), forwarding packet from "<<A2N(rlcCommand->peer.source)<<" to RANG";
00096     MESSAGE_END();
00097 
00098     assure(dataHandler, "no data handler set");
00099     // as opposed to the UT upper convergence, we have to tell the RANG who we
00100     // are and where the Packet comes from.
00101     dll::UpperCommand* myCommand = getCommand(compound->getCommandPool());
00102     dataHandler->onData(compound->getData(),
00103                         myCommand->peer.sourceMACAddress,
00104                         this,
00105                         rlcCommand->rang.flowID);
00106 
00107     MESSAGE_BEGIN(VERBOSE, logger, m, getFUN()->getName());
00108     m << ": Compound backtrace"
00109       << compound->dumpJourney(); // JOURNEY
00110     MESSAGE_END();
00111 }
00112 
00113 // calls RANG to give a FlowID for the transactioinID
00114 wns::service::dll::FlowID
00115 ENBUpperConvergence::requestFlow(lte::helper::TransactionID _transactionId,
00116                                 wns::service::dll::UnicastAddress utAddress)
00117 {
00118     assure(flowManagementRang, "Flow management for RANG not set!");
00119 
00120     MESSAGE_SINGLE(NORMAL, logger, "requestFlow("<<A2N(utAddress)<<")");
00121 
00122     return flowManagementRang->onFlowRequest(_transactionId, this, utAddress);
00123 }
00124 
00125 void
00126 ENBUpperConvergence::releaseFlow(wns::service::dll::FlowID flowID)
00127 {
00128     assure(flowManagementRang, "Flow management for RANG not set!");
00129 
00130     flowManagementRang->onFlowRelease(flowID);
00131 }
00132 
00133 void
00134 ENBUpperConvergence::deleteFlow(wns::service::dll::FlowID flowID)
00135 {
00136     assure(flowManagementRang, "Flow management for RANG not set!");
00137 
00138     flowManagementRang->deleteFlow(flowID);
00139 }

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